Hello, I am prototyping a multithreaded "game logic engine" using 3D and Godot 3.2b5. I'm using C# but GDScript could do it the same way. Basically I want my AI/rules to run in a Task/Job parallel system and communicate changes back to the godot visual and physics systems/threads.
Is there a best practice for interacting with Physics from other threads?
I have read through the docs and given that it almost exclusively covers 2D, I am guessing that it's discussing the home-grown physics engine, not Bullet (used for 3d)
This is what I am guessing at for engine requirements/limitations, so please let me know if I'm wrong or if there's a better way:
- Highest performance is to use the PhysicsServer and VisualServer directly. (I can't find any tutorials on this, so I'll be considering this optimization after getting a basic workflow down using Nodes)
- node position/physics mutates through a frame, so you should (must?) read/write this during
- As an extrapolation of #2, the
_Process() function must run gated with the Physics system? (synchronized, physics paused). If not, does this mean Physics is thread safe, and/or that calls like
_Process() stall out the Physics system?
And, I will release my work open source, either as a "C# Perf" tutorial or (even better) as a logic engine asset. Though I haven't started the Job system yet, still prototyping a PubSub workflow.