GAME JOBS
Latest Blogs
spacer View All     Post     RSS spacer
 
June 6, 2013
 
Tenets of Videodreams, Part 3: Musicality
 
Post Mortem: Minecraft Oakland
 
Free to Play: A Call for Games Lacking Challenge [1]
 
Cracking the Touchscreen Code [2]
 
10 Business Law and Tax Law Steps to Improve the Chance of Crowdfunding Success
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
June 6, 2013
 
Gameloft
Java Developers
 
Off Base Productions
Web Application Developer
 
KingsIsle Entertainment, Inc.
Concept Artist
 
Red Storm Entertainment, a Ubisoft Studio
Assistant/Associate Producer
 
Wargaming.net
Build Engineer
 
Gameloft - New York
Programmer
spacer
Latest Press Releases
spacer View All     RSS spacer
 
June 6, 2013
 
LittleBigPlanet PS Vita
developer Tarsier
Studios...
 
Havok™ Announces
Support of Xbox One
with...
 
EXATO GAME STUDIOS
ANNOUNCES LAUNCH DATE FOR
VOXEL...
 
E3 2013: Castlevania:
Lords of Shadow 2
trailer...
 
MAJESCO ENTERTAINMENT
INVITES YOU TO CHECK OUT
ITS...
spacer
About
spacer Editor-In-Chief:
Kris Graft
Blog Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Mike Rose, Kris Ligman
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
Education:
Gillian Crowley
 
Contact Gamasutra
 
Report a Problem
 
Submit News
 
Comment Guidelines
 
Blogging Guidelines
Sponsor

 
GDC 2012: Breaking down  SimCity 's Glassbox engine
GDC 2012: Breaking down SimCity's Glassbox engine
 

March 7, 2012   |   By Frank Cifaldi

Comments 3 comments

More: Console/PC, GDC, Design, Programming





"You should be surprised by how simple this is, and frankly skeptical of how you can build a SimCity game out of this," joked Glassbox system designer Andrew Willmott at GDC on Wednesday.

Willmott broke down how the Glassbox engine works on a basic level. Glassbox was built with all future Maxis-made simulations in mind (classics SimTower and SimCopter were namedropped as possible directions to go, though these are obviously not announced products), though for now it's being utilized just for the upcoming SimCity revival.

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

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

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

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

Globals are just a set of resource bins. For example: the amount of money in a town, the amount of electricity being used.

Rules

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 1

People out 1
end
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 10

global 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

onFail buyMoreMustard
end
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 200

map Soil atLeast 20

map water in 10
map Nutrients in 1

map Grass out 5
end
Zones

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.5

sample random -count 3

test global Builders greater 5
test map Forest is 0

createUnit -id Bungalows
end

Agents

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 Road

local People in 2
agent People out 2
end


Each agent is given a destination: people may go home or to work, firemen may go to a fire, pollution may go into people.
 
 
Top Stories

image
Microsoft's official stance on used games for Xbox One
image
Microsoft: Xbox One users must have broadband, check in online
image
Microsoft: You'll have control over privacy with Xbox One Kinect
image
Keeping the simulation dream alive


   
 
Comments

Alex Leighton
profile image
This all sounds pretty awesome.

Aaron Styles
profile image
rule produceSoylentGreen
People in 1

Food out 1
end

Ish Said
profile image
Very interesting and great insight.


none
 
Comment:
 




 
UBM Tech