The Mekside engine is written in C++ using a conservative subset of C++-features. There are some standard C++ library templates used mainly for vectors and lists etc. The code is written in a portable manner which compiles fine on both Linux, MacOSX and Windows (Visual Studio), with graphics and input using SDL2 and audio using FMOD to be platform independent.
For the in-game computers, Lua is used due to the simplicity of integrating the Lua engine into a C/C++ framework. Also, the language itself is simple and easy. Some work had to be done to sandbox the in-game code.
Graphics and rendering
The cross-platform library SDL is used to setup OpenGL rendering contexts in a portable way across the supported OSes. The engine is done though so it’s possible to split this on platforms so a more platform-specific setup could be used on for example Windows.
The engine currently targets OpenGL 3.3+ and GLSL 3.30.
The graphics rendering uses pre-calculated VBOs for all static voxel geometry and instancing for dynamic voxel geometry. NPCs and player objects are rendered with VBOs and a skinning GLSL vertex-shader.
The engine uses a fully HDR pipeline with proper linear lighting and a HDR buffer before applying a cinematic-like tone-mapping function and gamma correction to produce the final rendering. A camera-like exposure algorithm changes exposure depending on the light-level the player sees, producing a nice touch where it takes some seconds to see anything when entering a cave or venturing outside again in the sunlight.
The sky is rendered using a proper scientific skylight simulation model that can simulate the atmospheric wavelength absorptions at different points in the sky at different times of the day.
The engine integrates the Bullet physics library, with a huge number of additions and tweaks to make it useable in a highly dynamic environment like Mekside. A lot of work had to be done to make player and NPC movement seamless across the voxelized other geometry, and to make the mechanics structures buildable, changeable and motorized in a flexible manner.