godot icon indicating copy to clipboard operation
godot copied to clipboard

Godot 4.0 tilemaps has huge performance issues with ysorted tilemaps

Open atsd34 opened this issue 1 year ago • 1 comments

Godot version

4.0.stable

System information

Windows 10, OpenGL ES

Issue description

When I create a scene with tilemap ( in my case it is isometric) it has ok performance but after I enable y-sort which is required for isometric it has huge performance impact. This is not a big case where tilemap is small but it gets worse with tilemap size. (I think y-sort is calculated for offscreen elements on every frame :( )

Steps to reproduce

Create a isometric tilemap add big tile (In my case 400x400) enable y-sort for both layer and for tilemap. when you run game it is 1-2 fps

Minimal reproduction project

tilemap_performance_issue.zip

atsd34 avatar Mar 06 '23 10:03 atsd34

See #73813.

akien-mga avatar Mar 06 '23 10:03 akien-mga

Hello, I also have the same problem (without ysort in the tilemap the game runs at 220fps+, with ysort the game stays at 60fps, dropping to 50 and 40 sometimes). Luckily my game isn't due for release right now, but is there any news on #73813?

racs4 avatar Apr 28 '23 01:04 racs4

Hello, I also have the same problem (without ysort in the tilemap the game runs at 220fps+, with ysort the game stays at 60fps, dropping to 50 and 40 sometimes). Luckily my game isn't due for release right now, but is there any news on #73813?

Please test that pull request locally and confirm whether it works as expected :slightly_smiling_face:

Calinou avatar Apr 28 '23 20:04 Calinou

Hello, I tested the PR by building the source using the commands provided in the link. My tilemap has animated water tiles and static ground of different types, its size is (114, 366) (this was obtained using get_used_rect(), but I'm not sure if I understood the documentation correctly), and its tileset is isometric, stacked and has horizontal offset. These were the results:

On godot 4+:

Vsync enabled Vsync disabled
TileMap YSort enabled 55fps (dropping to 45 in camera transitions) 55fps (dropping to 45 in camera transitions)
TileMap YSort disabled 60fps (no dropping) 120 - 130 fps

On #73813:

Vsync enabled Vsync disabled
TileMap YSort enabled 60fps (no dropping) 180 - 220 fps
TileMap YSort disabled 60fps (no dropping) 220 - 320 fps

racs4 avatar Apr 30 '23 01:04 racs4

Hello there. I did build the PR in https://github.com/godotengine/godot/pull/73813 and I can confirm that I obtained a similar results as racs4.

Chicowolf avatar Jul 22 '23 16:07 Chicowolf