3

When I recently tried to load a basic map I made in Tiled I get the exception: Unsupported encoding (XML) for TMX Layer Data

I looked at the tutorial from badlogicgames website and did the same thing

private TiledMap map;

public void create() {      
     map = new TmxMapLoader().load("data/jf2.tmx");
} 

Here I have put my jf2.tmx file in the assets folder. I then moved all the images files to the same directory. So basically...what am I doing wrong?

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
Johan
  • 231
  • 4
  • 14
  • 1
    Are you using the nightly builds or v0.9.8 (or some other version)? The mapping API is very different in the nightly builds. – P.T. Apr 12 '13 at 17:46
  • I'm using the nightly builds – Johan Apr 12 '13 at 18:16
  • This looks relevant: https://github.com/libgdx/libgdx/pull/338 I'm not sure what sort of "encodings" the Tiled editor supports, but it looks like this format isn't supported? (I'm not familiar with Tiled or the libgdx map APIs, but remember seeing this diff go by ...) – P.T. Apr 12 '13 at 20:53
  • Do you got a `bitmaplayer`? This is not supported yet! Else it should work. (Doing the same at my project) You sure did not export the map? – bemeyer Apr 13 '13 at 11:42
  • No i dont have a bitmaplayer. So far i only have that code displayed above. Could you please give me a small code example of how you did it? Thank you – Johan Apr 13 '13 at 17:07

1 Answers1

3

Currently LibGDX (the TmxMapLoader) can't load a map where the data is encode in XML (this is default). You need to set the "Tile Layer Format" in Tiled to csv, base64, gzip or zlib. These are implemented in the current nightly build. You can set the "Layer Format" directly after opening the map in Tiled under Properties.

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106