Recently I have been thinking more and more about the question: what am I really doing when I’m writing code? Sure, we have been developing iOS games since 2008 so the answer seems straightforward, but if I stop and take an honest look, the answer is pretty astonishing. Most of the time I’ve spent with coding has been spent with creating our own little ‘engines’, and then dropping in the gamecontroller classes, polishing them a bit, then release! If I could talk to my younger self, I would definitely talk him out of building engines, maybe even emphasize it with a slap or two, and here’s why.
In most of our 2D games we used OpenGL and you might know what that means:
- Creating your own framework for sprites, frames, entities, animations
- (particle systems)
- if your game is level-based, some kind of map data structure
- map editor (it would preferrably be a separate product, easy to use etc.)
What if you need some physics? Nothing fancy for sure, just some collision detections, maybe bouncing here and there… Oops another couple thousand lines? What? You’d like to have a stable physics which is not juttery, does not depend on frame rate and all that kind of small-text-details stuff you only recognize you need when you are already knee-deep in… your own physics engine code? Sure it’s almost done so lets finish it anyway! Oh, 1 month passed already? Wow!
The list could go on and on. It’s impossible to estimate properly how long writing your own engine will take if you don’t have considerable experience in it already, and do you really want to spend so much time on it? Every time you re-invent the wheel, you are wasting precious time of real game development! If it takes for you to develop a game in 4 months and during that period you were building an engine in the first 3 months, what were you really doing? Wouldn’t it have been better to learn to use existing tools in a couple of weeks and then focus on the game aspect for 3 months instead of 1? The real value is what the users will finally experience in the game, not the fancy code you have managed to create to solve mind-boggling low-level technical problems!
I have fallen into the building engine category too many times. I think too many people fall into this category. Maybe it is an engineer hubris, we take pride in our work, building something from scratch sounds great because we feel we are not depending on any middleware or already existing tool and we will be able to create the perfect little engine that our app needs. I do not believe that anymore. We are going to create limitations in our own engine no matter what and we will manage to accept those limitations happily.
Most of the devs are not supposed to be building engines but should use the existing ones and even if they would hit some limitations on the engine side (maybe this is more of just a simple fear than a real fact), it’s still quicker to find workarounds in an existing system.
So what’s my advice really?
- When problem-solving, stay as high-level as possible. When I’m talking about problem-solving, I am talking about creating prototypes. Best ones would be that would work on paper, just grab a pen and a scissor and start creating your game! If that’s not feasible, go with a language you are very comfortable with and can code very quickly!
- When you have an amazingly solid game mechanism, choose an existing tool / engine that would cover the biggest subset of your requirements
- The technology part is just 1 aspect of a game, it is not the game itself! Even if you hit a limit with a chosen engine, ask yourself the question: does this limit really affect my core gameplay? Is it crucial from a user experience point of view?
- Don’t reinvent the wheel! I’m begging you! All the energy you’ve put in your own physics / rendering / sound engine should go into gameplay balance, elegance, rewarding systems, player immersion, storyline, character design etc!
I am not saying there are no cases where writing everything from scratch is a bad idea. I am saying people usually overestimate their needs / underestimate existing tools and focus on things that are, essentially, a waste of time.
So which one are you? Are you an Engine Dev, or a Game Dev, really?