Once upon a time, the idea of using some kind of middleware or major external library in my projects was out of the question. Writing all my code was the one and true way! I had a bad case of NIH syndrome.
Over the years I’ve mellowed out quite a bit. Now I recognize my obsession with writing endless tools and technology was more of an escape from doing the really hard part of game development. In comparison to making all the decisions involved in the design and implementation of the game itself, writing the perfect resource streaming system sounds like a really good time. It’s amazing how early it started too: I still remember spending weeks writing a Basic-to-assembly translator in 1986, before I had even heard the word “compiler”.
Now I just want to make games.
I’ll gladly use code other people have written as long as they fit my needs. For example, I’m very happy with Box2d in Casey’s Contraptions. Was Box2d perfect? Far from it, but it was good enough and I’m very happy with the tradeoff.
In the land of AAA console games, developers routinely pull off the performance card: Only our code will allow us to make something that is so tailored to the hardware that it will make the game stand out above all other games. But for Casey’s Contraptions that’s not much of an issue: Any of the middleware options would be able to handle that amount of performance on an iPad just fine.
It wasn’t a lack of features either. We’re not doing anything particularly fancy, and I’m sure it would be possible to implement it in almost any other framework.
So if it’s not performance of features, why not?
Creating a game is a craft. It’s a mix of art and technique, and the craftsman or artisan has a vision and slowly probes, guides, and implements the final product. As with most crafts, the tools you use are extremely important and will directly affect the final product. If I’m going to change my tools and my techniques, the payoff I get needs to be huge to make up for the change. It’s as if I give up a set of hand woodworking tools for a power tool. Maybe it will be faster when I’m cutting in a straight line, but it will be very different and will completely change what I create.
As a game developer, my main tool is the language I use (C with a dash of C++). Things like editors or IDEs are secondary, and I can easily adapt to different ones without much of a problem (like when going from Visual Studio to Xcode). The way I like to work involves fast iterations, unit tests, very explicit memory layout, and processing data at a global, rather than local (entity) level.
I feel that by going to Unity or Cocos2d, I would have to completely give that up. A lot of middleware are frameworks instead of toolkits. That means I’m restricted to implementing bits of code that are embedded in a larger system and called by the rest of the framework. I give up the ability to architect the game in the way I want. Maybe it wouldn’t be a big deal if I liked a component or inheritance-based, entity-centered approach like a lot of frameworks, but I don’t.
Will I get enough benefits from using one of those frameworks to make up for the loss of productivity and techniques I like to use? Doubtful. All of a sudden I can’t just use fwrite on a memory block for serialization, I have to parse data files to load game state, undo/redo isn’t as simple as copying a block of memory, rendering becomes much more generic and less tied to the game, I can’t easily do test-driven development, iterate quickly, etc.
Sometimes, shifting workflows and techniques is inevitable. You may be used to solving collisions in a particular way, but when you move to a full physics engine, you need to process things differently. The payoff you get from using a pre-made physics engine is huge, so it’s worth it in my book.
For 2D games, there isn’t that much that I need: cross-platform support, simple math functions, ways to load textures, play sounds, and render simple things. Throw in some kind of simple UI display and layout tool, and that’s it. The rest I can handle. Actually, that’s not true, let me rephrase that: The rest I prefer to do myself, because it’s always highly dependent on the game.
What I really want is a toolkit-based middleware that does exactly those things without imposing any workflow or architecture on me. It saves me from doing the boring bits, gets out of the way as much as possible, and lets me work the way I want to. That’s already what I have with my current code, minus the UI library/tool part, which I’m still stuck using mostly UIKit. The idea of using Unity just so I can have cross-platform UI seems total overkill.
Even in the case of middleware that fits my style, I still need to be weary of the quality of the code. The last thing I want to do is trade time implementing my own code for time debugging someone else’s crappy code. Also, having learned my lesson years ago, I’ve sworn that I will never use a middleware/library that I don’t have source code access to. Nothing more frustrating than having to reverse-engineer UIKit classes to work around their bugs just because I don’t have the source code.
I’m not even going to go in the debate about middleware lock-in, future portability, building tech vs. relying on it, and financial aspects. All those are important, but secondary to how using some middleware will affect my everyday development.
If my next game were a networked, 3D game involving moving some kind of character or vehicle around a world, and I had nothing to start from, then the pain of adopting a foreign workflow and architecture might be worth it. Might. Even though it might be a wash on the code side, the tools and pipeline might be the thing that sways me over to adopt it.
In the end, as an indie developer, I chose to make games because it’s something I enjoy doing. I get up every morning excited about it, and I enjoy the development process. Whichever platform, tool, middleware or process I end up choosing, it needs to be enjoyable. The day I’m not having fun making my own games, I shouldn’t be an indie anymore.
What do you think? Am I being overly paranoid? Is there a good solution out there that’s multiplatform and will double my productivity once I get used to it? Has anyone written their own code for a 2D game and later switched to Cocos2d/Unity and liked it?