-
Notifications
You must be signed in to change notification settings - Fork 154
Data structure and serialization
Most definitions are saved in XML files in a common structure : `
<[definition type] id="[definition id]">
<[field1] value="..."/>
<[field2].../>
...
</[definition type]>
`
Here is the list of actual definition type :
- Unit
- Weapon
- Turret
- Projectile
- Mover
- Effect
- Actor
- MapStyle
- CliffShape
- NaturalFace
- ManmadeFace
- Trinket
Any definition can be written in any XML file, in any order, and during runtime. The XML files are checked every seconds, and the resulting library updated. For example, if the definition of a unit is changed, the existing units of this type won't be modified, but all unit created from this time will be at the latest version.
For each definition , a builder is created. There is one builder class for each definition type, and on builder instance for each definition id. For example, if there is a unit definition for a tank and another for a buggy, there will be two UnitBuilder instances. Each builder is able to create an object from only one definition.
Builders are stored in a the BuilderLibrary, a unique object stored by the model, and updated when needed. When you need to create something, you need a builder, and when you need a builder, you ask to the lib.