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

[Tiled] Tiles render in the wrong order. #738

Open
Uraxys opened this issue Jun 21, 2021 · 1 comment
Open

[Tiled] Tiles render in the wrong order. #738

Uraxys opened this issue Jun 21, 2021 · 1 comment
Labels
Milestone

Comments

@Uraxys
Copy link

Uraxys commented Jun 21, 2021

No idea if the title fits the issue, but I didn't come up with anything better.

The problem:
If you have a tile set that contains larger tiles than the map tiles (Example, you have a tile set containing tiles that are 32 x 16 pixels, while the map is 16 x 16 pixels), then the larger tiles might be rendered under other tiles.

It's hard to explain, so here is a picture showing the issue:
Tiled
tiledImage
Game
gameImage

I'm going to guess this is caused by the TiledMapLayerModel for the trees are being rendered before the rocks, but changing this wouldn't fix the issue (from my understanding), as rocks might be in front of trees and the other way around.

@AristurtleDev AristurtleDev added this to the v4.0.0 milestone May 20, 2024
@tigurx
Copy link
Contributor

tigurx commented Jun 20, 2024

I have not been able to nail down the exact cause of this bug yet though I am able to reproduce it on the following map:
renderOrderBug.zip

It appears this occurs when using a tileset that is larger than the tile size set on the map. In this attached sample map the tile size is 16x16. The objects that are placed on the map are 32x32.

It does appear this bug happens intermittently as we have another map where it renders in the correct render order but we have not been able to figure out why that may be. It is also a 16x16 map with the objects placed on the exact same tiles. The only difference I noticed was the defined tileset order at the top of the tmx file, but even flipping those did not correct the issue on the map where the bug is occurring.

Both the pink square and gray circle are placed on the same layer. Even with all four map Tile render methods I encounter the same issue in game (right-down / right-up / left-down / left-up). I did build the map each time in the content pipeline when switching render orders.

Rendering Correctly in TILED
Tiled_ExpectedRender

Rendering Correctly on one of my maps, though I am not sure why
InGame_RightRenderOrder

Wrong render order as seen on included map
InGame_WrongRenderOrder

I did notice a difference in TILED when I switch the Tile Render Order in Notepad++. I am wondering if possibly this is not being taken into account for some reason even though there are functions for this. When I looked up the purpose of the Render Order, it was for these Z layering issues: https://discourse.mapeditor.org/t/what-is-the-render-order-option-doing/110

Video of difference occurring in TILED when editing render order in Notepad++:
https://github.com/craftworkgames/MonoGame.Extended/assets/16768537/74ed273f-6f45-44fd-a15b-6471ba427021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

3 participants