This project is read-only.

GDIdotNETgames XML Format

Apr 23, 2008 at 11:27 AM
Edited May 4, 2008 at 6:38 PM
For those who wish to edit the XML file and do not want to tackle figuring out the serialization code.

Here is the body of the current file.
<Game Title="Funny Little Guys">
  <Animation FPS="10" />
  <Map Width="1800" Height="1200">
    <Image Filename="Content/se_free_grass_texture.jpg" />
  </Map>
  <Sprite Name="test" Width="32" Height="32" X="16" Y="23">
    <Rotation>30</Rotation>
    <Image Filename="Content/amg1.png">
      <TransparentColor R="255" G="0" B="255" />
      <Frames>2</Frames>
    </Image>
  </Sprite>
  <Sprite Name="test2" Width="32" Height="32" X="24" Y="33">
    <Image Filename="Content/amg1.png">
      <TransparentColor R="255" G="0" B="255" />
      <Frames>2</Frames>
    </Image>
  </Sprite>
</Game>
Anything that is a node attribute is required for that type of node. The root Game node and child Map node are required and unique.

There is a required root node Game with a required Title attribute.
There is a single child node Animation, which is optional but if present the attribute FPS is required and is the animation frames per second. If the Animation node is not present there will be no animation even if the Sprites are set up for it. Not sure what happens with duplicate Animation nodes - let's just say it is not supported.

There is a single required child node Map with required Width and Height attributes. Multiple Map nodes are not supported.
Within the Map node there is an Image node, which is optional but if present the atribute Filename is required and is the name of the image file which will be displayed as the map (the file must exist under the application install directory or there will be an exception thrown).

There may be any number of Sprite child nodes (well... zero would be pointless and at some point system resources will make a large number unfeasible).
Any Sprite nodes are required to have Name, Width, Height, X and Y attributes.
Sprite nodes may have an optional Rotation child node with the rotation as a float in degrees.

Sprite nodes may have an optional Image child node like the Map (with required filename etc) but for a Sprite the Image node may optionally have child nodes for TransparentColor and Frames.
TransparentColor, if present, requires attributes R, G and B which set the RGB values of the background for the Sprite to make a transparent Sprite. If this node is missing then the Sprite will be opaque - and I believe this is the case even if the original image file has alpha transparency.
Frames, if present, indicates the number of animation frames in the image file and if the Animation node was present under the Game then the Sprite will Animate. If the Frames node is missing within a Sprite then that Sprite will not animate even if the Animation node is present.

All numeric values except rotation are non-negative integer values.

Although you can save and open these XML "save game" files anywhere on your computer, the application root directory is used as the starting path for the image filenames. See the "Help->About" dialog for the location of this hidden system folder.

Map images are re-scaled, when the save game is opened, to the map size. Sprite images are not re-scaled and frames within a Sprite image should match the size of the Sprite. Animation frames should go left-to-right within the image file.