Open kingoftheconnors opened 1 year ago
Can you please try this with a supported version, like 4.1.3 (only the latest patch version is supported, and it might already be fixed)
@AThousandShips I have tested it on 4.1.3.stable.official and the problem is still there.
Godot version
4.1.3.stable.official
System information
Godot v4.1.3.stable - Windows 10.0.19043 - Vulkan (Compatibility) - Intel(R) HD Graphics 4600 (Intel Corporation; 20.19.15.5144) - Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz (4 Threads)
Rendering was in COMPATIBILITY Mode
Issue description
Tilemaps with two Occlusion layers will tank performance and framerate when the scene is reloaded (such as in the case of a player dying).
For my computer, framerate goes from 177 (with V-sync disabled) to 30 after about 5 seconds of continuous reloading a scene using this code:
This will reload the scene hundreds of times every second. However, this is only for a very simple scene with only a few tiles. If you draw out an entire level, you can drop your performance by 10 FPS with every reload (as in the case of a game I'm working on).
This happens whether you are using
get_tree().reload_current_scene()
orchange_scene_to_file("res://NAME_OF_CURRENT_SCENE.tscn")
This issue also happens (but noticeably weaker) if you continually go to a second scene and then change BACK to the first scene.
The framerate shoots back up to full if the DirectionalLight2D is made invisible or shadows is turned off. On the other hand, you can change the Range Mask and Shadow Mask to have NO layers enabled, and this slowdown will still happen.
If you remove either one of the occlusion layers off the tilemap, this effect also goes away.
Steps to reproduce
func _process(delta): if Input.is_key_pressed(KEY_R): get_tree().change_scene_to_file("res://level3.tscn")