-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Many static bodies cause severe slowdowns #1033
Comments
How are you creating the bodies, and how are you disabling their collision? There is currently a tiny amount of overhead during the physics step that apply to any body that's added to a physics space (i.e. a scene tree), which stems from me iterating over every one of them regardless of their sleep state. That will almost certainly become quite significant when dealing with hundreds of thousands of bodies. Jolt does offer the ability to iterate over only active/awake bodies, which I did make use of for a brief time, but it led to state desynchronization issues that were tricky to solve, hence the current heavy-handed solution. I've been meaning to look into solving this for the new engine module in Godot 4.4, but it's unclear whether I'll address it in this extension, since it's not strictly a bug per se. Anyway, if you could share some kind of representative minimal repro of your issue I'd appreciate it, so that I can know whether we're talking about the same problem. |
I'll try to put up something this week, I only currently tested it in a game I've been working on which's a procedural world. |
alright, I made a small project with 4 buttons where you can create 200k objects, each button adds them in a thread or on the main thread, one adds phyiscs objects that get their collision shape disabled when they're added to the scene and the other just empty meshes for comparison. I set the project |
Thank you! I'll take a look at it some time later next week. |
I've put up a pull request in the Godot repo that seems to resolve this issue: godotengine/godot#100983 I'm not super keen on backporting this change to the extension at the moment, so I think I'll leave things here as-is for now. Let me know if you run into any issues with the above mentioned pull request, if you happen to try it out. |
This is a weird one, I've got over 400k+ bodies in a scene (procedurally created) but with its collision disabled, I only enable a few of them close to the player, with the built in Godot engine this works super fine, no performance hit or anything.
With jolt on the other hand, the first problem I encounter is the max_bodies that needs to be raised considerably for things to even work, but even though I'd say 90% of those bodies are disabled, I'm still getting such a heavy performance hit, so I assume they're still getting tested even when they got all their collision shape disabled?
Example project:
custom-4.4-test.zip
The text was updated successfully, but these errors were encountered: