gordallott.com

Articles

Projects Archives

  1. July 2009

Recent comments

  1. Guance on First blog post
  2. bledlyalesNex on Activities Menu
  3. Blouse Down Peep on First blog post
  4. Don Nelson on Opengl Framebuffer Object patch for IoQuake3
  5. icesiurce on Activities Menu

The Unfortunate Undoing (CSL-II)

published on: July 6, 2009

CSL-II promo image

The Unfortunate Undoing [1] was an entry for the PyWeek [2] game development competition. I was responsible for the entire gamecode whist Jeiel Aranal [3] developed the graphics and artwork. The game placed second in the contest.

Graphics Engine

CSL-II was built using a graphics engine I developed from scratch during development. The engine is built around the ideal's of OpenGL ES and Opengl 3.1 - As such I made an attempt to reduce the amount of fixed functionality OpenGL to a minimum. Whist i managed to avoid fixed functionality function's in most of the engine, I still used glColor, glTranslate and glScale - This decision was made in order to avoid the use of glsl shaders (for compatibility reason's) and so that I would not have to manipulate any OpenGL matrices in python, which would be a slow operation. The graphics engine also relied heavily on a custom built QuadTree system.

The main problem I encountered during development was speed regression's when using Vertex Buffer object's - changing the OpenGL state is always slow but changing which VBO is currently bound a lot slows things down hugely, Thus I created a method in python that allows subclasses of an object to take advantage of a single VBO created in the parent class. This increase'd the speed dramatically.

World Engine

The Unfortunate Undoing is a fairly simple game at its heart, Which ment that I did not need to develop an elaborate world engine and could focus on other area's of the game engine. There is however one area of note in the world engine that is used throughout the game engine.

QuadTree

For this game I developed a custom built QuadTree implementation, For whatever reason there did not appear to be any pure python quadtree code available that worked adequately. There was one pre-existing quadtree implementation [4] but it had several problem's, it's general speed was quite low and it consumed huge amount's of memory.

The quadtree I developed for CSL-II uses python deque object's instead of python lists, these are much more memory efficient, It also create's new nodes as they are required instead of creating all the nodes at once, this allows for much more flexibility and a huge speed increase. Using a quadtree in this game engine turned out to be many time's more efficient than the single list of game entity's approach.

The quadtree also allows for huge numbers of world entities without significantly affecting engine performance.

Level Editor

I built the level editor for CSL-II based on the lesson's I learnt with CSL-I [5] - The editor is once again built with inkscape but with a much better developed loading mechanism that feeds directly into a quadtree generation method.