About me
I'm a computer science engineer with a strong interest in applied mathematics. I keep developing games in my spare time, alongside my other main hobby: jazz music.
Behind the scenes
I chose not to use an existing game engine such as Unity or Unreal, because I enjoy programming every part myself and discovering techniques. Therefore, I created TRE (TinyRenderEngine), a toolkit built on top of SDL2 and OpenGL that is the foundation of all my games. TRE is not a game engine, but it provides mesh operations, UI, shaders, contact algorithms and a sound thread.
Some thoughts on C++ features for games
TRE uses the STL but limits to C++17 features-set. Even if STL relies on exceptions for error handling, it costs virtually nothing at runtime as long as none is thrown. As long as exceptions are treated as fatal, unrecoverable errors, the STL remains perfectly usable, at least from a solo developer's point of view. I also like one of the C++ principle: "you don't pay for what you don't use".
Rendering API: modern OpenGL vs. Vulkan
Although OpenGL is an old rendering API, it is still widely used in legacy applications and small projects. Vulkan gives fine-grained control, and it allows the rendering part to be multi-threaded. Since my games are not limited by the CPU-side rendering thread, OpenGL remains my default rendering API.
Object-oriented vs. data-oriented design for games
Software engineers often adopt the object-oriented paradigm. For generic game engines, it usually leads to an architecture built around entities (see for example Data Driven Entity Component System in C++17). Yet at a coarse level, a game is simply software that turns data into rendered frames, both image and sound.
In a game, data can be split by usage: player input (mouse, keyboard, joystick), game state (game logic, physics) and rendering data. Data-oriented design gives each kind of data a clearer scope and makes parallelism easier. These two talks helped me put it into practice:
- CppCon 2014: Mike Acton, “Data-Oriented Design and C++”
- CppCon 2018: Stoyan Nikolov, “OOP Is Dead, Long Live Data-oriented Design”
Porting a C++/OpenGL game to web browsers
WebAssembly makes it possible to run native applications inside web browsers. For a C++ desktop application built on SDL2 and OpenGL, the Emscripten toolchain provides a way to port it to the web. Browsers do come with their own constraints, such as WebGL2 for rendering and security restrictions.
