Dren Skywalker
Dren Skywalker

Reputation: 129

Slick FAIL TO PARSE TILEMAP

I encountered another problem while learning to work with slick library.

I created a simple little map with 5x5 blocks with size 50x50 pixel. I tried everything but I still get the same error.

Here my class:

public class PlayState extends BasicGameState{

    int stateID = -1;

    private TiledMap map;


    public PlayState(int stateID){
        this.stateID = stateID;
    }

    @Override
    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
    map = new TiledMap("src/resources/map.tmx","src/resources");
    }

    @Override
    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
        map.render(0, 0);
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sbg, int arg2) throws SlickException {

    }

    @Override
    public int getID() {
        return stateID;
    }

}

and here my error:

Tue Jul 30 13:34:09 CEST 2013 INFO:Slick Build #237
Tue Jul 30 13:34:09 CEST 2013 INFO:LWJGL Version: 2.9.0
Tue Jul 30 13:34:09 CEST 2013 INFO:OriginalDisplayMode: 1600 x 900 x 32 @60Hz
Tue Jul 30 13:34:09 CEST 2013 INFO:TargetDisplayMode: 1280 x 720 x 0 @0Hz
Tue Jul 30 13:34:09 CEST 2013 INFO:Starting display 1280x720
Tue Jul 30 13:34:09 CEST 2013 INFO:Use Java PNG Loader = true
Tue Jul 30 13:34:09 CEST 2013 INFO:Controllers not available
Tue Jul 30 13:34:09 CEST 2013 WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the data
java.io.IOException: Transparent color not support in custom PNG Decoder
    at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:78)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:187)
    at org.newdawn.slick.Image.<init>(Image.java:192)
    at org.newdawn.slick.tiled.TileSet.<init>(TileSet.java:124)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:661)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:122)
    at main.states.PlayState.init(PlayState.java:23)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at main.Main.main(Main.java:40)
Tue Jul 30 13:34:09 CEST 2013 ERROR:Unsupport tiled map type: base64,zlib (only gzip base64 supported)
org.newdawn.slick.SlickException: Unsupport tiled map type: base64,zlib (only gzip base64 supported)
    at org.newdawn.slick.tiled.Layer.<init>(Layer.java:133)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:676)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:122)
    at main.states.PlayState.init(PlayState.java:23)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at main.Main.main(Main.java:40)
Tue Jul 30 13:34:09 CEST 2013 ERROR:Failed to parse tilemap
org.newdawn.slick.SlickException: Failed to parse tilemap
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:695)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:122)
    at main.states.PlayState.init(PlayState.java:23)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at main.Main.main(Main.java:40)
Caused by: org.newdawn.slick.SlickException: Unsupport tiled map type: base64,zlib (only gzip base64 supported)
    at org.newdawn.slick.tiled.Layer.<init>(Layer.java:133)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:676)
    ... 6 more

Upvotes: 0

Views: 2224

Answers (1)

Rob Vitaro
Rob Vitaro

Reputation: 31

I just got this error myself - and solved it. You need to make sure your map properties layer format is set to Base64 (gzip compressed). Looks like that's the format slick expects.

As far as the PNG warnings, apparently slick doesn't like interlaced PNG files, so save as a non-interlaced image

Upvotes: 1

Related Questions