building a sustainable energy system game aaron bloomfield 1
TRANSCRIPT
BUILDING A SUSTAINABLE ENERGY SYSTEM GAME
Aaron Bloomfield
1
INTRODUCTION
2
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Overall Goal
To allow people to understandthe concepts involved in energy
production as well as thetrade-offs involved through
the use of a fun game
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Inspiration (image from here)
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Inspiration (image from here)
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Architectural Requirements
The architecture of the game was defined by two major precepts:
1. We wanted to be able to log everything the players did for later analysis
2. We wanted to be able to make frequent changes to the various game settings
This meant that the players played a network game, where their every move required the network to make the move and determine the results
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Architecture
The game consists of four main components:
• The graphical client (Windows, Mac), which is the only parts a player sees
• The web service, which contains the methods that the client calls (such as set_game_settings(), start_game(), etc.)
• The simulation, which was written in C++ to allow for fast execution
• The web client, which allowed the game developers to quickly modify the settings
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Game Overview
After selecting the map and/or scenario, play begins.
The game is turn-based; on each turn:
• The player makes any moves s/he desires• The player clicks “end turn”, and the game
map is updated with the results• The player is notified if s/he reaches any of
the game goals• Repeat
MAKING GAMES FUN
9
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
What is Fun?
• Dictionary: A source of enjoyment, amusement, or pleasure• But that doesn’t help us design games…
• Important to consider underlying reasons• “Funativity” – thinking about fun in terms of
measurable cause and effect
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Evolutionary Roots
• We must look to our distant evolutionary past
• Young mammals play to learn basic survival skills• Games are organized play
• Human entertainment is also at its heart about learning how to survive
• Mating and social rules also critical to us• Life is all either work, rest, or fun• Fun is about practicing or learning new
survival skills in a relatively safe setting• People who didn’t enjoy that practice were
less likely to survive to become our ancestors
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Hunting and Gathering
• For most of our species’ history we were tribal hunter/gatherers
• Current popular games reflect this• Shooters, wargames = hunting• Powerups, resources = gathering• Sims, MMO = social, tribal interaction
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Natural Funativity Theory
• The basic concept of funativity is that all fun derives from practicing survival and social skills
• Key skills relate to early human context (from the previous slide), but often in a modern guise
• Three overlapping categories Physical, Social, and Mental
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Physical Fun
• Sports generally enhance our strength, stamina, coordination skills
• Exploration is fun Both of local area and knowledge of exotic
places• Hand/eye coordination and tool use are often
parts of fun activities – crafts• Dancing, sort-based, and activity-based
games• Wii sports, for example
• Physical aspect to gathering “stuff”
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Social Fun
• Storytelling is a social activity A way to learn important survival and
social lessons from others• Gossip, sharing information with friends is
popular• Flirting, showing off, finding mates is a key
interest in social fun• Language has become paramount• Sims, MMORPGs, interactions in single-player
games, team-based games
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Mental Fun
• Our large brains make humans unique• Pure abstract reasoning practice is fun• Pattern matching and generation
Music, art, and puzzles are all pattern based
• Gathering also has mental aspect, categorizing and identifying patterns
• Examples: tetris, chess, go, etc.
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Multipurpose Fun
• Many fun activities have physical, social and mental aspects in combination
• Games that mix these aspects tend to be very popular
• Incorporate ways to practice these skills to increase the popularity of games
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Definition of a Great Game
• A great game is a “series of interesting and meaningful choices made by the player in pursuit of a clear and compelling goal”
• Must have choice, or it is not interactive• Must be a series of choices or it is too simple
to be a game• Must have a goal or it is a software toy
• Some games, such as the Sim/Sims lines, the players may bring their own goals
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Interesting and Meaningful Choices | Clear and Compelling Goal
• Choices may be dull and uninteresting because it was easy to code that way• Or it may be the reflection of a lazy
designer• Meaningful choices are perceived by the
player as having significant consequences• May not have actual consequences…
• Clear goals, as it is not fun to flounder aimlessly
• Avoid the “protagonist with amnesia” cliché• Compelling goals are goals that follow the
concepts in Natural Funativity• Survival is always a compelling goal
ENERGY GAME CONCEPTS
20
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Scenarios
A scenario allows the user to have a goal in the game
• Given an existing population with power generation, “upgrade” it in some way (convert to green, eliminate one type of power, etc.)
• Given a “colony” (one square of population), guide it’s development and population growth
• Given a large population and no power, find the “best” way to power that area, given various constraints
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Commodities
A commodity is a “thing” in the game
• Fossil fuels: coal, gas, or oil• Nuclear products: uranium ore, refined
uranium, spent fuel rods• Energy: sunlight, AC power (of various
voltages), DC power• Waste products: ash, trash, • Pollution: CO2, NOx, SO2• Water: tides, water flow• Naturally occurring: O2, uranium seam, coal
seam
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Processes
A process converts one (or more) commodities into one (or more) other commodities
• Coal combustion converts oxygen and coal into heat, CO2, Nox, SO2, particulates, and ash
• Nuclear fission converts enriched uranium into spent fuel rods, electrical energy, and heat
• Steam turbine power conversion converts heat into electrical energy and (yet more) heat
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Stations
A station allows one or process to occur
• A coal mine allows for coal extraction• A coal plant with water evaporation cooling
allows for (1) coal combustion, (2) cooling via water evaporation, and (3) steam turbine power conversion
• A nuclear power plant allows for (1) nuclear fusion and (2) steam turbine power conversion
• A garbage dump allows for disposal (storage) of ash
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Sources and sinks
Some stations and processes are sources, in that they only produce a commodity. Examples: solar power collector
Other stations and processes are sinks, in that they only consume a commodity. Examples: garbage dump, uranium storage facility
Most stations convert one (or more) commodities into one (or more) other commodities
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Coal Energy Production
To generate energy via coal:
• Find a coal seam, and build a coal mine on it• This allows for conversion of the coal seam to
coal• Build a coal plant
• The coal from the coal mine, magically transported, is burned to produce energy
• The energy is magically transported to the population that needs it
• Profit!
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Magical transportation?
One of the eventual goals was to allow for commodity transportation:
• Power lines transport electrical energy• Transport lines and vehicles transport
physical commodities (coal, etc.)
The intent is to require these to be built, and their capacity can limit how much a coal plant can produce
They are not implemented yet…
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Uranium Production
To generate energy via uranium:
• Find a uranium seam; build a uranium mine there• Converts uranium seam to uranium ore
• Build a uranium refinery• Converts uranium ore to enriched uranium
• Build a nuclear power plant• Converts enriched uranium to spent fuel rods,
energy, and heat• Potentially find where to store the spent fuel
rods• Profit!
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Game flexibility
Many of the values in the game are provided to the client each time it starts up
• The list of commodities, and their prices• The list of processes, and how much they
consume and produce• The list of stations, and what processes they
allow
This allows easy changing of these values
GAME MAPS
30
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Random Maps
The goal was to allow for randomly generated maps that approximate a real world (image source)
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation
Random map generation is surprisingly hard!
And it turns out that many people want to play with known maps. Which leads us to preset maps
Preset maps allow the user to choose a known area to work in
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
An actual screenshot of the client…
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
This is a visualization of the map, not what the client shows
The different colors are the different terrains; only terrain is shown in this map
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
The map is squashed, left to right, due to the fact that this was a square map that was generated
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
Where is this?
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
Where is this?
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
Where is this?
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
Where is this?
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Complications
Random map generation is hard!
Energy production requires other map values, generating these adds additional complications.
• Wind speed• Average temperature• Average cloudiness
These are called layers in the map; a typical map will have 30 (or so) layers
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Layers
This view is meant for the game developers, not the players…
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Layers
In addition to terrain, this shows 4 more layers
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Generation: Preset Maps
This shows 8 more of the layers
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Map Layers
• Terrain• Rivers• Resources• Temperature• Precipitation• Altitude• Population• Improvements• Cloudiness• Power demand
• Power supply• Wind (direction and
speed)• Seasons
(other layers exist, but are not all that relevant right now)
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Icons
We hired a digital artist to create icons for the game
These icons are the various things you see in the map
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Maps: Tiles
Power lines, railroad tracks, and roads
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Maps: Tiles
Forests, plains, and hills
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Maps: Tiles
Mountains, rivers, lakes, other terrain types
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Maps: Tiles
Improvements and buildings
GRAPHICAL CLIENT
50
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client
The goal of the client was to allow playing on multiple platforms; currently only Mac and Windows are supported
The design was done in such a way to eventually allow for mobile based games
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client screenshot
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client screenshot
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client screenshot
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client screenshot
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client screenshot
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client screenshot
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Client screenshot
OTHER SYSTEM COMPONENTS
59
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Web service
The client is “dumb” – it doesn’t make many decisions by itself
Instead, it contacts the web service, which then records the data and makes the decisions
It’s written in Java, and runs on the Apache Tomcat server
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Sample web service methods
• registerAnonymousGame()• getRuleSet()• setGameSettings()• getMap()• startGame()
• getMap(), again• getHistory()• sendChanges()
• endTurn()• endGame()
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Simulation
The simulation runs after each turn, and is written in C++ for speed
For each run of the simulation, each station runs to capacity, which can be limited by supply as well as how much it can “burn”
After effects, such as pollution and depleted resources, are computed as well, and the map is appropriately updated
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Web client
The web client is an interface for the game maintainers to add and edit the game settings
Examples: stations, processes, vehicles, commodities, etc.
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Artificial Intelligence
The ability for a computer algorithm to play the game
This aids in testing as well as load balancing
This is a new development (this semester), and is expected to be up and running next semester
Can you beat Skynet?
CONCLUSIONS
65
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Features to be added
• Transportation routes (power lines, train tracks, etc.) and vehicles
• Government interactions• Popularity (powered citizens are happy)• More accurate layer generation• Random map generation• Ability to “store” power in some fashion
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Features we probably won’t add
Too much government interaction!
Power plant construction, especially nuclear plant construction, details with a HUGE amount of governmental red tape
Nobody likes dealing with this in the real world, so why do this in the game?
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Complications
We ran into a number of problems developing the game
• The technology chosen for the webservice was very unstable, and caused many issues
• The complication of having the game always contact the network added a lot of additional complexity
• The framework used for the client was, in hindsight, not the best choice
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Current Status
The game is almost playable; just a few bugs to work out.
Then there is a lot of game balancing to perform
There are two students working on it during the spring, so we expect to have this version working soon.
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm
Questions?
Ask away!
Credits / Acknowledgements
Some materials used in this class were developed under a National Science Foundation "Research Initiation Grant in Engineering Education" (RIGEE).
Other materials, including the "UVA Virtual Lab" science education website, were developed under even earlier NSF "Course, Curriculum and Laboratory Improvement" (CCLI) and "Nanoscience Undergraduate Education" (NUE) awards.
This set of notes was authored by John C. Bean who also created all figures not explicitly credited above.
Copyright Aaron Bloomfield (2015)
(However, permission is granted for use by individual instructors in non-profit academic institutions)
An Introduction to Sustainable Energy Systems: www.virlab.virginia.edu/Energy_class/Energy_class.htm