Archive for April, 2008
A frustrating feature of previous game engines we’d used was that they tended to overload hierarchy to mean multiple things.
The engine that we used at Cyan, for example, was a pure scene graph. Every part of the game was represented by one or more nodes in a hierarchy. But the hierarchy represented logical relationships in some places and kinematic relationships in others. Throughout the graph, ownership was conflated with update order: children would be deleted when their parents were deleted and parents always updated before their children. Kinematic attachment was performed by pruning and grafting trees in the graph, which had the effect of tying the lifetimes of attached objects to the lifetimes of their parents.
In every game engine that I worked on before Despair, I spent a lot of time tracking down memory leaks. Some leaks were obvious and easy to find. Some leaks involved complex patterns of ownership that thoroughly obscured what object was supposed to be responsible for deleting another. And some leaks involved AddRef/Release mismatches that would create cycles of ownership or that would leak whole object hierarchies.
I’ve been working for a little more than three years on the Despair Engine, the game engine that Day 1 is using in Fracture and another, as-yet-unannounced, title. In the beginning, there were two of us working on the technology, me and my longtime friend and collaborator Adrian Stone. Now we’ve got thirty programmers working in the same codebase. Fracture’s getting close to shipping. This seems like a good time to look back at the principles that shaped our initial architecture and at the decisions whose consequences we’re living with today.
The name started as a joke. Adrian and I were out to lunch with our lead one day. Somebody made a crack about naming the engine “Despair.” One thing led to another, and by the end of the meal we’d plotted out a whole suite of despair-themed content creation tools, most of which never got made. It was 2004. We were starting from scratch on core technology for big-budget AAA games running on consoles that didn’t even exist yet. We figured that “Despair” would work one way or the other, either as an imperative to our competitors if we succeeded or as a sadly accurate description of our own feelings if we failed.