Ventures of an ex indie game developer

Uggggly!

It's a good thing that you never realize how much work something is when you set out to do it. I did for example not realize that I had to implement JSON encode/decode to get i18n working. JSON is of course ECMAScript, which use (almost?) UTF-16, so according to the RFC4627: "[t]o escape an extended character that is not in the Basic Multilingual Plane, the character is represented as a twelve-character sequence, encoding the UTF-16 surrogate pair". Welcome to the jungle. (JsonCpp only had conversion from, but not to, JSON UTF-16-encoded strings, so went with homebrew.) Got that ugly shit working.

The game itself is currently sorta two .cpp files; App.cxx, 3.4k lines and Game.cpp, 1.2k lines. There's a lot of ugly hacks and magic numbers in those lines, but it's safe to say that it wouldn't be possible to improve quality much by orienting around objects, adding soft coding, refactor using some nifty design patterns or go balloonies with architectural astronauting. Nope, when I need to maintain I'll figure out the magic numbers easily enough. And the underlying engine code is squeaky clean, which helps.

To give you an idea of the game code quality there's a lot of

const float a = lDrawAngle;
DrawBarrelCompass((int)x, (int)y, a, (int)aw-8, lValue1, lValue2);
InfoText(2, _T("Up/down compass"), a+PIF, ox, oy);
const float lLiftThrottle = mGame.GetLauncher().GetPhysics().GetEngine(0).GetValue();
const float lCenteredValue = (mGame.GetComputerIndex() == 0)? lValue1*2-1 : -(lValue1*2-1);
const int lLiftOffset = (int)((BARREL_COMPASS_HEIGHT-4)*lCenteredValue/2 + 9*lLiftThrottle);
DrawTapIndicator(3, 22, lLiftOffset, a+PIF/2);

and even more

#ifdef LEPRA_TOUCH_LOOKANDFEEL
#ifdef LEPRA_TOUCH
  ... [20 lines]
#endif // Touch
  ... [100 lines]
#endif // Touch LnF

But still. 5k ugly lines is perfect, as it's only going to be maintained, but never built upon or reused.

I'm in technical RC, by the way - YEY! :)

About the author

Mitt foto
Gothenburg, Sweden