Architecture:Map Object Format: Difference between revisions

From Adonthell
Jump to navigation Jump to search
Line 30: Line 30:
== Parameters of a Map Object ==
== Parameters of a Map Object ==


A [[Architecture:Map Module#Map Objects and Shapes|Map Object]] has two components: the <tt>model</tt> part contains the 'physical' properties of the object, while the <tt>sprite</tt> part contains its graphical representation.  
A [[Architecture:Map Module#Map Objects and Shapes|Map Object]] has two components: the <tt>model</tt> part contains the 'physical' properties of the object, while the <tt>sprite</tt> part contains its graphical representation, a [[Architecture:Gfx Module#Sprites|Sprite]].


The <tt>model</tt> is composed of one or more states that correspond to separate animations in the <tt>sprite</tt>. Associated with each state is a <tt>shape</tt>, which is composed of one or more <tt>cube</tt>s. These are defined by the position of their 8 corner points (in pixels). These positions are given relative to the bottom left corner of the corresponding animation.  
The <tt>model</tt> is composed of one or more states that correspond to separate animations in the <tt>sprite</tt>. Associated with each state is a <tt>shape</tt>, which is composed of one or more <tt>cube</tt>s. These are defined by the position of their 8 corner points (in pixels). These positions are given relative to the bottom left corner of the corresponding animation.  

Revision as of 14:42, 18 March 2008

Example Map Object Model

The following XML structure describes a simple Map Object that has been serialized.

 <?xml version="1.0"?>
 
   <list id="model">
     <string id="state">default</string>
     <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, 0]</string>
           <string id="p3d">[40, 0, 0]</string>
           <string id="p3d">[40, 40, 0]</string>
           <string id="p3d">[0, 40, 0]</string>
         </list>
       </list>
     </list>
   </list>
   <string id="sprite">data/gfx/map/ground/outside/grass/grass-ground.xml</string>
 

It is a flat ground tile of size 40x40 and zero height.

Parameters of a Map Object

A Map Object has two components: the model part contains the 'physical' properties of the object, while the sprite part contains its graphical representation, a Sprite.

The model is composed of one or more states that correspond to separate animations in the sprite. Associated with each state is a shape, which is composed of one or more cubes. These are defined by the position of their 8 corner points (in pixels). These positions are given relative to the bottom left corner of the corresponding animation.

All cubes 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.