Next: , Previous: Architecture, Up: Hacker's guide


3.6 About mod-gl

3.6.1 The main renderer

Liquid War 6 has a modular architecture which allows the programmer (and the player) to plug pretty much any rendering/graphics backend, provided this one is... developped.

As of 2009 the only available backend is still mod-gl, it will display the game using 3D acceleration, if available, through the SDL library, using its GL bindings.

Additionnally, versions available for Microsoft Windows and Mac OS X will probably never any other backends available. For technical reasons, those platforms do not have the flexibility of GNU/Linux and do not allow graphical libraries to be loaded dynamically. In practice, both of them require hacks that override the standard main function. Microsoft Windows has its WinMain instead, and Mac OS X is even more pedantic, requiring graphical functions to be executed in the main thread. So mod-gl is just linked statically in those versions, and the modularity of the game is purely theorical on these platforms.

This mod-gl module is really one of the key stones of Liquid War 6, and if you want to change graphical things, it's definitely the place to hack on. The source is in src/lib/gfx/mod-gl.

3.6.2 Hardware requirements

The mod-gl backend requires “moderate” hardware, but it still does require hardware acceleration. Pure software rendering through mesa for instance, won't be enough.

So if you're running Xorg on GNU/Linux and there's a DRI driver for your card, the game should run fine.

On the programmer side, the counterpart is that one should not rely on fancy OpenGL features. Textures have a maximum size of 512x512 for instance. Of course some maps are bigger than this but this means that internally, mod-gl splits them into smaller tiles, and displays those tiles one by one.

3.6.3 The gl-utils toolbox

Inside the mod-gl backend, the src/lib/gfx/mod-gl/gl-utils directory contains lots of common structures, factorized functions which can (and should, if appliable) be used.