A Data-Driven Game Object System: Scott Bilas Gas Powered Games
A Data-Driven Game Object System: Scott Bilas Gas Powered Games
GDC 2002
Scott Bilas
Gas Powered Games
Introduction
Me
– Scott Bilas
– Background
You
– System architect types
– Tired of fighting with statically typed systems for game code
The Test Subject
– Dungeon Siege
– >7300 unique object types (i.e. can be placed in the editor)
– >100000 objects placed in our two maps
– Continuous world means anything can load at any time
Cell Phones?
Definitions
Data-Driven
– Meaning: “No engineer required”
– Engineers are slow
– Causes designers to hack around missing
functionality
– Goal: remove C/C++ from game
– Line between engine and content is always moving
Definitions (Cont.)
Game Object (Go)
– Piece of logical interactive content
– Perform tasks like rendering, path finding, path
following, speaking, animating, persisting
– Examples are trees, bushes, monsters, levers,
waypoint markers, doors, heroes, inventory items
– Many are “pure logic”, never see them (triggers,
elevator movers, camera sequences)
– Every game has these in some form
Definitions (Cont.)
Object
Asteroid
FriendFoe- HeatSeeking-
Missile Missile
EnemySpaceship
Example Class Tree
Newfangled
Object
This is a database
– (a very well understood problem)
– “The data is important, nothing else matters”
…and we’re hard coding it every time
To meet changing design needs, can’t just
data-drive the object properties, must data-
drive structure (schema) of the objects
Solution: Component System
Each component is a self-contained piece of
game logic
Assemble components into Go’s to build
complete objects
Specification for assembly driven by data
Lay out data in a C++-style specialization tree
to promote reuse and reduce memory usage
Include and enforce an external schema
Two-Part Implementation
Go
ContentDb
GoComponent
GoDataComponent
GoSkritComponent
GoDataTemplate
GoDb
Dynamic Content Layout
Go GoComponent
Component1
GoPlacement
Contains / Owns
Component2
GoBody
Component3
GoMind
GoPlacement* GoInventory
GoBody*
.
. GoSkritComponent
.
Extension: Skrit
(DS Scripting Language)
Obvious requirement:
build components out of skrit
Leave high performance components in C++
Permits extremely fast prototyping
– No rebuilds required
– Don’t even have to restart game (reload on the fly)
Schema is internal
Extension: Skrit (Cont.)
GoDataTemplate GoDataComponent
Component1 Field1
Ref-Counted Impl
Raw
Contains / Owns
Component2 Field2
Data
Component3 Field3
. .
. .
. .
FuelHandle source TableSpec* schema (shared)
GoDataTemplate* base Skrit* object (Optional)
Schema Layout (Code)
TableSpec
string name
Field1 eType type
eFlags flags
Contains / Owns
Field2 LOCALIZE
ADVANCED
Field3 QUOTED
. HIDDEN
. string defValue
. string docs
string name, docs
Compile ContentDb
Part 1: Build Schema
(Data)
specializes = base_chicken;
[aspect]
{
[textures] { 0=b_c_na_ckn_white; }
}
[common]
{
[template_triggers]
{
[*]
{
action* = call_sfx_script("feathers_flap_white");
condition* = receive_world_message("we_anim_sfx",1);
}
}
}
[physics]
{
break_effect = feathers_white;
explode_when_killed = true;
}
}
Compile ContentDb
Part 3: Compile Templates
[t:chicken_red,n:0x837FD928]
{
[placement]
{
p position = 1.3,0,1.8,0x1738FFDB;
q orientation = 0.3828,0.2384,-0.7772,0.98;
}
[common]
{
screen_name = "Super Chicken";
}
[body]
{
avg_move_velocity = 18.000000;
}
}
Loading Objects
Schema extensible
Add flags and constraints that editor can use
– Auto-detect when can use color chooser or slider or
listbox or whatever
Add defaults computed from script
Contact Info
Scott Bilas
http://scottbilas.com