(Not to work-work; I can’t go back to that until I’m cleared by my doctor and I’ve no idea when that might happen. I mean Planitia-work.)
One of the things I want to get done (and get done quickly) is to create a playable alpha version of Planitia, as well as create a trailer. That will make my funding and marketing push more effective.
“But Anthony!” I hear you say. “You already have a playable alpha! I remember you posting it on your blog! With source code, even! Here, even!”
This is true. But that version has a terrible bug in it that I just cannot seem to track down – after about ninety seconds of play, the frame rate instantly drops from 60 to 30 and then descends from there. All my attempts at profiling have met with failure.
Basically, I fought code entropy and code entropy won. I’m pretty sure that my framework, which I’ve been using for years, has some rather terrible bug in it and the code is just too overgrown to track it down. Of course, that was the first game framework I ever wrote, so of course it was krep. Before you say anything, It’s not just Planitia that is making me think this, there are parts of Inaria that bog down as well. Both of these games are so damn simple that they should run at about a thousand frames a second on a TI-99/4A, for crying out loud.
I talked to my friend Jari Komppa about this (who was recently called a god of the indie demo scene, by the way) and he had this advice:
“Code like it’s 1999.”
I also stole his base code, which you can find on his site here.
So how were we coding in 1999? Well, procedurally, for one thing. OOP hadn’t really penetrated game development yet. Game engines were usually just collections of functions rather than interlocking game objects. Classes were rare, and inheritance non-existent. Very much KISS territory (the design/programming philosophy, not the metal band that saved Santa).
Jari’s code is just like that. There are no classes. There is no inheritance. There’s just a bunch of functions – all in one source file, even – that do practically anything you might want to do in a 2D game, and lot of the stuff you’d want to do in a 3D one.
So I started over. While I do sort my functions into different source files, they’re now standalone functions rather than class methods. I added code I needed from my own framework (configuration file reading, logging, industrial-grade RNG, etc) but I only made objects out of things that there can be multiple instances of, like fonts and game objects.
This took me about eight hours worth of work. I now have a framework that’s just as functional as my current one but with (let me count) about 1/4 the lines of code.
I’m actually kind of eager to see how quickly I can recreate the gameplay of Planitia using the new engine. It could turn out to be a mere 40-hour project.
Updates to follow.
Wow, a major code rework. I’m reworking my parser generator too. I agree with keeping it simple, but for some reason I usually end up doing the opposite.