EngoEngine/engo

TMX resources cannot handle tile sets that leave a rest at end of rows

jan-xyz opened this issue · 2 comments

I build this map with Tiled and imported into the adventure demo and somehow it mixes up some of the assets. It looks fine in the editor. Do you have any advice, or could this be a bug?

In-Game render:
Screenshot 2021-08-02 at 02 13 07
Tiled Map Editor:
Screenshot 2021-08-02 at 02 13 20

Those are the assets I tried out: https://opengameart.org/content/whispers-of-avalon-grassland-tileset

I debugged this a bit on my side, and it seems to be related to the size of the image. The tiles are supposed to be 32x32 but the entire image is not divisible by 32 and it seems like the engine doesn't properly scale the tiles accordingly. Does that make sense? When I resize the image to a multiple of 32 then it looks better although the proportions are a bit skewed and there are gaps (e.g. left side of stairs).
Screenshot 2021-08-02 at 03 39 06

I was now able to get a workaround it by cropping the tile set. I looked closer at how Tiled handles it and they do the cropping automatically, should Engo do it as well? Attached are the view of the tileset in Tiled and the original PNG with a 32x32 grid on top of it(see how there are incomplete tiles on the bottom and right). I now cropped the image and that fixed it, but maybe we can improve the TMX handling here a bit and mimic how Tiled is doing it. If you point me in the direction then I can file a PR for it.
Screenshot 2021-08-02 at 13 14 23
Cliff_tileset_checked

In-game render with the cropped tileset:
Screenshot 2021-08-02 at 16 05 47