-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
TileMap editor is slow with large tilemaps #72405
Comments
I can add on to this that editing tile data, creating animation, selecting and deselecting tiles gives the same lag, freezes and crashes. |
I've spotted the same. Overtime tilemap editor performance tanks. Reloading project seems to be okay though and works fine. Possibly not freeing some objects somewhere? I'm on latest Godot 4.0 and using a tilemap with 64x64 cells. Edit: Seems to be when you use the flood fill. After filling an area the performance gets pretty awful, but reloading scene sorts it out. |
Hey! v4.0.3.stable.official [5222a99] |
I have the same problem, I have about 175,000 terrain tiles, and it was lagging when I was editing the terrain bitmask or editing the tile properties, but not when I was erasing or placing terrain tiles. The way I work around this issue is I save the tileset as a .tres file and then open a new scene and create a new tilemap, place the saved tileset .tres file and then when I edit the tileset in the new scene automatically saves the properties in my large world and I'm able to edit it at normal speed. |
I can confirm this in 4.0, 4.1 and 4.2-dev3, specifically related to the situation in the last comment. I've run into this lag when using my plugin TileBitTools. The plugin retrieves and edits TileData (terrain set, terrain and peering bit values) for multiple tiles at a time. After it makes the edits, if there are tiles painted on the tilemap, there is up to a few seconds of lag that appears to be directly related to the number of cells that have tiles. If there are no cells with tiles, there is no lag at all. It does not matter whether the TileData belongs to tiles that are painted on the TileMap. Even if the edits are only to TileData objects for tiles that are not currently painted on the TileMap, the lag occurs. It also does not matter how many TileData objects are edited at once. I have tried manually changing a single terrain value for one tile, and it still causes the lag. I also get the same lag when changing other values not related to terrain. I am unable to capture this lag in line-by-line profiling in GDScript. Setting and retrieving TileData properties do not appear to be the direct cause of the slowdown, since they take the same time to complete regardless of whether there are tiles on the TileMap. This seems to point to the TileMap responding to the TileData being changed, and possibly performing some updates on each occupied cell, regardless of whether its TileData is changed or not. |
An update to my above comment. It looks like the linked PR #74603 was intended to limit updates to cells that are "dirty", which should address this problem. It appears to be superseded by #81070. I just tried the build artifact from that PR, but I'm still getting the same lag. This happens when there are many tiles on the TileMap, and I edit a TileData property for a tile that is not currently placed on the TileMap. It is difficult to say whether it is less lag than prior as I'm not using a setup with C++ profiling, but, subjectively, it is still a noticeable editor freeze. |
I was able to debug my case a little bit and it seems to be a separate issue. The reason is - every 'draw' cycle the grid is re-drawing all it's rectangles, so it's quadratic of the size of TileSet. Profiling shows that adding and removing the rectangles eats all the CPU Disabling the grid redraw here completely solves the lag. So the 2 ways that I see to fix this are:
Though I am new to Godot, so I welcome any ideas on how that should better be fixed :) |
As reported in godotengine#72405 and godotengine#84963 the tileset editor becomes unusable when editing large tileset atlases due to repeated calls to `draw_rect` to draw the tile grid. This commit is a workaround which replaces `CanvasItem::draw_rect` calls with `TileSet::draw_tile_shape` which does not seem to display the same performance issues.
Godot version
4.0 beta 16
System information
Linux Min 19
Issue description
Currently developing a 2d open world game and have encountered problems using Tilemaps.
When editing a large map the editor lags, freezes and crashes all the time. Its completly unsuable.
Running the game workd flawless, but the problem occurs when editing the level in editor.
Is the tilemap editor not supposed to be able to edit large maps?
Steps to reproduce
edit:
Create a tilemap with 800 x 800 tiles.
Minimal reproduction project
minimal.zip
The text was updated successfully, but these errors were encountered: