Architecture:Map Object Format

From Adonthell
Jump to navigation Jump to search

Example Map Object Model

The following XML structure describes a simple Map Object that has been serialized. Usually you will not see or edit this structure, as the Modeller tool will take care of that.

 <?xml version="1.0"?>
 
   <list id="model">
     <list id="default">
       <list id="shape">
         <u_int16 id="num">1</u_int16>
         <list id="cube">
           <string id="p3d">[0, 0, 0]</string>
           <string id="p3d">[40, 0, 0]</string>
           <string id="p3d">[40, 40, 0]</string>
           <string id="p3d">[0, 40, 0]</string>
           <string id="p3d">[0, 0, 5]</string>
           <string id="p3d">[40, 0, 5]</string>
           <string id="p3d">[40, 40, 5]</string>
           <string id="p3d">[0, 40, 5]</string>
         </list>
       </list>
     </list>
     <string id="sprite">data/gfx/map/ground/outside/grass/grass-ground.xml</string>
   </list>
 

It is a flat ground tile of size 40x40 and height of 5 (tiles with no height are not allowed, as that would break collision detection).

Parameters of a Map Object

A Map Object has two components: the model part contains the 'physical' properties of the object (its extend in world space), while the sprite part contains its graphical representation (i.e. its looks). One placeable can consist of multiple models, each with its own sprite.

The model part of an entity is composed of one or more states that correspond to separate animations in the associated sprite. Each state is represented by a shape, which in turn is composed of one or more cubes. These are defined by the position of their 8 corner points (in pixels), relative to the bottom left corner of the corresponding animation.

All cubes of all entities together, placed inside a bounding box, define the length (extension along the x axis), width (extension along the y axis) and height (extension along the z axis) of the map object.