godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.34k stars 21.06k forks source link

Building GridMap in a Thread doesn't work well #42917

Open lordpeter321 opened 4 years ago

lordpeter321 commented 4 years ago

Godot version:

3.2.3

OS/device including version:

Windows 10 64 bits NVIDIA GeForce GTX1060 GLES3

Issue description:

What happened

When i build a GridMap in a Thread and send it back to the main thread, sometimes, somes cells are missing. It's happen randomly ( or seem like it ).

What expected

A fully fill gridmap ready to use

Steps to reproduce:

  1. Create a scene with a gridmap in it
  2. Start a thread and fill the gridmap
  3. send that gridmap back to the main thread
  4. then, add it to the scene tree

Minimal reproduction project:

gridmap_thread.zip

With that demo project, just press the "Start" button to create a gridmap base on a size expose in the "main" node.

4CoDev commented 2 years ago

Is there any progress planned on this bug?

Calinou commented 2 years ago

Is there any progress planned on this bug?

Can you reproduce this issue? If so, which Godot version are you using?

That said, nobody knows the cause of this issue, so there is no ETA for fixing this.

4CoDev commented 2 years ago

Can you reproduce this issue? If so, which Godot version are you using?

That said, nobody knows the cause of this issue, so there is no ETA for fixing this.

Right now I have v3.5.rc2.mono.official [5f9bc7ea5] installed. I remember this bug quite a long time ago, probably from 2020 too.. After experimenting a bit I noticed that the location of "wait_to_finish" influences whether this bug happens or not. Here is a simpler project with two options Test.zip

4CoDev commented 2 years ago

I ran wait_to_finish right after the thread started, thinking it was possible, but it just freezes the main thread, so the bug didn't happen that way

Also an empty archive was sent for some reason, so I'll send it again Test.zip

Calinou commented 2 years ago

See https://github.com/godotengine/godot/issues/63106 for a possible explanation as to why this bug happens.