Friday, 17 February 2012

Game coding is easy but...

From the perspective of someone who spent most of the last few decades as a graphics coder, worrying about cycle counts, cache misses and API overheads it always seemed to me that game coding was the easy bit. At this point I should pin down exactly what I mean when I say 'game coding' as other people will draw the dividing lines in a project in different places. I draw them like this:
  • System stuff
  • Graphic Engine
  • UI
  • Stuff from elsewhere
  • Gameplay
Those are in order of how much time i've spent on each. 'Stuff from elsewhere' is any middleware, library, code from your previous game.

Arguably 'Graphic Engine' is part of 'System stuff' or 'stuff from elsewhere' but for me at least, it's been a significant part of everything I've ever worked on. Similarly, if you have your shit together 'UI' should be pretty much data driven through code cut and paste from the last game, it never seems to work out that way for me though and I find myself writing a new system from scratch yet again.

'Gameplay' is the most important part but it also seem like me to be the easiest. From my perspective it
always seems to be the guys writing the game that get to sit around leafing through books on coding style, casually using slow-but-powerful features of C++ or maybe insisting they have to use STL, often not worrying about optimisation. Just making the core of THE GAME.

The problem is, when you are programming a game on your own it doesn't seem to work like that. It's difficult to find the time to focus on gameplay when there is so much other code to distract you. My previous iOS game Ground Effect for example probably had about a week of solid gameplay coding in the whole project.

Topia has rather more than a few weeks of gameplay coding but when the is still tedious 'system stuff' and a few tweaks to the 'graphic engine' it sometimes feels like an indulgence to be working on the fun parts like the minds of the creatures or tweaking exactly what it fels like when you stroke the landscape into interesting shapes or direct a herd. Even fixing bugs that cause things like this to happen is kind of fun.

In an ideal world I'd be able to focus on the gameplay (plus maybe those graphic engine tweaks) for the rest of the project and have someone else do the boring bits. Oh well, at least i've been able to spend the last few weeks on what I call 'gameplay', i'll be doing the same with the next few, as long as I don't get distracted by something else. Like maybe making the A5 shader even cooler or putting in those clouds that Josh keeps asking for... Oh dear...


  1. This is why Dwarf Fortress is written with ascii output ... it keeps those temptations in check :)

  2. One of the hardest parts for me is staying focused on one area of code at a time. I could be writing a gameplay feature then suddenly decide I need to add something to the graphics engine to support it. So I'll instantly switch over to writing graphics code. I'm sure it's a productivity killer but when you have to write everything it's difficult to seperate yourself from the code as a whole.