Pages

Friday, March 23, 2012

New SimCity Engine

     A couple days ago I wrote a blog entry about a simulation game that I had written to learn SDL and improve my C++ programming skills. I showed this project off at the game developers club and it reminded them about the new SimCity game that was just announced. The game was announced at a recent game developers conference where they also explained a bit about their new simulation engine called GlassBox. The algorithm that the engine uses has a particularly elegant design which I find very interesting.

     The system defines five basic object types: resources, units, maps, globals and agents. Resources are variables such as people, money, electricity. They are organized into bins that can store a limited amount of a resource. Units are physical objects in the world like houses. They are defined as a collection of resource bins. Maps are used to represent the distribution of resources across the environment. They are essentially an array of resource bins with one associated to each map tile. Globals are like units, since they are a set of resource bins, but do not represent physical objects. Lastly, are these things called agents that move around the environment distributing resources between resource bins. Game developers represent these different types of objects using rules which they define in scripts. [1]

    Game developers are able to simulate various natural phenomenon using these simple constructs (as can be seen in this video). For example, a map can be used to represent resources like underground minerals or areas covered by forests. Agents are used to represent the distribution of electricity, pollution or the movement of cars and pedestrians. According to the article the company that makes SimCity believes this engine could be applied to their other simulation games like, one of my favorites, SimTower. [1]

     Although this design seems very elegant I feel that there many some potential problems which have been left out. One aspect that may pose a problem is that there may be tens of thousands of independent agents running in parallel at any given time. Well this seems beneficial in the era of multi-core computing, managing these agents and ensuring mutual exclusion is non-trivial. Another thing to consider is if so few constructs can accurately represent everything needed in a simulation game with over simplifying some aspects.

     I believe that this engine was very elegantly designed. This level of elegance is what I often strive for in my own programs which is why I appreciate how difficult it is to achieve. To create such an elegant engine, software developers often need to iterate and rewrite the program, each time removing unnecessary or redundant features.

     I would very much like to try and implement a similar engine one day and this engine it was interesting to read about. Game development companies are often very secretive so when they reveal this kind of information it is very valuable.

References:
[1] Frank Cifaldi. "GDC 2012: Breaking down SimCity's Glassbox engine" Internet: http://www.gamasutra.com/view/news/164870/gdc_2012_breaking_down_simcitys_.php, March 7, 2012 [March 21, 2012].

No comments:

Post a Comment