Update: Infinitroid is free for now! Try it out on the play page.


Engine & Tech Details

Below is a brief rundown of Infinitroid's engine and tools. It's definitely a topic I could go on about; if people are interested in more let me know.

Language and libraries

The game uses a custom C++ engine whose architecture was originally inspired by Unity. So there are Entities (GameObjects in Unity), which can contain other Entities. Entities in turn contain Components, which add behavior and state data--for instance a SpriteCmp to attach sprite graphics, an EnemyBhv to attach enemy behavior, or a B2BodyCmp to attach a Box2D physics body.

The native version I work on day-to-day uses DirectX; the web build uses OpenGL. Originally those were two separate renderers, but the code had so much in common that I eventually merged them, with preprocessor branches around the API-specific calls.

Normal mapped sprites, deferred shading The bulk of the in-game graphics are rendered using a normal-mapped lighting system: every sprite has an unshaded color texture (with baked-in ambient occlusion), a normal map texture, and a specularity channel. Those are rendered to two screen buffers (color and normal+spec). Then, for each light source, those two buffers are sampled, and the result of the lighting is added to the final scene. So in essence it's a deferred shading process.

For audio I use OpenAL, basically as a stereo output buffer to dump samples into. Custom code plays sampled audio, mixes everything, and applies dynamic reverb. I formerly used FMOD, but I wanted more control, less dependencies, and the ability to do a web build. So this worked out great. For music streaming I use the vorbis library from the awesome STB collection. I also use STB-image to load graphics assets.

As mentioned I use Box2D for physics, supplemented with custom handling for a lot of particular objects.

The web build uses Emscripten to compile to asm.js and WebGL. The tools are a little janky but the result runs surprisingly well in most browsers.

I used to use the Boost libraries more, but have since weeded them out of most of my codebase. I like to keep as few dependencies as possible, and a lot of Boost is weird language hacks that add hundreds or thousands of header files to the project and don't work too well with editing tools and debuggers. It's usually hard to dig into the Boost code and figure out what the hell is going on when you need to, most of its maintainers are firm adherents of the "modern C++" culture, adding layers and layers of abstraction and generics until it's near impossible to tell where your data is and what the code is doing to it.


Visual Studio 2012 For day-to-day coding I use Visual Studio 2012 with the awesome Visual Assist X plugin, which lets me do things like rename a variable or function cleanly across the entire codebase in a couple seconds. I use the VsVim plugin which turns the text editor into a VIM clone; I'm a fan of VIM, its command mode practically lets you move text around with your mind. With Visual Studio's IntelliSense it's a powerful combo, very easy to jump to variable definitions, function definitions, peek at data types, auto-complete identifiers while typing, etc.

I dumped Visual Studio's clunky built-in MsBuild system for a dead-simple Python script that calls the compiler, linker etc. on the command line, inspired by Casey Muratori's batch-file build script on the Handmade Hero project. When I need to tweak some C++ code I can usually recompile and launch the game in 2-3 seconds. Quick iteration time is great.

For 3D modeling I use Blender 2.6. Lately I've been experimenting with 3D modeling using signed distance functions (SDFs), inspired by some of the raymarching stuff on ShaderToy (my profile is here) and cool techniques shared by Inigo Quilez, Fabrice Neyret, and other math/graphics gurus that hang out there.

My SDF-asset-generator tool is fairly recent so I've just used it for a few things so far. For certain kinds of mathematically-based shapes or organic geometry based on sampled noise it's a really cool approach, I'm looking forward to using it more.

GLSL signed distance function modeling GLSL SDF for the grub-drill (shape changes instantly as I edit code, so it's easier than it looks)

For music and sound effects I use FL Studio and a variety of instruments and soft synths: EWQL Symphonic Orchestra for orchestral samples (not recommended, its dongle-based copy protection and instability are a pain), and Sytrus, Dune CM, and Harmor for a lot of the synth parts.

My editor is integrated into the game, and focused on quick iteration; so properties of any entities can be edited and saved on the fly, and rooms and scenery can be tweaked while the pausing and resuming the game for rapid prototyping.


My go-to web stack these days is the nice minimalist Flask framework, Python 3, MySQL / MariaDB, and good ol' jQuery. This site is built using those. I try to stay out of the morass of ever-changing web frameworks out there, seems like most of that world is drowning in its own accidental complexity.

Python's slow, but for server side web stuff it's usually fine. And when it's not, it interfaces nicely with native DLLs, so I can do performance-critical stuff in C when needed (e.g. PDF generation). I love it as a language--great for text processing, shell scripts, batch jobs, utilities, mathematics, prototyping, and more. It's succinct and expressive, with lots of great built-in libraries for doing common stuff quickly.

Privacy · Other Random Projects