Atlas Format

From FIFE development wiki
Jump to: navigation, search
wiki
Document Data structures Data strucures
Concepts illustrated here are relevant to understand what kind of data FIFE engine is able to process.

Introduction

The purpose of this page is to explain the FIFE XML atlas format in full, with all the elements and their attributes fleshed out.

Atlas File Structure

All atlas files begin with the object header: <?fife type="atlas"?>. The header is followed by the atlas description which is contained within the <atlas></atlas> tags. Each image entry in the atlas section describes a single sub-image contained within the atlas file. The atlas section is followed by 1 or more object descriptions each contained within their own <object></object> tags. Currently only static objects (i.e. without any actions) are supported with this format. Refer to the atlas and object sections below for a more detailed description.

Here is an example definition of an atlas file:

Example

<?fife type="atlas"?>
<atlas name="rpg_tiles.png" namespace="rpg_tileset" width="576" height="576">
  <image source="tile_00_00.png" xpos="0" ypos="0" width="48" height="48"/>
  <image source="tile_00_01.png" xpos="48" ypos="0" width="48" height="48"/>
  <image source="tile_00_02.png" xpos="96" ypos="0" width="48" height="48"/>
  <image source="tile_00_03.png" xpos="144" ypos="0" width="48" height="48"/>
  <image source="tile_00_04.png" xpos="192" ypos="0" width="48" height="48"/>
  <image source="tile_00_05.png" xpos="240" ypos="0" width="48" height="48"/>
  <image source="tile_00_06.png" xpos="288" ypos="0" width="48" height="48"/>
  <image source="tile_00_07.png" xpos="336" ypos="0" width="48" height="48"/>
  <image source="tile_00_08.png" xpos="384" ypos="0" width="48" height="48"/>
  <image source="tile_00_09.png" xpos="432" ypos="0" width="48" height="48"/>
  <image source="tile_00_10.png" xpos="480" ypos="0" width="48" height="48"/>
  <image source="tile_00_11.png" xpos="528" ypos="0" width="48" height="48"/>
  <image source="tile_01_00.png" xpos="0" ypos="48" width="48" height="48"/>
  <image source="tile_01_01.png" xpos="48" ypos="48" width="48" height="48"/>
  <image source="tile_01_02.png" xpos="96" ypos="48" width="48" height="48"/>
  <image source="tile_01_03.png" xpos="144" ypos="48" width="48" height="48"/>
  <image source="tile_01_04.png" xpos="192" ypos="48" width="48" height="48"/>
  <image source="tile_01_05.png" xpos="240" ypos="48" width="48" height="48"/>
  <image source="tile_01_06.png" xpos="288" ypos="48" width="48" height="48"/>
  <image source="tile_01_07.png" xpos="336" ypos="48" width="48" height="48"/>
  <image source="tile_01_08.png" xpos="384" ypos="48" width="48" height="48"/>
  <image source="tile_01_09.png" xpos="432" ypos="48" width="48" height="48"/>
  <image source="tile_01_10.png" xpos="480" ypos="48" width="48" height="48"/>
  <image source="tile_01_11.png" xpos="528" ypos="48" width="48" height="48"/>
</atlas>
<object id="brick" namespace="rpg_tileset" blocking="0" static="1">
  <image source="tile_02_04.png" direction="0"/>
</object>
<object id="gbcorner" namespace="rpg_tileset" blocking="0" static="1">
  <image source="tile_00_00.png" direction="0"/>
  <image source="tile_02_00.png" direction="90"/>
  <image source="tile_02_02.png" direction="180"/>
  <image source="tile_00_02.png" direction="270"/>
</object>
<object id="gbside" namespace="rpg_tileset" blocking="0" static="1">
  <image source="tile_00_01.png" direction="0"/>
  <image source="tile_01_00.png" direction="90"/>
  <image source="tile_02_01.png" direction="180"/>
  <image source="tile_01_02.png" direction="270"/>
</object>

atlas

  • attributes
    • name: Location of the atlas image in the filesystem. Type = string
    • namespace: Namespace of the atlas and all of its sub-images. Type = string. Required
    • width: Total width of the atlas image. Type = int. Required
    • height: Total height of the atlas image. Type = int. Required
      • image: See image section

image

  • attributes
    • source: Name of the sub-image. Doesn't need to be pointing to existing image. Type = string. Required
    • xpos: X offset of the sub-image calculated from the top-left corner of the atlas image. Type = int. Required
    • ypos: Y offset of the sub-image calculated from the top-left corner of the atlas image. Type = int. Required
    • width: Width of the sub-image. Type = int. Required
    • height: Height the sub-image. Type = int. Required

object

  • attributes
    • id: The identifier for this object. Type = string
    • parent: Identifier of the parent object. Type = string. Optional.
    • namespace : Namespace of the object. Type = string. Must be the same as the namespace specified in the atlas section. Required.
    • blocking: Defines if object blocks the movement. Type = bool (0/1). Optional, default = 0
    • static: Defines if object does not move. Used to optimize pathfinding. Type = bool (0/1). Optional, default = 0
    • pather: Defines which path finder object should used. If none defined, uses engine default. Type = string. Optional
      • Currently supported pathers = "LinearPather" and "RoutePather"
  • image
    • source: Name of the image from the atlas definition. Type = string
    • direction: Direction where this image is pointing to (i.e. facing direction if there is such). Type = int
    • x_offset: X offset for image. Type = int, Optional
    • y_offset: Y offset for image. Type = int, Optional