I’ve been using the GNOME Desktop Environment ever since I first laid my eyes on it. Being an ardent supporter of open source and volunteering, I made some contributions to GNOME before even thinking of applying to Google Summer of Code. Imagine how happy I was when finding out that I had been accepted to the program under GNOME.
The ultimate goal of my project is the modernization of GNOME Nibbles. It’s one of the few games that have not been yet revamped as part of the Games Modernization Initiative. The idea is to port as much of the game as possible to Vala, using the same MVC design pattern that stands at the base of the rest of GNOME’s games. I will be mentored by Michael Catanzaro, a very involved and helpful person, who also helped me out with my first contributions, giving valuable feedback and thorough patch reviews.
Due to having my exam session after the official start of the “Students coding” period, I have decided to begin working on my project earlier, to make up for any time I will lose by focusing on studying. Even if I was not that active during this period, I have managed to get things going, making some progress and entirely respecting the previously designed timeline.
In the first few days, I spent some of my time analyzing most of the GNOME games, trying to understand how everything ties together, how are the projects structured and what similarities exist between each of them. With this information, my implementation of the game will have some common elements with the other games, making it easier to maintain and also allowing developers that are willing to contribute to more than one game to spend less time trying to get familiar with the code base and more time solving problems and implementing features.
Next, after setting up a project directory with all the required configuration files and makefiles, I worked on creating a very basic window, as seen below.
Even if it may not look special at all, there was some effort involved in setting it up. The window is being loaded using Gtk.Builder from an .ui file, together with its Gtk.HeaderBar which we’ll be putting to good use. Besides that, I have also added a GSettings instance which provides a convenient API for storing and retrieving application settings (in our case, the user preferences – everything from window size and state to more specific things like keyboard controls and tiles size).
After some more fiddling around with the source code, I have also added a “new game menu”, one that the C version seems to lack. For now, it only contains a new game button which will switch to the game view when clicked. It’s not much, but having this will make it very easy later in the development process for adding more buttons and switches.
The more interesting part was reading up on Clutter and starting the implementation of the actual game view, which is based on a GtkClutter.Embed. First step was loading the texture file (we are using the old assets for now) and filling the background with it.
This part worked out pretty smoothly so I moved onto the next one. Based on the already existent level files, I had set up the coordinates of each wall and loaded the corresponding pixmaps which resulted in displaying the beautiful designs we had from the C version of the game.
The last part I had worked on was implementing the ability to resize the game window while maintaining the desired aspect ratio and having everything scale accordingly (the walls and the background for now). For that, my mentor suggested I use a GamesGridFrame, which was also was a small library designed for the C version of the game. Considering the code was in good shape and having no reason to reinvent the wheel, I wrote a Vala API file with some help from Lethalman (Luca Bruno) and flo over at #vala on IRC, which allowed me to access the existing C library without the need for runtime bindings (Yey Vala!). With minimum effort, I achieved the desired result while also having some of the texture/drawing bugs fixed which plagued the C version of the game.
For the next few days before my end of semester exams, I will begin implementing the Worm class which requires some careful planning and some special attention. Even if I will be mostly busy studying after that, I will still try to work on some of the more minor stuff and hopefully manage to make another blog post sometimes soon.
I hope this post put some light on what I’m actually doing for my GSoC project and I’m very excited of what has yet to come.