Don’t Fear The God Object

I’m still not convinced in the rightness of the thou shalt have no single GameObject school of thought. Having the objects present an uniform interface towards all objects present in the game world decouples many object-handling tasks from the internal representation of the object, the two chief examples being the editor and the script interface. We had to add very little code to the editor, for example, when we added new, different types of objects - grass, particle systems and terrain decals - for them the entire sets of operations such as move/scale/rotate, undo/redo, edit properties and save/load to file worked automagically just because they were simply GameObjects. We really have three classes of GameObjects - very lightweight, simple and numerous (think grass), lightweight-dumb-static (think trees and rocks) and full-blown (think units and buildings) - but 90% of the engine code and 99% of the game code doesn’t know the distinction between them. (And we use normal Lua objects, not game-engine living-in-the-world GameObjects for abstract gameplay entities like the economy simulation of the city, so that would count maybe as a fourth one.) So far the system seems to work OK, with significant advantages in code simplicity and memory footprint compared to the previous two systems we used. Two years ago we built a game around a single type of GameObjects, even for abstract gameplay entities, and there was an invisible “economy” object placed somewhere on the map. And seven years ago we had a full-blown OOP-textbook-madness, seven layers deep hierarchy of GameObjects, complete with a mess of virtual functions and semi-complete implementations jumping back and forth between the layers of the inheritance tree.

5 Responses to “Don’t Fear The God Object”

  1. look4awhile Says:

    class someClass : editable;
    class someOtherClass : scripted;
    class someThirdClass : editable, scripted;

  2. paul smith uk Says:

    back and forth between the layers of the inheritance tree.

  3. abercrombie and fitch Says:

    I am not attracted by the title of such landlord, nor is confused by the content of the post. I do not rob the sofa, nor is it to soy sauce. I am not cheering for the landlord cry, nor is landlord to contain attacks. I just struggle to silence every 30 posts.

  4. tiffany jewellery Says:

    Tiffany is about the world’s most renowned designers of first-rate offerings.Dissimilar to other vogue companies,tiffany necklaces deal firmly in products for instance jewelry,designer watches,glass wares,lamps,bags,plus more.

  5. Calvin Klein Boxes Says:

    I like the blog very much, and Calvin Klein Boxes information of the Michael Kors Outlet Online help me much for my life. thank you for your help

Leave a Reply