-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add movement smoothing to CAOs #16569
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks @cheapie . I could also make the smoothing configurable. |
|
Tested a tiny bit. Marked a dropped item with branding iron, then did (Tested in singleplayer with 60Hz (But please note that I don't properly understand this smoothening, neither why we need it or why it should be increased nor how it works.) |
Thanks @Desour! Could you explain a bit more what that means, and how it should behave?
Client and server both estimate the position of objects, so that movement is seamless between server updates of the position.
Singleplayer mode does not honor dedicated server step - unless you also apply #16501 |
|
Thanks for the explanation! If the client prediction is correct, there should be no unsmooth jumps, ideally (there are, because it's not ideal). Even if the server step time is slow, it doesn't necessarily lead to misprediction.
It first falls, then teleports down. bla.mp4
Probably.
But it does affect packet send intervals (at least last time I checked, IIRC). |
|
Thanks @Desour . What you see is indeed the switch from smoothing to a collision update (which is done in the same frame. So it looks bit like a teleport.) It's either that or always jitter. :(
I doubt this. That issue talks about another source of jitter: Dropped or out-of-order packets and latency. You'll see jitter with both client and server on your machine with no dropped packets, perfectly sync'd clocks, and practically no latency (< 10us). Maybe this will just be another change in my ever growing local patch set. :( |
|
@Desour Could you try again with the smoothing spread to 4 frames instead of 5? |
Sure. But can you not reproduce? Still happens with 4.0f. |
|
@Desour I see that effect. I think it's not avoidable, we want some smoothing, but for a collision we need precision. My question was more whether it's acceptable with 4 instead of 5. |
|
🤷 It's still noticeable. And if reasonably possible I personally don't want to see the effect at all (because I'm perfectionistic). But I don't think I should be the one to decide on the tuning value here if there's a tradeoff. |
|
@Desour I get that. The jittering doesn't bother you? You can see the difference in jitter here: And with this and #16501 applied. |
|
@lhofhansl while it sounds good on paper, did you tested it with 50 entities ? I think we should see it better with more entities |
|
@nerzhul I tested it with that birds mod, which creates 100's of entities. I also tested with nssm (created 2000 of those some of the creatures). This PR just expands the existing smoothing when there is no collision, and does not add any new computation. What would you expect would be different with more entities? Should I test for something specific? |
Another one of my perhaps controversial proposals.
This adds smoothing of two server steps of rotation and position to non-physical CAOs.
For physical CAO, this smooths positions over 5 client step, unless there was a collision, in which the change is applied in one step as before.
I have had this one for a bit now, and it really smooths things, without compromising immediacy in the case of a collision. The transition from client smoothing to no smoothing is not/barely visible with the numbers I picked.
This work well with #16501
To do
This PR is a Work in Progress.
It needs testing. Please try it out!
How to test
Attach to some moving entities (steampunk blimp, hot air balloon, whatever), notice how the world around you "stutters" far less as the entities moves with you attached.
Throw some object (f.e. drop them from your inventory with 'Q' and observer their trajectory).
Observe rotations, etc.
There should be no (or not noticeable) changes to movement and rotation, but position and rotation updates should be smoothed.