Support Android game engine - Andengine

Jun 5, 2012 at 10:48 PM

Hi All,

I think this is a great open-source map editor made with XNA Game Studio.

Where can i get the code example of parsing Tide map format and rendering Tide map ?

Do we have any map format documentation anywhere?

I'd like to port this as Android AndEngine extension.

Jun 6, 2012 at 10:41 AM
Edited Jun 6, 2012 at 10:54 AM

The tIDE XML format is fairly simple to process.

It consists of a Map tag at the root level, containing the tags Description, TileSheets, Layers and Properties.

The Description tag just contains a top level narrative text in CDATA encoded format.

The TileSheets tag is a container of Tilesheet definitions - you can correlate the attributes and child tags of each TileSheet with the editor's UI.

The Layers tag is a container of Layer tags. Each Layer tag contains descriptive tags, size attributes, and a TileArray child tag containing the tile placement information. This in turn consists of Row tags (for example, a 20 x 10 layer would be represented by 10 Row tags). Each Row tag consists of an arbitrary sequence of TileSheet, Static, Animated and Null tags. The TileSheet tag within a Row is a stateful operation that changes the current tile sheet. Thus the very first Row of a layer will typically start off with a TileSheet reference (as no TileSheet would otherwise be set initially). The Null tag represents a horizontal span of null tiles specified by a Count attribute. A Static tag represents a tile by tile index (with respect to the currently selected tilesheet) and also defines a blend mode (Additive or Alpha blending). An Animated tag defines an animated tile in terms of a list of static tiles and frame interval. 

Custom properties can be defined at Map, TileSheet, Layer and Tile level via a Properties child tag in the respective parent tag. The Properties tag is mandatory but can be empty.

Note that other formats are also supported, namely Mappy, Tiled and the Flixel comma-based formats. The latter in particular is very easy to process but is limited to one layer.

Here's a simplified sample of a tIDE map file (it doesn't contain animation tags but you can experiment with the editor and see the results yourself):


<?xml version="1.0" encoding="utf-8"?>
<Map Id="Level Map 01">
  <Description><![CDATA[This is the first level.]]></Description>
    <TileSheet Id="Background01">
      <Alignment SheetSize="2 x 3" TileSize="320 x 240" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
more tilesheets go here...
    <Layer Id="Background01" Visible="True">
      <Dimensions LayerSize="4 x 3" TileSize="320 x 240" />
          <TileSheet Ref="Background01" />
          <Static Index="4" BlendMode="Alpha" />
          <Static Index="4" BlendMode="Alpha" />
          <Static Index="4" BlendMode="Alpha" />
          <Static Index="4" BlendMode="Alpha" />
          <Null Count="4" />
more rows go here...
      <Properties />
	more layers go here...
    <Property Key="@TileBrush@Tile Brush 2@" Type="String"><![CDATA[Foreground|0,0,TileSheet01,108|1,0,,4|2,0,,5|3,0,,107|1,1,,2|2,1,,3|1,2,,2|2,2,,3]]></Property>
more properties go here

Jun 6, 2012 at 11:18 PM

Hi Colinvella,

Which part of code  we used to transform Tide Map into TMX Tiled Map?

I decided to export Animated Tile data into TMX map format with a tile propertie like the following:

<?xml version="1.0" encoding="UTF-8"?>

<map version="1.0" orientation="orthogonal" width="10" height="10" tilewidth="32" tileheight="32">

 <tileset firstgid="1" name="TileA2" tilewidth="32" tileheight="32">

  <image source="../TileA2.png" width="512" height="384"/>

<tile id="177">


<property name="AnimatedTile" value="1,2,3,4,5,6,7,8"/>

<property name="AnimatedDelay" value="250,250,250,250,250,250,250,250"/>

</properties> </tile> </tileset>

<layer name="Tile Layer 1" width="10" height="10">

<data encoding="base64" compression="zlib"> eJxjYBgYIAjEQkh4CxSjA2xqsKkjB2xCwoMFAAD03AYY </data> </layer> </map>


In this approach, the TMX file is still compatible with the other TMX Tiled Map editor.

I will add Animated Tile's frame index and delay into extra properties in TMX Tiled Map format.

Next, I will just need to create TMXAnimatedTile class in android AndEngine and give it ability to render Animated Tile correctly.




Jun 6, 2012 at 11:29 PM
Hi Kevin,

If you already have loading code for Tiled TMX files, then I suppose your approach makes sense. On the other hand, if you still need to implement the loading code, you may as well implement a tIDE format loader which has animations built into its specification.


Jun 11, 2012 at 5:15 AM
Edited Jun 11, 2012 at 5:17 AM

Hi Colin,

I need to know what is required to commit the SVN change I made for the map editor or I just email you the files I changed?


This is what I changed:

I've changed the code in AnimatedTile class constructor to add a Custom Property called "TMXAnimationIndeces" with a list of frame indexes.

I also created a function called PrepareTileSetProperties() at Store() in TiledTmxFormat.cs.

this function loops through all layers and tiles and finds animated tiles.

When an animated tile is found, I created a custom Property with the following name:

string PropertyKey = "@Tile@" + at.BaseFrameTMXTileIndex + "@TMXAnimationIndeces";

I made a property called BaseFrameTMXTileIndex.

It gives us the first Frame Index from animated frames. TileIndex is not used because this property doesn't give us a static index.

we will ignore the property value with the same key again.

I assigned this created property to t.TileSheet.Properties, and I let TMX format saving function to do the rest of its own job to save TMX file.

I tested the code, loaded the saved TMX File with Tiled Map Editor
Version 0.8.0, and it is working now.