This is a set of slides from the Claremont Report on Database Research, see http://db.cs.berkeley.edu/claremont/ for more details. These particular slides are from a "Research Directions" talk by "Johannes Gehrke." (Uploaded for discussion at the Stanford InfoBlog, http://infoblog.stanford.edu/.)
Nell’iperspazio con Rocket: il Framework Web di Rust!
Declarative Domain Languages for Games
1. Domain-Specific
Declarative Languages
Johannes Gehrke
Cornell University
(Currently on sabbatical at
FAST, A Microsoft Subsidiary)
http://www.cs.cornell.edu/johannes
DB Summit, 5/29/2008
2. Declarative Domain-Specific Languages
Declarative
Nice algebraic properties for ease of
reasoning ...
for the user / query writer
for system designer / implementer
(Note that the language could look
imperative.)
Domain-specific
Language should be appropriate for domain
Can’t have “one size fits all”
DB Summit, 5/29/2008
3. Computer Games
Unique challenges
Virtual environments
High degree of
interactivity
$17B in sales in 2007
Rivals movie industry
DB Summit, 5/29/2008
4. Data-Driven Game Design
Game design brings together many disciplines
Art, music, computer science, etc...
Today’s games are designed data-driven
Game content is separated from game code
Examples:
Art and music are kept in separate, industry-standard
file formats
Character data is kept in XML
Character behavior is specified through scripts
DB Summit, 5/29/2008
5. Advantages of Data-Driven Design
Engine is reusable.
Able to recoup R&D costs over several games.
Possible to license engine to other companies.
Can extend the life span of the game
Adjust game balance
Players can change the character of the game
Modder communities develop around the game.
Half-life Counter Strike
(Air Force uses modded StarCraft in officer training.)
DB Summit, 5/29/2008
6. Modding: Simulation Games
Non-Player Characters (NPCs): Characters
not directly controlled by the player.
Controlled either by built-in or by
player-designed scripts.
“Doll House” games (e.g., The Sims)
NPCs have needs and desires.
Objects can satisfy needs and desires.
Player controls the game via object placement.
Real-Time Strategy games
Troops move and fight in real time.
Player controls the game via a limited number of commands.
Player multitasks between large number of units.
DB Summit, 5/29/2008
7. Simulation Games: NPCs
Games need complex NPC behavior.
Example:
Units are afraid of skeletons
Likelihood of staying inverse proportional to number of skeletons
around
Simple example: morale 3 units
Units afraid of skeletons
Morale proportional to 2 units
number of skeletons seen
Processing cost:
1 unit
O(n) to count skeletons
O(n2) to process all units Time per tick
DB Summit, 5/29/2008
8. Expressiveness vs. Performance
Expressiveness:
the range of behavior
scriptable by modders
As # of NPCs increases,
expressiveness decreases
Neverwinter Nights 2
Each NPC fully scriptable
WarCraft III
Script armies, not NPCs
Little NPC coordination
Midieval: Total War
No individual scripting at all
6/8/2008 Database DB Summit, in Computer Games
Processing 5/29/2008
9. Expressiveness vs. Performance
Expressiveness:
the range of behavior
scriptable by modders
Midieval:
High
Total War
As # of NPCs increases,
Number of NPCs
expressiveness decreases WarCraft III
Neverwinter Nights 2
Each NPC fully scriptable The Sims 2
WarCraft III Neverwinter
Script armies, not NPCs Low Nights 2
Little NPC coordination
Low High
Midieval: Total War Expressiveness
No individual scripting at all
6/8/2008 Database DB Summit, in Computer Games
Processing 5/29/2008
10. Expressiveness vs. Performance
Expressiveness:
the range of behavior
scriptable by modders
Midieval:
High
Goal
Total War
As # of NPCs increases,
Number of NPCs
expressiveness decreases WarCraft III
Neverwinter Nights 2
Each NPC fully scriptable The Sims 2
WarCraft III Neverwinter
Script armies, not NPCs Low Nights 2
Little NPC coordination
Low High
Midieval: Total War Expressiveness
No individual scripting at all
6/8/2008 Database DB Summit, in Computer Games
Processing 5/29/2008
11. What We Have Done
Developed domain-specific imperative language
Game designers find SQL difficult
Cannot program at the individual level
m ain : Uni {
t
/ Co mpute # skeletons, group center
/
accu m c with su m , sx wi su m,
th
sy with su m over u f rom UNIT {
i(
f isEne mySkeleton(u) &&
d t m e,u) < r
is ( ange) {
c < 1 sx <- u sy <- u y;
- ; .x; .
}
} in {
/ I too m any skeletons
/f
i (c > morale) {
f
le (norm=(x-sx/c * -sx c)+
t ) (x /
(y-sy/c)* y-sy/c) i {
( )n
/ Run in opposi d r ion
/ te i ect
vx <-(x /c)
-sx /norm;
vy <-(y /c)
-sy /norm;
}}
..
.
DB Summit, 5/29/2008
12. What We Have Done
Developed domain-specific imperative language
Compiles down to set-at-a-time Bag Algebra
m ain : Unit {
/ Co mpute # skeletons, group center
/
accu m c wi su m, sx with sum,
th
sy with sum over u f rom U NIT {
i(
f isEne mySkeleton(u) &&
d t m e,u) < range) {
is (
c <-1; sx <-u.x; sy <- u.y;
}
} in {
/ I too many skeletons
/f
i (c > m orale) {
f
le (norm=(x-sx/c)*
t (x-sx/c)+
(y /c)* -sy )in {
-sy (y /c)
/ Run in opposi direct
/ te ion
vx <-(x /c)
-sx /norm;
vy <-(y /c)
-sy /norm;
}}
...
DB Summit, 5/29/2008
13. What We Have Done
Developed domain-specific imperative language
Compiles down to set-at-a-time Bag Algebra
Built prototype of a game engine
Integrated crowd simulations into SGL
Developed novel transactional models
for virtual worlds
Opened up many more problems
Main-memory data management
with decision-support-style
update workloads
Query optimization,
query processing, indexing
Steering
Collaborative motion planning
DB Summit, 5/29/2008
14. Recipe Applied to Other Domains
Complex Event Processing
Personalization of three-tier applications
Build full CMT in 15 minutes
Personalize the system to add double-blind
reviewing for your conference in 5 minutes
Expressive ad auctions
Submit bidding programs to Google according
to an ROI strategy
DB Summit, 5/29/2008
15. Declarative Domain-Specific Languages
Declarative
Nice algebraic properties for ease of
reasoning ...
for the user / query writer
for system designer / implementer
(Note that the language could look
imperative.)
Domain-specific
Language should be appropriate for domain
Can’t have “one size fits all”
DB Summit, 5/29/2008
16. Summary and Discussion
Declarative, domain-specific languages
There is much more:
Multi-core
Creativity
Attractor for the next
generation of students?
Gate to a new way of
enabling and understanding
creativity?
DB Summit, 5/29/2008
17. Let’s Play!
http://www.cs.cornell.edu/johannes
Thank you: National Science Foundation, Air Force Office of
Scientific Research, Microsoft, Yahoo!
DB Summit, 5/29/2008