Changes between Version 1 and Version 2 of Entity


Ignore:
Timestamp:
Jun 27, 2012, 6:33:14 AM (12 years ago)
Author:
historic_bruno
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Entity

    v1 v2  
    11An "entity" in 0 A.D.'s terminology is the internal representation of a game object. It could be a unit, structure, tree, or even a decorative [wiki:Actors actor] like a clump of grass. A map contains a number of these entities which describe the world as the players perceive it. They are also created during the game when a player trains a new unit or constructs a building, they are similarly destroyed when a unit or structure is destroyed. For an entity to be visible in the game, it must have a [wiki:Actors visual actor] associated with it.
     2
     3Entities can be viewed in-game or for testing purposes, using Atlas' [wiki:Atlas_Manual_Object_Tab#TheActorViewer actor viewer] in entity mode.
    24
    35For more information on how entities fit into the game's architecture, see SimulationArchitecture.
     
    57== Entity templates ==
    68
    7 Many but not all entities are defined by entity ''templates'', located in `simulation\entities\` (see [wiki:Mod_Layout#templates mod layout]). An entity template is an XML data file which defines how the entity behaves, how it appears, its internal state, and how other entities may interact with it. This data is associated with [wiki:TDD_Simulation simulation] components (see [http://svn.wildfiregames.com/entity-docs/ this page] for component examples).
     9Many but not all entities are defined by entity ''templates'', located in `simulation\templates\` (see [wiki:Mod_Layout#templates mod layout]). An entity template is an XML data file which defines how the entity behaves, how it appears, its internal state, and how other entities may interact with it. This data is associated with [wiki:TDD_Simulation simulation] components (see [http://svn.wildfiregames.com/entity-docs/ this page] for component examples).
    810
    911Entity templates use inheritance, which allows different types of units to inherit common attributes from a parent. For example, a Roman Veles inherits from a common "ranged infantry javelinist" template, which inherits from a common "ranged infantry" template, and so on. This inheritance helps prevent duplication of the same data in numerous places.
    1012
     13Certain decorative actors like grass clumps have no entity template associated with them, as they don't interact with the game world. However the engine still constructs an entity for them with only minimal properties. See our [wiki:PMP_File_Format#ScenarioXMLformat map data format] for more information.
     14
    1115== Modifying entities ==
    1216
    13 Entities can be viewed in-game or for testing purposes, using Atlas' [wiki:Atlas_Manual_Object_Tab#TheActorViewer actor viewer] in entity mode. Currently there is no special editor for entity templates (as there is for actors), so it's best to use a decent text editor like Notepad++ on Windows.
     17Currently there is no special editor for entity templates (as there is for actors), so it's best to use a decent text editor like Notepad++ on Windows.
    1418
    1519== Entity XML format ==
     
    5458It can be seen that this template inherits from "template_unit" (and all of its parents, too).
    5559
    56 Entity templates must comply with the [http://relaxng.org/ schema] or they won't validate, causing an error when trying to use the entity in-game or Atlas. Each component adds to the schema those elements which it allows to be specified in the template, as documented [http://svn.wildfiregames.com/entity-docs/ here].. An element may be required or optional, it may have attributes or not; and its data may be restricted in type, limited to a set of predefined choices, or it may allow arbitrary text. Typical reasons for a template not validating include: leaving out required elements, adding elements that don't exist, misspellings, or using an incorrect data type (a decimal or negative number in a field that requires a positive integer).
     60Entity templates must comply with the [http://relaxng.org/ schema] or they won't validate, causing an error when trying to use the entity in-game or Atlas. Each component adds to the schema those elements which it allows to be specified in the template, as documented [http://svn.wildfiregames.com/entity-docs/ here].. An element may be required or optional, it may have attributes or not; and its data may be restricted in type, limited to a set of predefined choices, or it may allow arbitrary text.
     61
     62Typical reasons for a template not validating include:
     63 * leaving out required elements
     64 * adding elements that don't exist in the schema
     65 * misspellings
     66 * using an incorrect data type, like a decimal or negative number in a field that requires a positive integer
     67Inheritance must be kept in mind here, not every template will explicitly reference every property for a given component. For example a unit might only alter the melee crush value of its parent's `Attack`, not the whole `Attack` element.