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] Bullet physics breaks determinism when iterations_per_second is changed #38910

Open
Tracked by #45022
MightyPrinny opened this issue May 21, 2020 · 5 comments
Open
Tracked by #45022
Assignees

Comments

@MightyPrinny
Copy link
Contributor

Godot version:
3.2.2 beta 2

OS/device including version:
MXLinux 64 bits

Issue description:
I was making a 3D puzzle game where I had a slider to change how fast the simulation runs, the game was just using areas and discarding delta so iterations_per_second could be used to adjust the speed of the game, but this made the game simulate differently at different speeds. Changing the physics engine to Godot Physics seems to have fixed this for me.

Steps to reproduce:
Sorry can't really specify what was going on, but I think the areas weren't working consistently at different iterations per second.

@MightyPrinny MightyPrinny changed the title Bullet physics break determinism when iterations_per_second is changed Bullet physics breaks determinism when iterations_per_second is changed May 21, 2020
@MightyPrinny
Copy link
Contributor Author

Ok sorry nevermind, my code was broken the things that made it work differently weren't actually working in godot physics, I'll make sure that it's fixed before reopening this.

@AndreaCatania
Copy link
Contributor

In any case, try to upload a sample project. However, I think that you should use a time scaler.

Change the iteration per seconds must not produce any change in your game behavior, if so is likely that you are doing something wrong.

@MightyPrinny
Copy link
Contributor Author

MightyPrinny commented May 21, 2020

In any case, try to upload a sample project. However, I think that you should use a time scaler.

Change the iteration per seconds must not produce any change in your game behavior, if so is likely that you are doing something wrong.

It works in godot physics and I've already had too many problems with bullet to accept it works fine, I don't want to use delta because I just want to speed up the simulation by updating the game more often, I just can't do it in any other way due to the way the game works to keep things working consistently and I don't want to deal with floating point imprecision problems. I'll see if I can make an mrp tomorrow.

@AndreaCatania
Copy link
Contributor

Change the frame per seconds should not produce any game behavior differences, other than increasing the precision of the simulation.

If you can speedup and slow down the game by changing that I can tell for sure that you are doing it wrong. The game should be frame rate independent.

Just think about the fact that your simulation precision changes, depending if you are in the slow phase or not.

The correct way would be multiply the delta with a factor variable,in this way you can speed up the time while maintain a stable frame rate.

@MightyPrinny
Copy link
Contributor Author

I'd rather keep using the same delta to make sure the numbers the game simulates with never change, which is what I get when I use Godot Physics, that should be a decision I can make, I'm not using rigid bodies so my code should be the only thing affecting the behavior of the game, you can't say it's wrong, it's right for the results I want and for this game, it's not computationally intensive I can just use 60ips as my slowest speed and it's more convenient than having a factor that could potentially change the result of collision checks.

@pouleyKetchoupp pouleyKetchoupp changed the title Bullet physics breaks determinism when iterations_per_second is changed [Bullet] Bullet physics breaks determinism when iterations_per_second is changed Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants