Skip to content
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

[Bullet] Adding a high amount of physics bodies is significantly slower with Bullet compared to GodotPhysics #30027

Open
Tracked by #45022
Kay-Eth opened this issue Jun 24, 2019 · 12 comments · Fixed by #39726

Comments

@Kay-Eth
Copy link

Kay-Eth commented Jun 24, 2019

Godot version: Godot 3.1.1
OS/device including version: Windows 10

Issue description:
When I'm adding 100,000 StaticBodies to the scene, each with CollisionShape, and set on each CollisionShape.disable to true, I have 1 FPS. But when I change to GodotPhysics, I have stable 60 FPS.
Event better, if I use GodotPhysics and set on each CollisionShape.disable to false, I still have 60 FPS (and when using Bullet - 1 FPS).

Steps to reproduce:
Do what I have wrote in Issue description

Here is a little sample project. Camera is not needed
Link

@codecustard
Copy link
Contributor

Sample project link is broken.

@Kay-Eth
Copy link
Author

Kay-Eth commented Jun 25, 2019

Weird.... Just select it, copy and paste
[Edit] It works now ;)

@NuclearPhoenixx
Copy link

Still broken for me. Just drag and drop it here on Github. You don't need an external host.

@burstina
Copy link

burstina commented Jan 9, 2020

LINK to project is still broken

I was able to reproduce the issue:
Just create an empty GridMap, associate to a non-empty MeshLib, create a script who starts a thread that populate a 1000x1000x1 square.
It is important to use the thread for we can look at slowness during runtime.

Run using Bullet, then run using GodotPhysics.

@AndreaCatania
Copy link
Contributor

Do you have areas in your scene?

@Kay-Eth
Copy link
Author

Kay-Eth commented Jan 11, 2020

No, there is not a single one area

@Hromon
Copy link

Hromon commented May 28, 2020

And Bullet crash app if use multi-thread.

Thread thread = new Tread(Gen);

Gen()
{
CollisionShape.Shape = ArrayMesh.CreateTrimeshShape()
}

Bullet - crash, GodotPhysics - don't crash...

@AndreaCatania
Copy link
Contributor

The Bullet integration were 2 times slower than the Godot Physics, when adding bodies. Here: #39726 I've improved the timing drastically, please test it and let me know.

Thanks for the report!

@AndreaCatania
Copy link
Contributor

AndreaCatania commented Jun 21, 2020

By the way, Please don't add collision body from a thread. It's not safe to do.

Consider adding it in batch each frame. (This is true for Godot physics and Bullet physics).

@madmiraal
Copy link
Contributor

Reopening, because #39726 was reverted in #42639.

@madmiraal madmiraal reopened this Oct 13, 2020
@Calinou Calinou changed the title Bullet Physics is much slower then GodotPhysics Bullet Physics is much slower than GodotPhysics Oct 13, 2020
@pouleyKetchoupp pouleyKetchoupp changed the title Bullet Physics is much slower than GodotPhysics [Bullet] Bullet Physics is much slower than GodotPhysics Jan 15, 2021
@slapin
Copy link
Contributor

slapin commented Jan 21, 2021

This is kind of clickbait bug, the problem is speed of adding bodies, not physics simulation here.

@akien-mga akien-mga changed the title [Bullet] Bullet Physics is much slower than GodotPhysics [Bullet] Adding a high amount of physics bodies is significantly slower with Bullet compared to GodotPhysics Jan 21, 2021
@akien-mga
Copy link
Member

This is kind of clickbait bug, the problem is speed of adding bodies, not physics simulation here.

Good point, I edited the title to be clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.