Dynamic object
From Gnoll's Wiki
Contents |
Presentation
A dynamic object is :
- an object that can be (de)serialized from a XML file
- an object that contains attributes
Gnoll is a data driven project, dynamic object are the persistence system.
Features
- Possibility to have few distinct attributes (string, float, list, etc.)
- Add Dynamic Object inside another one
- Inheritance with Dynamic Object (DO "Archer" inherit of DO "Humain" for example)
Examples
Scalar data
<dynamicobject instance="Example1">
<attribute name="age">
<integer value="345"/>
</attribute>
</dynamicobject>
<dynamicobject instance="Example2">
<attribute name="phrase">
<string value="c'etait un cafard qui vivait dans le noir"/>
</attribute>
</dynamicobject>
<dynamicobject instance="Example3">
<attribute name="pi">
<float value="3.145"/>
</attribute>
</dynamicobject>
Container data
<dynamicobject instance="Example4">
<list>
<string value="elem1"/>
<string value="elem2"/>
<string value="elem3"/>
<string value="elem4"/>
</list>
</dynamicobject>
Full example
Extract from nortNorthPage
<dynamicobject instance="nortNorthPage">
<attribute name="PageRenderer">
<CMeshPageRenderer meshName="page.mesh"/>
</attribute>
<attribute name="eastLink">
<string value="eastPage"/>
</attribute>
<attribute name="size">
<float value="256"/>
</attribute>
<attribute name="southLink">
<string value="northPage"/>
</attribute>
<attribute name="staticObjects">
<list>
<cstaticgobject instance="poo">
<attribute name="mesh">
<string value="ninja.mesh"/>
</attribute>
<attribute name="pos_x">
<float value="-30"/>
</attribute>
<attribute name="pos_y">
<float value="0"/>
</attribute>
<attribute name="pos_z">
<float value="-30"/>
</attribute>
</cstaticgobject>
<cstaticgobject instance="paa">
<attribute name="mesh">
<string value="ninja.mesh"/>
</attribute>
<attribute name="pos_x">
<float value="30"/>
</attribute>
<attribute name="pos_y">
<float value="0"/>
</attribute>
<attribute name="pos_z">
<float value="30"/>
</attribute>
</cstaticgobject>
</list>
</attribute>
</dynamicobject>
