Infinitroid

Engine & tech details

Not sure how many people are interested in the deep technical innards of the game, but it's definitely a topic I could go on for hours about. I figured I'd give just a brief rundown here, and if people are interested maybe I can expand some more. Let me know.

Language and libraries

The game uses a hand-built C++ engine; it was originally inspired by Unity, whose architecture I studied a bit, although I haven't used Unity on any big projects. So there are Entities (i.e. GameObjects), which can contain Components and child Entities. The components bestow behavior or state data on the entities. I have a SpriteCmp to attach sprite graphics, an EnemyBhv to attach enemy behavior, a B2BodyCmp to attach a Box2D physics body to the entity, etc.

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

Normal mapped sprites, deferred shading Lighting and rendering use a lot of different approaches but the bulk of the in-game graphics are done using a normal-mapped lighting system. So every sprite has an unshaded color texture (with some ambient occlusion), a normal map texture, and a "specularity" channel. Those are rendered to 2 separate screen buffers (color and normal+spec), which are sampled and composited when rendering each light source into the final image. So a deferred shading type process.

For audio I use OpenAL, basically as a stereo output buffer to dump samples into. The code that plays audio, mixes everything, applies dynamic reverb, etc. is all custom. I used to use FMOD but wanted more control and 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 the physics engine, though with a lot of custom physics for particular things.

The web build uses Emscripten to compile to asm.js and WebGL. The tools are a little janky but the result runs surprisingly smoothly 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 the dependencies as few as possible, and a lot of Boost is weird language hacks that don't work too well with editing tools and debuggers, and add hundreds or thousands of header files. Also 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, creating mighty towers of mind-bending baroqueness and abstraction.

Tools

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 huge 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 awful built-in MsBuild system for a custom dead-simple python script that calls the compiler, linker etc. on the command line, inspired by Casey Muratori's uber simple batch-file build script on his 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 super nice.

For 3D modeling I use Blender 2.6, and lately I've been experimenting with 3D modeling using signed distance functions (SDFs), inspired by some of the raymarching stuff on ShaderToy (check out my profile on there if you're curious) and some of the cool techniques shared by Inigo Quilez, Fabrice Neyret, and other math/grapics gurus that hang out there. My OpenGL 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 bits.

The game editor is handmade and integrated into the game, focused on very 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 testing and prototyping.

Website

Not sure how many are interested in this, but my go-to web stack these days is the nice minimalist Flask framework, Python 3, MySQL / MariaDB for database stuff, and good ol' jQuery on the frontend. That's the stack this site uses. I try to stay out of the morass of ever-changing web frameworks out there, seems like there's a huge amount of ignorance and bad programming going on in that world; drowning in self-created accidental complexity.

Python's slow but for server side web stuff it's usually fine. And it interfaces pretty well with native compiled DLLs, so I've been able to write performance critical web stuff in C when needed (e.g. PDF generation). I love python as a language, despite its 100x performance penalty, and use it all the time for shell scripts, batch processes, utilities, etc. The core language is super succinct and expressive, and has a massive collection of great little libraries for getting all the common stuff done quickly.

Loading...