Posted on Sun 05 September 2010

Task Engine

Some years ago, I was fascinated by the inner workings of the games I played. I already had learned C++, so I set out to find out more about the libraries and techniques specific to graphics programming.

My journey began with [cached]NeHe, an excellent series of tutorials for OpenGL beginners. (The lessons are available in many languages, not just C++)

Next, I read up on engine design. Of course, ambitious as I was, I aimed for a fully scalable multi-threaded engine. Had I wanted to create an actual game, this would have led to endless frustration (as any game programmer can tell you, writing an engine won't produce any quick results) Luckily, I just wanted to understand how those engines worked, so I didn't need any exciting results.

I found the first overview of engines at [cached]Gamasutra and more in depth information at [cached]GameDev.

My own engine is split in two parts - a supporting library called [cached]TaskEngine and the engine itself: [cached]OTE (click the names to reach the respective git repositories)

The TaskEngine library has two purposes: It manages the different threads of the engine and it allows those threads to communicate with each other. Several threading models and interactions are supported, for debugging even a single-threaded mode can be enforced.

Message passing uses the concept of "channels" (or topics) to which the threads can subscribe. Each channel can have multiple posters and subscribers, to support different usage models.

The following image gives a small overview of the design, click it to enlarge it:

Design of the Task Engine

The engine itself, OTE, is a bit more complicated. It basically consists of multiple threads for graphics (currently using OGRE), physics (OgreNewt), input (OIS) and game logic. Note that those subsystems could easily be replaced, e. g. using PhysX for physics calculations, since each thread only expose the standard public interface - the other threads know nothing about its inner workings.

Again, I have a diagramm (made using Dia) showing the design of OTE, this one a bit larger than the first:

Diagram of OTE

While this engine was developed on Ubuntu, it should also run on Mac OS and Windows, or at least be easily portable, since it only uses portable libraries.

Tags: programming, games, graphics

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .