I hate menus

March 18, 2009
Development, History

Or to be a bit more specific, menu coding. The most agonizing part about working on Seal Hunter so far has been to get a decent menu system going, to the extent that I’ve actually been forced to (re)write the code for them a total of three times.

The first time around, I decided to simply go for Allegro’s built-in GUI system. As a feature of the graphics library itself, these were rather easy to implement and “everything just worked”. They looked terrible, but what the hey, that’s of no importance! However, as development progressed, the major issue with this approach was that they were a bit too obtrusive on the engine itself. Anytime a menu is displayed, it’ll run in a separate loop. To put this in laymen’s terms, overlaying menus on top of the game itself was very, very hard.

Very old menus

After realizing that little kink, I decided to try and rewrite the menu engine to work asynchronously from the rest of the game – in other words, being able to browse a menu without having what might be going on in the background freeze up. To put things lightly, this was way harder than I initially thought and in the I had a very unintuitive and rather sluggish version of the original GUI. I probably would’ve settled for this system in the end, but then a friend of mine discovered that these new menus somehow crashed the game for him while running on his system. I spent a fair amount of time trying to find the cause of the problem – probably two weeks, procrastination included – before giving up.

Old menus

This was the single-handedly most important lesson I’ve ever learned from as a coder, and I feel stupid today for not paying more attention to the this earlier in the course of development. Do not reinvent the wheel. I had a look around for a menu library and ended up with Guichan. Thank <insert name of deity> for it; Guichan was excellently designed and very easy to customize (read: I changed a few window colors) and it was much easier to extend than Allegro’s GUI. The few issues I had were quickly resolved thanks to the library developers and a few searches of their forum. Still, there was a lot to adapt from the remains of the old menu, and this was one of the more painful and excruciating processes I’ve been through with this project.

New menus

In today’s news, with most of the menus actually finished up, I can finally focus on the game itself again. Right now I’m working on some of the lobby<->server communication, which I actually enjoy in its perverse ways.

And stay tuned for a look at a new and quite major feature of Seal Hunter.