What is Physics Flush Queries parameter?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vctr
:warning: Old Version Published before Godot 3 was released.

I’m profiling my game. Fixed time sometimes goes too far. The reason is Physics update takes much more time then needed. In Physics tree, there is Flush Queries parameter that takes all this time.

What does Flush Queries param mean?
What can I do to decrease Flush Queries time?

Thank you!

I need to know what I can do to improve this too. Any ideas anyone?

christh | 2019-06-08 14:02

I am also looking for an answer to this question. Is anyone able to help?

mousenger | 2020-01-26 20:18

My possibly baby / bathwater based solution was to migrate to unity. Bit of a shame but I just kept hitting performance issues on mobile and performance not being tackled as a priority until Godot 4.x pushed me over the edge.

As something maybe helpful… Try taking a look at threading mode for physics in project settings etc.

christh | 2020-01-26 23:15

:bust_in_silhouette: Reply From: jeudyx

I just had this issue and in my case, I had a lot of zombie instances (ships that dies). After calling queue_free() properly, the problem went away.

:bust_in_silhouette: Reply From: godot_dev_

When my game was lagging due to the physics engine, the reason was because I was adding and deleting too many Area2Ds with too many collision shapes to frequently (i’d add/remove dozens every few frames).

How I solve it was to pre-allocated all the Area2Ds and collisionshapes when the game loaded, and disabled them dynamically. When I wanted to add new shapes, I’d just copy over angle, extent, and position of all the collision shapes I wanted to add into the already-in-the-scene collision shapes.