-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Bounciness issues with large dtime steps #15027
Comments
Here comes THE SCREWDRIVER output2.mp4(I've used this command to make it lag //lua local t0 = os.time() while os.time() < t0+2 do end |
Is #13140 the same thing? |
As for testing, it should also be possible to
|
1. use average speed not final speed (half as much acceleration) 2. when detecting a collision, compute the speed at the moment of collision, instead of using the final speed 3. after collision, set the acceleration on this axis to 0
This does not seem to work (tested in devtest and mineclonia). IIRC local player physics run at a different, fixed small stepsize (which can be afforded because each client does their own and there is only a single local player per client). It also can't be reproduced with items, since those zero the velocity on collision (: So this unfortunately isn't nice to reproduce in devtest. But in Mineclonia I can reproduce it, and the engine code shows that it's indeed an engine issue. |
"This does not seem to work" -> "This test does not work" |
No no, the patch works, that's why I was commenting on the issue. I just had a bit of trouble trying to reproduce the issue in devtest in the first place due to the aforementioned reasons :) |
1. use average speed not final speed (half as much acceleration) 2. when detecting a collision, compute the speed at the moment of collision, instead of using the final speed 3. after collision, set the acceleration on this axis to 0
1. use average speed not final speed (half as much acceleration) 2. when detecting a collision, compute the speed at the moment of collision, instead of using the final speed 3. after collision, set the acceleration on this axis to 0
Can we try to get the second iteration of this #15408 into 5.11.0? |
That's too risky to review and merge during a feature freeze unfortunately. We have to postpone it to 5.12 :c |
Minetest version
Irrlicht device
X11
Operating system and version
Debian sid
CPU model
No response
GPU model
Intel
Active renderer
No response
Summary
When there is lag in the server (generating map chunks, spawning structures, mobs...) and it misses some dtime steps, entities can bounce badly on beds. Seen for example in Voxelibre and Mineclonia.
The reason is an incomplete interpolation in collision.cpp.
First the acceleration is applied over the entire dtime:
https://github.com/minetest/minetest/blob/dc21924f31ff52174553c4441ce8c861f842c6f9/src/collision.cpp#L365-L367
then a collision is searched with the updated speed (this is probably okay as an approximation).
Then when a collision was found, it is assumed it was at the updated speed:
https://github.com/minetest/minetest/blob/dc21924f31ff52174553c4441ce8c861f842c6f9/src/collision.cpp#L505
When not bouncing that likely does not matter as much, because the collision sets the speed to 0, but not when on bouncy material (such as beds in Voxelibre and Mineclonia):
https://github.com/minetest/minetest/blob/dc21924f31ff52174553c4441ce8c861f842c6f9/src/collision.cpp#L538
A perfect simulation would of course mean checking some parabola, which is expensive. I think checking a linear movement from the start to the destination is okay as an approximation, but the error in the collision speed causes larger issues with bouncyness.
Steps to reproduce
//lua local t0 = os.time() while os.time() < t0+2 do end
The text was updated successfully, but these errors were encountered: