Spark – a mulithreaded 3d game library in C++
Most of my free time as of late has been spent on a little side project I’m tentatively calling the ‘Spark Engine.’ One of the primary performance caveats of the technology I’ve written in the past was the limitation of being a single threaded application. While this in and of it’s self is not a problem and in many ways simplifies development, it also forces the application to strongly control how much is done each frame to maintain a reasonable framerate. To solve this issue I placed the renderer in it’s own thread and further reduced possible points of conention by only communicating through asyncronous command objects. While none of this is anything new to anyone who is up on game development technology, it is still a step forward from the previous technology I’ve been using.
Prior to this project I had been using tolua++ to bind my scripting language of choice to the API, but I’ve found that luabind is in many ways far superior. With it, unlike before, objects in scripts can inherit and implement base classes defined in C++, including event listeners, timers, and game object components. After realizing the power of this functionality I have not looked back. Another great benefit is the ability to define bindings in C++ without mangling the header files with unsightly tolua declarations. Although this apriach is not without it’s downsides; luabind relies on boost which adds extra dependencies and the vast amount of templates increase compile time. But, these seem like reasonable trade-offs considering the gain.