I've been having a peeve for days which I don't think has a solution, but it's worth asking either way. As a training to learn the engine I wanted to recreate some elements of Bloons Tower Defense, the most important being, the track the Bloons go through. Very simple, I set up a Path2D and a custom PathFollow2D, the latter of which will be a bloon, set up to move forward until the end of the track, which also contains an Area2D to test for collisions against projectiles.
But, I had noticed that, with a lot of Bloons, the performance took a massive hit, and thought that it may be possible to optimise it, by splitting the movement into multiple threads.
As expected, the game does run better, but the Area2D works unexpectedly if the threads are greater than 1.
Through a lot of debugging, while the position of the node is updated accordingly, the true checking area is stuck behind, as if something has gone terribly wrong behind the scenes.
I showcase this with the cursor entering the areas:
Is there any way to make this work as it should?
This is what each thread executes:
The bloons are directly fetched as children of the Path2D node before the threads start, and are not passed as argument
And the Bloon's core functions:
The normal "process" of each Bloon is halted with setprocess(false) and called in the thread itself, but calling either _process() or move() doesn't change the issue I'm describing.