XML Definitions

This document describes the format of the definition XML files used in the FFilmation Engine. Definition files contain media references, material definitions and object definitions.

  • Media references are paths to resources that need to be loaded to work with the definitions in this file.
  • Object definitions provide common info for types of objects, such as graphic resources they use and size. You can instantiate multiple instances of these definitions in your scenes.
  • Material definitions are used in walls and floors.

There is no limit on the amount of definitions you can have in a single XML, but it is a good practice to group similar elements in a single file, such as trees.xml, stonewalls.xml or furniture.xml. Let’s see a sample file:

<definitions>

    <media src="media/western_gfx.swf"/>

    <materialDefinition name="Ground" type="tile">
       <diffuse>Ground</diffuse>
       <bump>Ground_bump</bump>
       <classname></classname>
    </materialDefinition>

    <objectDefinition name="Poncho">

      <displayModel>
        <sprite angle="0" src="Poncho0" shadowsrc="Poncho0"/>
        <sprite angle="45" src="Poncho45" shadowsrc="Poncho45"/>
        <sprite angle="90" src="Poncho90" shadowsrc="Poncho90"/>
        <sprite angle="135" src="Poncho135" shadowsrc="Poncho135"/>
        <sprite angle="180" src="Poncho180" shadowsrc="Poncho180"/>
        <sprite angle="225" src="Poncho225" shadowsrc="Poncho225"/>
        <sprite angle="270" src="Poncho270" shadowsrc="Poncho270"/>
        <sprite angle="315" src="Poncho315" shadowsrc="Poncho315"/>
      </displayModel>

      <collisionModel>
         <cilinder radius="30" height="130">
      </collisionModel>

      <shadowModel>
         <shadow type="sprite"/>
      </shadowModel>

   </objectDefinition>

</definitions>

These are the Tags and their attributes:

The MEDIA tag

The media tag is used to identify external swfs that contain the graphical resources referenced in the definitions. This swf will be loaded on demand when the scene requests the media on them. Multiple MEDIA tags are allowed.

The MATERIALDEFINITION tag

The materialdefinition tag is used to define materials.

Use this page for updated information on the available materials and their XML format.

For each material, a class is instantiated. This class will receive a copy of the entire XML node. Therefore, if you write custom materials you can add extra parameters to it and the custom class will be able to use them.

The OBJECTDEFINITION tag

This tag defines an object. And object is defined by a display model, a collision model and a shadow model. Attributes for this tag are:

  • name: Used when instanstiating objects to refer to this definition

The display model is formed of one of more sprites, each associated to an angle. When the object is oriented ( from 0 to 360 degress ) the engine will show the sprite than represents an angle closest to the desired one. Attributes for the sprite tag are:

  • angle: which angle represents this sprite
  • src: library symbol for this sprite

Currently 2 collision models are supported: the cilinder collision model and the box collision model.

Attributes for the cilinder collision model

  • radius: The radius in pixels of an imaginary cilinder enclosing the object. It is used for colision detection.
  • height: The height in pixels of an imaginary cilinder enclosing the object. It is used for colision detection.

Attributes for the box collision model

  • width, depth, height size along x,y and z axis of the box enclosing the object, corresponding to the sprite at 0 rotation

The shadow model only supports the Sprite type for now, but soon you will be able to use boxes and cilinders to define more accurate shadowing.