Monday, 21 June 2010

2. Simulating people - how do we simulate individuals in our game universe?

In an ideal world, individual people would be directly simulated as objects with individual goals, opinions, etc. Unfortunately, this is not technically feasible with current technologies because of limitations with memory, processor power, etc. The mechanism will instead adopt a semi-coarse approach, where people are simulated as individual units, but with a sense of shared properties.

The simulation will therefore manage individuals by allocating each of them a unique number, which can be “owned” by various systems within the simulation. So a building will own the IDs of its occupants, the vehicle they use to get to work will hold that ID while they occupy that vehicle, and so forth. In this way, an individual person can be tracked as they go home, are at work, shopping, etc. for the cost of around four bytes per person[1].

This would be a positive influence in terms of the ability of front-end users to engage with the simulation, but does not of itself make the simulation particularly interesting. In real-life, people have a relatively diverse range of opinions but can normally be categorised into discrete groupings. The differing but combined views of these groups determine residential demand within the city. The formula for demand will be determined by the engine, and will not be subject to alteration in the initial version of the engine. Whilst not yet finalised, the formula will have the form:

D = w1t + w2c + ....

Where t and c are simulation calculated or specified values such as crime rates, tax rates, etc. The wx values are weights that determine how strongly each simulation variable contributes to the demand score. Each social grouping will have different values for these weights, which can be specified by external developers via a script file. It will also be assumed that these weights represent an “average” for the group, and that in reality, individuals will have differing views – this will be represented by a second variable associated with each weight, which is the spread or standard deviation. When it comes to individual views, therefore, we can simulate them by using a random number based on a Gaussian distribution with a mean of wx and standard deviation sx.

All that then remains is how to allocate new individuals to the different social groups, which will be done using a built-in algorithm, overrideable by a script if desired. Although not implemented in the first version of the engine, the code will be written to accommodate the possibility of later implementing two features:

  • Movement of individuals between social groups over time
  • Evolution of new social groups as a society develops

All of these features will allow realistic simulation of city-wide demand, i.e. demand to come to a particular city in the first place, and also of local demand, i.e. where individuals want to live within the city.

So, to summarise:

  • Individuals are not isolated objects with possession of their own distinct views, but represent an individual sample of the consciousness of a social group to which they belong.
  • The definition of the group determines the demand weights in the demand equation for an individual, which guides residential ownership/development within the game world.
  • Very little scripting will be used to drive individual behaviour due to the processor demands of updating the individual state. Instead, the code will be built into the engine, with the social groups and the associated variables specified externally by other developers as desired and loaded at run-time

The concept of demand probably seems isolated at the moment, because we have defined nothing in our world that is demanded. Stick with me - it's coming!

Comments, etc. appreciated. This was a tricky balancing act for me and I'm particularly keen on feedback.

Fred


[1] This will impose a simulation limit of 4.3 billion individuals, although for the foreseeable future, memory consumption is likely to be the limiting factor!

No comments:

Post a Comment