Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The exception in loading .tmx files #359

Open
DLDarren opened this issue Aug 8, 2023 · 5 comments
Open

The exception in loading .tmx files #359

DLDarren opened this issue Aug 8, 2023 · 5 comments

Comments

@DLDarren
Copy link

DLDarren commented Aug 8, 2023

I met a problem when I was using cocos to load a .tmx file.
Cocos doesn't seem to be cutting the tile set correctly when loading the tiles.
It looks like these in cocos:
image
image
While the same places in Tiled:
image
image
these are the tiles in the tile set picture:
image
image
I'm using cocos0.6.10 and Tiled 1.9.1
here's the map:
<?xml version="1.0" encoding="UTF-8"?> <map version="1.9" tiledversion="1.9.1" orientation="orthogonal" renderorder="right-down" width="100" height="100" tilewidth="20" tileheight="20" infinite="0" nextlayerid="7" nextobjectid="1"> <tileset firstgid="1" name="tile_setting" tilewidth="20" tileheight="20" tilecount="3240" columns="72"> <image source="material/tile_setting.png" width="1458" height="907"/> </tileset> <layer id="1" name="BackGround" width="100" height="100"> <data encoding="base64" compression="zlib"> eJzt2jEOgzAMBVDoRu9/4O4otEE02MFveBuRjL8wJGJdlmUFAAAAmNwrQQ0AAAAwkr0vQJv5CIz0PhBdVzXfei+XmCx6rouutYLePntG7sniTI/NrjxZ7NdG1/80V3oqD3k82dV3gDz+n0fkeuSRmXmVz9m9hDOt+3P5JbpWAKgk278EW0N0TZXt+y+T2CzkkUdrVsmC2WT7BgAAAOLZJwAAAIxl3wUAAADAEWdHAAAAAP2qn6VUv38AAABgHh9sPSm1 </data> </layer> <layer id="6" name="Magma" width="100" height="100"> <data encoding="base64" compression="zlib"> eJzt1UkKwCAQRUHB3P/M2WQlxAk7CqmCfwEfjSkBAAAAAAAAAAAAAAAAAAAAAAAAAAAA/Ft+xj55YMQaaaFLrNkWmsSovfVVTJN4PR1aTVirt4f7+I4/5DxanEkLAAAAAAAAAAAAAAAA4M0N/74Bmw== </data> </layer> <layer id="2" name="CollideGround" width="100" height="100"> <data encoding="base64" compression="zlib"> eJzt1rEVwjAQREGpFIObM7gZMM1hXIy3ACVOhIKZ935y4UVbCgCM65XeaUufjnfavmlPv3R0vNM21VJu6Z7m2u9O25IfPdIzrbXfHeAq+2os9tVY7Kux2FcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD80wn35k9h </data> </layer> <objectgroup id="3" name="Objects"/> <layer id="4" name="Cloud" width="100" height="100"> <data encoding="base64" compression="zlib"> eJzt28kJACAMBEDb8+i/Hm1BUNQ4A/nvbyEhKQH8LY8pp0MAAAAAcB17I+BXdUw7HYKw9CsAAAAA3MluGAAAAAAAmOG2AAB76VoAAAAAAAAAAAAAAIjj5T+Bl7MDAAAAAACs1AH33QVE </data> </layer> <layer id="5" name="Water" width="100" height="100"> <data encoding="base64" compression="zlib"> eJzt1zsOgCAURUEa1P2v2EYTQ/g1PihmkrsBT0RJCQAAAAAAAAAAAAD2dxRjjbKDLuu8z/xsTI9YMz00idHrUGuiy39a70V+5uyKVeuRi+kRp3dW6RFr9A33rxVLj/3MNnE3jDW6m2sAAAB912espwcAAAAAAAAAAAAAAAAAAAAAAAAAADu7AcP+A7o= </data> </layer> </map>
I have used different maps created with the same version of Tiled, but all of them didn't look well in cocos.
However, I succeed when I used a map which was edited in Tiled1.2.5 downloaded on the internet.
I guess the problem might be that cocos has some problem with the latest Tiled edition.

@ccanepa
Copy link
Contributor

ccanepa commented Aug 13, 2023

Can you modify the example in tests\test_tmx.py to use your map?
If it shows the same problem, can you upload a zip with all files used, including code, map, tileset's image?

Also, which pyglet version and which GPU are you using?

@ccanepa
Copy link
Contributor

ccanepa commented Aug 13, 2023

Also, from https://doc.mapeditor.org/en/stable/reference/tmx-changelog/ , Tiled 1.9 did some changes that were partially reverted in Tiled 1.10 for compatibility with Tiled < 1.9

Maybe load the problematic map in Tiled 1.8 to see if it show right?

@DLDarren
Copy link
Author

Sorry for response so late. I'm using pyglet1.5.27. My GPU is GeForce MX250. I can't find Tiled < 1.9 because it just provide the latest version of Tiled.

@ccanepa
Copy link
Contributor

ccanepa commented Aug 18, 2023

all releases: https://github.com/mapeditor/tiled/releases

@DLDarren
Copy link
Author

The map loaded in Tiled1.8.6 properly. I loaded the map in test\test_tmx.py to use my map. It looks good at first. However, it began to have black lines around the tiles when I started to move and cocos began to invoke set_focus().
when haven't move:
image
when have moved:
image
Also, I recognized that when I use an image source which is 1458 * 907 pixels, it has the problem like the original problem:
image
but the problem changed when I used the image source 120 * 120 pixels:
image
I just changed the picture's size and didn't changed any tiles or the tiledmap.
Here's the screen shot of the map after ctrl+W.
image
In addition, My system is Windows10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants