Open belzecue opened 2 years ago
NOTE: if you comment out this line from the chunk_spawned function, the physics_process time climbs very rapidly.
#skip_lines()
By omitting that line, the GUI label text grows large quickly, which somehow has a direct effect on physics_process in the Editor.
Godot version
3.4.3-stable
System information
Ubuntu Linux, Intel NUCPJYH4, 8 gig mem
Issue description
I have a multi-threaded app for terrain generation. The thread emits a signal when it generates or removes a chunk. This updates a label on screen. When the line below is used, the physics_process time continues to climb until the app crashes.
label.text += "\nChunk spawned: " +str(chunkIndex) # constant physics_process time creep until crash
But if I remove the plus sign, and make it a straight assignment, the physics_process time stays generally constant, as expected.
label.text = "\nChunk spawned: " +str(chunkIndex) # no physics_process time creep
I have tried putting various things into call_deferred to no avail. I have tried adding mutexes to no avail. I have tried changing collision map so that the tiles only collide with the player, to no avail.
The only thing that stops the creep is either not emitting the signals that update the GUI, or the label.text workaround described above.
Some additional screenshots and conversation I had with the author of the terrain-gen code: https://github.com/alex-karev/godot-simple-procedural-terrain/issues/3
Repro attached.
Steps to reproduce
Here is a video showing the issue in action. https://www.youtube.com/watch?v=UTUhrfh6-NE
You might want to fast forward through much of it as I wait for the physics_process creep to crash the app. Note how the total number of nodes becomes constant as tiles are removed and created on the fly to maintain a zone around the player. The video shows three runs: first with the physics_process creep, second with the workaround showing the issue is gone, and third showing physics_process creep until crash.
Minimal reproduction project
repro.zip