Game Development Reference
In-Depth Information
having virtual functions, object-oriented data has virtual fields. When deriving one
piece of data from another, you start with an identical copy of that data. Then,
modifications made to the child object are overlays on top of the existing data. If
a field has not been “overloaded,” then it keeps the same value as a parent.
This overloading concept is vital for reusability. In many cases, different pieces
of data are only slightly different, but they must be tweaked and modified. By
inheriting most information from parent data, tweaking shared concepts is easy.
Any change made to the parent data automatically cascades to all derived data.
This can be thought of as design-time instancing. At runtime, instancing an asset
can be used to optimize the runtime, and using data inheritance can save the time
of content creators by allowing them to reuse their work.
14.2.1 Example
Traditionally, when creating data for a role-playing game, a designer may have cre-
ated the following four types of goblins:
<object name="Goblin"
HitPoints="50"
Model="goblin.model"
Color="Green"
Allegiance="Enemy"
Weapon="Axe"
Weakness="Red"/>
<object name="Blue Goblin"
HitPoints="50"
Model="goblin.model"
Color="Blue"
Allegiance="Enemy"
Weapon="Axe"
Weakness="Red"/>
<object name="Red Goblin"
HitPoints="50"
Model="goblin.model"
Color="Red"
Allegiance="Enemy"
Weapon="Axe"
Weakness="Blue"/>
<object name="Red Goblin King"
HitPoints="100"
Model="goblinking.model"
Color="Red"
Allegiance="Enemy"
Weapon="Axe"
Weakness="Blue"/>
Each entity, or game object, may have been copied and pasted or created
from scratch, but after the data have been created, each entity is completely
unique. The first issue here is when looking at the data, it is hard to tell ex-
Search WWH ::




Custom Search