Introducing GMemory v0.1

For the last few weeks I’ve been working on a small concentration game called GMemory. This was done as a part of the Openismus trainee program.

Update: See below.

For those not familiar with the game Concentration, or Memory as I grew up knowing it, the basic idea is that one has a number of matching card pairs turned face down. The player(s) then attempt(s) to match these pairs by turning over two cards. If the cards match those two cards remain face up. Otherwise, the cards are returned to the face down position. This is repeated until all cards are face up. Here’s a screencast of GMemory being played.

As you can hopefully see, GMemory is currently in a playable state and it actual quite enjoyable if you’re into these types of games. However, there is a lot more to do to reach what I’d consider a 1.0 release. Besides some code reworking and some known bugs, I’d like to see a score tracker, multi-player mode, card animation and selectable themes.

The game is written in C using GTK+, GObject, Clutter and Cairo. In the course of writing GMemory I ran into a few bugs in clutter-gtk. The first bug was that no events were being received when using the embedded clutter gtk widget. You can find the bug report here. The second major bug I ran into was that once I got a version combination that gave me events, I always received double the events that I expected. This is a known bug and I’ve got a work around in the code for that.

There are also a number of known bugs. As you may have noticed from the screencast, the last card of the last successful match does not get shown before the statistics dialog box pops up. It seems the dialog blocks the drawing even thought the function to draw the card is called before the call to show the dialog box. Another bug is that once the game is over the playing area does not resize when the window is resized. I’ll tackle this once I’ve reworked the code some.

You can find GMemory’s git repository at Gitorious and the tarball can be had here.

Unfortunately, right now I’m building against the master branches of clutter and clutter-gtk. Expect breakage.

Btw, I'm attending GUADEC right now.

Update: After trying this on Ubuntu Lucid, I experienced none of the event-related problems with clutter-gtk. This seems to be Fedora 13 specific. Thus, I’ve removed the workaround for the double event issue and changed the configure.ac file to rely on the clutter and clutter-gtk versions shipped with Ubuntu Lucid. The new tarball is here.

Tweets for week ending 2010-07-25

  • Openismus day 39: Today I'm releasing version 0.1 of GMemory. Ugly warnings still there but it's very playable. Enjoy. http://bit.ly/aWJ0sH #
  • Oops. That last update should have read "Openismus day 38." I knew that would happen eventually. :( #
  • Openismus day 37: GMemory now has colored shapes instead of just colors. Getting ugly warnings from cairo, though. First release tomorrow. #
  • Openismus day 37: More GUI polishing. http://bit.ly/9D4kPc There's a small bug where the last card is not shown due to dialog blocking it. #
  • Openismus day 36: Decided to do the GUI before animation. Got game controls working. Statistics and timer are now in status bar. #
  • Openismus day 35: Got gameplay and resizing working pretty well now. Will tackle animation next, then the GUI. Code here: http://is.gd/dyKoj #
  • Openismus day 34: Got GMemory actually working. I really need to do a redesign, but window resizing and animation are next. Oh.. It was HOT! #

Tweets for week ending 2010-07-17

  • Openismus day 33: Started implementing actual game play functionality for GMemory. Followed up on Fedora clutter bug: http://bit.ly/b7sz3M #
  • Openismus day 32: Got randomization and basic layout completed for GMemory. Commit is here: http://bit.ly/a4pnos #
  • Openismus day 31: Ran into quite a few problem with my card layout and randomization code. Had to learned a good bit about gdb and GList. #
  • Openismus day 30: More work on gmemory. implementing randomize and layout. Read section two of http://bit.ly/bdRVsU #

Tweets for week ending 2010-07-11

  • Openismus day 29: More good progress on GMemory. Learned signals in GObjects and how to track down segfaults with gdb. http://is.gd/dm5J9 #
  • Openismus day 28: Made good progress on gmemory. Had to rearrange my classes after rethinking things. Code here: http://is.gd/dl84O #
  • Openismus day 27: Followed up on yesterday's bug, finally got back to programming. Got stuck on a segfault. Still looking for the cause. #
  • Openismus day 26: Tracked down the proper combination of package versions to get things working. Bug report here: http://bit.ly/b7sz3M #
  • Openismus day 25: Finally got my first clues to my clutter problem. Seems Fedora packages are broken. My be graphics driver, though. ?? #

Tweets for week ending 2010-07-05

  • Well, it seems that the gtk_clutter_embed examples work fine in Ubuntu 10.4 but not Fedora 13. I'll have to look into why that is on Monday. #
  • Openismus day 24: Still looking at gtk_clutter issue. Didn't get much done due to heat & lack of sleep. Fell asleep on a beanbag. ;) #
  • Openismus day 23: Ran into issues with gtk_clutter_embed and events. Clutter-only code works fine. Affects Openismus clutter tutorial, too. #
  • Openismus day 22: Went much deeper into clutter and GObject. –The devil's in the details.– Very basic clutter-derived GObjects working. #
  • Openismus day 21: Setup basic UI, started boilerplate code for clutter-based playing area and card gobjects. Then, BBQ! #
  • Openismus day 20: Familiarized myself with Clutter and how to use it within my game. Decided not to use Glade/GtkBuilder for main window. #

Tweets for week ending 2010-06-27

  • Openismus day 19: Fought a battle to get intltool integrated with autotools. Was victorious in the end! See commit: http://bit.ly/ahVlWb. #
  • Openismus day 18: Setup project skeleton using Autotools: http://bit.ly/9Q49wV. Started setting up project for i18n using intltools. #
  • Openismus day 17: False start on new project. Wanted to integrate with GNOME games, but decided to start from scratch. Read autotools tut. #
  • Openismus day 16: Read first chapter of http://bit.ly/9z7X1q. Decided on Gtk+ app to work on: "Memory" game such as http://bit.ly/bq5ZXO #
  • Openismus day 15: Met Murray for the first time. Talked about progress & what to expect going forward. Fixed small issues in Gtkmm and Gtk+. #

Tweets for week ending 2010-06-20

  • Openismus day 14: Got to work at 6:10 so I could watch afternoon matches. Finished up menus & actions, made actions contextually sensitive. #
  • Openismus day 13: Made some changes in yesterday's commit after input from Murray, fixed a silly logic bug and started with menus & actions. #
  • Openismus day 12: Still learning gtk+ API. Focused on GtkTreeIter and GtkComboBoxEntry today. Git repo here: http://bit.ly/bu7uHi #
  • Openismus day 11: Got a simple GTK+ app working to a point where I could push to my Gitorious account. Learning the GtkTreeView API mostly. #
  • Openismus day 10: Actually started writing code; simple gtk+ stuff. Got my jhbuild configuration down to ~60 modules instead of ~260. #

Tweets for week ending 2010-06-13

  • Openismus day 9: Went to Linux Tag here in Berlin. Attended talks about MeeGo, systemd and Google & open source. After-party at c-base. #
  • Openismus day 8: more gtk+, tracking down bug in glade3. Decided to learn Emacs on my own time. Got Eclipse set up with Linux Tools plugin. #
  • Openismus day 7: Did more gtk+ and emacs. RSI getting worse, though. Think I'm going to start wearing my wrist brace and see a doctor soon. #
  • Openismus day 6: more gtk+; looked into glib, gobject, and coding conventions for gtk+/gnome. more emacs setup. #
  • Openismus day 5: finished this round of jhbuild, started setting up emacs, started looking at gtk+ more. #

Tweets for week ending 2010-06-06

  • Openismus day 4: more jhbuild (Is there anyone for whom this works?), read up on gmmproc, made my first patch with amigadave's help. #
  • Openismus day 3: opened bank account, more jhbuild, mailing lists, autotools tutorial, read a few "items" in "Effective C++." #
  • Openismus day 2: started building GNOME with jhbuild, went to doctor w/ Anni for ultrasound, more jhbuild, read mailing lists and c++ book. #
  • Finished first day at Openismus. Met some co-workers, set up computer, installed dev packages, configured accounts and ate falafel. #

Tweets for week ending 2010-05-09

  • What have I learned from 2 weeks with #OSX Every OS has it's problems. And to think I even partly believed the #OSX lore. I prefer #Ubuntu #
  • Just now when trying to type "united airlines" I inadvertently typed #ubuntu airlines. This is bad. #
  • Mom was to fly back home on Friday. Illness got worse and she's now in the Hospital here in SD. Not sure when/if she'll be able to fly back. #
  • Going to see Conan O'Brien tonight. Should be fun. #
  • Be nice and join the #ubuntu torrent swarm. Especially if you're on a fast university network. ;) http://bit.ly/KmYqs #
  • The new #ubuntu with Long Time Support (LTS) is out. Nickname this time is Lucid Lynx. Get it here http://www.ubuntu.com #
  • Father in law got a flight for 4/26 and is back in Germany now. #airfrance refused any assistance with hotel. We had to drive to LA 3 times. #