Saturday, 11 October 2008

Game of Life... now with more SDL!

You might have been wondering why there have been no updates recently - and it's very likely that you've assumed that the cause of this is a lack of progress. Well, actually progress has been incredibly good recently; however, I have been having problems getting recent videos of the Game of Life simulation onto Vimeo. As it's been a full week since my last update, I decided that I'll just post screenshots for now and post videos when Vimeo works again.

So, firstly, I completely finished my text-based version of Conway's Game of Life. It now supports the loading of user-made text files (containing a grid of 50*25 ones and zeroes) into the simulation, and has been cleaned up significantly. The new source code is available here for your viewing pleasure.

Then, deciding it was time to continue my SDL learnings with a view to getting the GUI done soon, I continued on with some tutorials, and soon created a game/test thingy where you can add, delete and drag around a collection of clou
ds (each inscribed with a helpful "Drag me!" message):

Finally, after much procrastination (and feature creep of the test above), I decided the time was right to start making the Game of Life GUI. So, after many hours of fiddly coding and battling with screenfuls (literally) of errors, here it is - the SDLGOL:

As you'll notice, now that it's drawn onto a window instead of being displayed as ASCII in a command-line view the simulation grid is significantly larger. 200*150 cells, to be exact. And yet despite the fact that TestNeighbour() alone is now run around 240,000 times per frame, it still runs incredibly quickly - which is a testimony to the speed of C++. So, in true open-source fashion, here is the source code.

No comments:

Post a Comment