Archive for July, 2010

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. #