I’m not too great when it comes to technical things, so for the most part, the following article from Gamasutra mostly goes right over my head. But I did take note that GlassBox (the engine for SimCity 5) was built for future Maxis simulations…and Andrew Willmott namedropped that it could one day be used for future versions of SimTower and SimCopter. Of course – this isn’t promised – just ideas on what they could roll with. I for one hope Maxis sticks with GlassBox and decides to update all of their great games.
As for The Sims – it uses an entirely separate game engine, and even though nothing in the article mentions any word on The Sims franchise, I highly doubt it’ll be used for The Sims 4.
The meat of a Glassbox-powered game is split into four object types: Resources, Units, Maps and Globals. These are tied together by Rules that are dictated by game scripts.
Resources are the basic currency in the game: oil, coal, crops, wood, water, electricity, etc. Resources come in bins: resource R has a capacity of C.
Units represent things in the game, such as houses, factories, and people. Each unit has a state, which is a collection of resource bins.
As an example, a house may have 20/30 units of food in its bin, and 4/10 people. A gas pump would only have bins of petrol, and a petrol station would have both petrol and cars.
Maps represent depletable resources in an environment: coal, oil, forest, but also air pollution, land value, desirability, etc. As an example, a map may have oil underground, that is being sucked out by a pump into its own local bin.
Globals are just a set of resource bins. For example: the amount of money in a town, the amount of electricity being used.
Rules provide the verbs in a game to handle the nouns provided by the above. Rules operate on resources: they move them from one place to another, or possibly combine them into other resources. They have inputs and outputs.
This simple code example shows money being converted into wood if a person is available to make that transaction:rule harvestWood
Money in 10
Wood out 2
People in 1People out 1
Here is an example of a unit rule, showing a chaining effect: as a sim consumes mustard, they create an empty bottle, which then adds to a city’s pollution. If mustard is unavailable, they then go buy more mustard.unitRule mustardFactory
rate 10global Simoleans in 1
local YellowMustard in 6
local EmptyBottle in 1
local BottleOfMustard out 1
map Pollution out 5
successEvent effect smokePuff
successEvent audio chugAndSlurp
Map rules are simpler than that. In this example, grass will grow only where there’s soil, water and nutrients, which are all depletable resources:mapRule growGrass
rate 200map Soil atLeast 20
map water in 10
map Nutrients in 1
map Grass out 5
Zones are well-defined areas, and a staple to Maxis games. Here’s another code example, with a housing zone developing houses at a rate of 3 a day if there are enough builders available, and only where allowed:zoneRule developHouses
timeTrigger Day 0.5sample random -count 3
test global Builders greater 5
test map Forest is 0
createUnit -id Bungalows
Agents are mobile things: they carry resources from one unit to another. They do not run rules — Maxis says they want 10,000+ agents running around at once, so they keep them simple to allow that. Agents can be people, cars, or even units of water running through a pipe. Here’s a code example of a car driving two people to work on roads:unitRule goToWork
options -sendTo Work -via Car -using Roadlocal People in 2
agent People out 2
Each agent is given a destination: people may go home or to work, firemen may go to a fire, pollution may go into people.