IssueRaiser

Implement group-based threaded scene processing

### Describe the project you are working on Godot ### Describe the problem or limitation you are having in your project CPUs are getting more, and more and more hardware threads. So it's obvious that, to scale, Godot needs to be able to make use of this. On the server level, Godot is strongly multi threaded for things like rendering and physics. Accessing the Godot servers is also safe from multiple threads. But, on the scene level, there is no threading at all. Godot is single threaded. Would it not make sense that, if there are 50 enemies in your scene and your CPU has 32 threads, every enemy is processed each in a thread? (so basically 32 threads are processing the 50 enemies in a queue fashion) This would give a massive performance improvement. But well, this is not possible. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation I previously opened another proposal (#4962) with a different solution to this, which is more akin to a traditional job scheduler. The problem is, I don't like this. Its not easy to use, it's not easy to mark dependencies. You are still free to make mistakes and putting mutexes all across the scene system and hoping this avoids users from making mistakes is wishful thinking (It would probably deadlock in a heartbeat). So, thinking about how the use case works, and following Godot design and usage, one could argue that most games could be divided into "functional units". As an example, enemies are

Posted by reduz on Mar 4, 2023, 10:37 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

github (Sysadmin)

Implement group-based threaded scene processing

reduzMar 4, 2023, 10:37 AM

### Describe the project you are working on Godot ### Describe the problem or limitation you are having in your project CPUs are getting more, and more and more hardware threads. So it's obvious that, to scale, Godot needs to be able to make use of this. On the server level, Godot is strongly multi threaded for things like rendering and physics. Accessing the Godot servers is also safe from multiple threads. But, on the scene level, there is no threading at all. Godot is single threaded. Would it not make sense that, if there are 50 enemies in your scene and your CPU has 32 threads, every enemy is processed each in a thread? (so basically 32 threads are processing the 50 enemies in a queue fashion) This would give a massive performance improvement. But well, this is not possible. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation I previously opened another proposal (#4962) with a different solution to this, which is more akin to a traditional job scheduler. The problem is, I don't like this. Its not easy to use, it's not easy to mark dependencies. You are still free to make mistakes and putting mutexes all across the scene system and hoping this avoids users from making mistakes is wishful thinking (It would probably deadlock in a heartbeat). So, thinking about how the use case works, and following Godot design and usage, one could argue that most games could be divided into "functional units". As an example, enemies are

Comments (0)

No comments yet. Start the discussion.

Comment on this issue