Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I created a Tiled Map using the Tiled Map Editor. In the Editor it looks like this:

Desired State

In my java program it looks like this:

Actual State

My java code is:

public class Game extends BasicGame {

    private TiledMap map;

    public static void main(String[] args) throws SlickException {
        AppGameContainer app = new AppGameContainer(new Game());

        app.setDisplayMode(800, 600, false);
        app.setShowFPS(true);
        app.start();
    }

    public Game() {
        super("Test");
    }

    @Override
    public void render(GameContainer arg0, Graphics arg1) throws SlickException {
        map.render(300, 200);
    }

    @Override
    public void init(GameContainer arg0) throws SlickException {
        map = new TiledMap("res/unbenannt.tmx"); //path is valid!
    }

    @Override
    public void update(GameContainer gc, int arg1) throws SlickException {

    }
}

The orientation of the map is isometric. I'm working under Linux Mint, Java 6, eclipse with the latest Slick2D and LWJGL Library.

Did I forget anything? Why am I getting such a weird looking map rendering?

share|improve this question
    
Arminb, how many layers are there in your map? Also, notice how the tiles are slightly misplaced in the grid in your first image. You should probably check the tiles' size and placement in Tiled. –  Lucas Tulio Jan 17 '13 at 22:28
    
There are two layers. One layer for the ground and one for the buildings. –  arminb Jan 18 '13 at 0:06
    
Same with only 1 layer btw –  arminb Jan 18 '13 at 0:26
    
Did you check the position and size of the tiles? They seem misplaced with the grid in the first image. –  Lucas Tulio Jan 18 '13 at 0:30
    
Yes I did, I created a whole new map with only one layer and only one texture, same thing. –  arminb Jan 18 '13 at 0:31
add comment

2 Answers

I've never worked with Slick2D and LWJGL, but here's a wild guess just from the looks of the image: Each tile seems to be drawn with some kind of "Solid" or no Blending at all. That is, each tile, which is drawn as a rectangular area, overwrites all the pixels behind it with "black", which might be the tile textures "background color" becoming visible due to a rendering state that ignores their alpha values.

  • Did you happen to manually set OpenGL blend states or similar and forgot to set them back? Something along the lines of glBlendFunc maybe?
  • Is there anything else you could have done to screw up some internal rendering state?
  • Does a .tmx file contain a reference to the Tileset Image that is used and is there any kind of configuration you might want to check?
  • Does the Tileset Image require to be in a specific format in order to be interpreted correctly regarding each tile rectangles alpha values?
  • Is there some kind of "transparency color key" you need to set that will mark a specific color (such as "black") as transparent?
share|improve this answer
    
1.) No, I didn't change anything beside the default OpenGL configuration of Slick2D. The code I posted is all I did. 2.) No, as I said. I didn't change any internal setting. 3.) Yes, it contains a reference to the Tileset Image. I checked it, couln't find anything that might have caused this fault. 4.) No, the Tileset Image doesn't have any format settings. Only the Tiled Map can be stored as Base64 gzip/zlib encoded. I tried to store it in a different way without success. 5.) Yes, there is a transparency color key which I set to black and which is correctly rendered by the Map Editor. –  arminb Jan 18 '13 at 15:09
add comment
up vote 3 down vote accepted

It seems the current Slick2D release (2.8.5 on 18th of January 2013) doesn't render isometric maps correctly. In previous versions of Slick an Exception was thrown:

Only orthogonal maps supported, found: isometric

In the current version there is no such Exception. So I compiled the current development version here (change from default to development first) and now it works as desired.

How did I compile it?

I installed Mercurial and got the development version by executing hg clone https://bitbucket.org/kevglass/slick. In the Slick folder there is a build.xml file for ant. I executed ant build-slick to build the project. The resulting jar files are located in the lib folder. You will have to replace your old Slick files with these. Also you will have to replace the old natives with the new ones.

Linux Hint: I also had to unpack the natives-linux.jar manually and replace the old files (*.so) with the unpacked ones.

To save your time I will provide a whole development-build here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.