Jul 27 2010

AndEngine – TiledMaps in the TMX format

Category: AndEngine,AndEngineExamplesNicolas Gramlich @ 12:16

Hello Community,

I finally found the time to upload the following video, that is showing the support for TiledMaps, a grid of small tiles making something bigger than the sum of its parts. ;)

The format I chose (better to say ‘I was made aware of’ :P ) is the TMX format. TMX is a XML based format, that is mainly human readable but still has very small file-sizes. The biggest plus of the TMX format is that it has a fully featured and easy to use cross-platform Map-Editor called “Tiled”, which can be obtained for free here: http://www.mapeditor.org/.

Example-Code:

TMXTiledMapExample

So now go and make some amazing RPGs !!! :P

Best Regards,
Nicolas

9 Responses to “AndEngine – TiledMaps in the TMX format”

  1. Timothy Lee Russell says:

    That is sweet.

    The one issue that I noticed is that on my Droid, as the background scrolls, there is black banding line (maybe one pixel wide) between each horizontal edge of the tile when scrolling vertically and a black banding line between each vertical edge when scrolling horizontally.

    For example, when scrolling horizontally I get this (where the pipe character is a solid black line going across the entire screen between each strip of tiles):

    |tile|tile|tile|

    and when scrolling vertically
    ____
    tile
    ____
    tile
    ____

    It seems sporadic — maybe it is displaying the black lines about 30 or 40 percent of the time.

    I am using the latest hg pull as of 7/27/2010.

    Anyway, thought I would let you know.

    You’re doing some amazing work! Thanks!

    • Nicolas Gramlich says:

      Hi Timothy,

      thanks, this has been reported on the Droid X also.
      The reason is that it somehow interpolates the texture (which has black lines in between each tile) differently.
      Not impossible to fix but might take some days, as I don’t have a device where it happens =P

      Best Regards,
      Nicolas

  2. Timothy Lee Russell says:

    Nicolas,

    Yes, it’s really tricky to fix stuff you can’t reproduce…you’re kind of flying blind.

    I’ll be glad to do testing for you!

    Timothy

  3. Timothy Lee Russell says:

    That works perfectly — nice!

    One issue for you to be aware of –

    It looks like you tested it in the tileset “desert.tmx” with a file called “fixed_desert_tiled.png” but actually modified “desert_tiled.png”?

    So, as is, the project throws an exception when trying to load “fixed_desert_tiled.png” which isn’t in the repository.

    Anyway, I switched it to point to “desert_tiled.png” and it worked…

    http://code.google.com/p/andengineexamples/source/detail?r=d8f9b3b732

    Thanks!
    Timothy

  4. Nicolas Gramlich says:

    Argh … that one last change before committing :D

    Thanks :)

  5. Cesar says:

    Problem solved in Droid/Milestone too.
    Great Job

  6. spierce7 says:

    This still seems to be happening on the Droid X. Happens ~ 10% of the time.

Leave a Reply