-
Notifications
You must be signed in to change notification settings - Fork 22
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
quick and dirty linear interpolation #135
base: main
Are you sure you want to change the base?
Conversation
…odebase or linear interpolation until now... for fun..
Hi! I have some questions about this:
Just some initial thoughts. |
what made you want to implement this?: yeah, just choppy ghosts and for fun. why is it a Debug setting?: idk honestly, just had it there for well debugging purposes so i could change it in-game i personally think its useful to keep. how does this behave with very fast moving players?: i've made a commit since this question that should fix the player interpolating to you on teleport (if the player has no velocity, don't interpolate if their position changed) does this at all affect other mods like Madhunt, A Friendly Climb, etc.?: gone ahead and tested these and they seem to work fine, keep it mind this was tested on 270ms because the other person lives a ways away from me. what does the lerp factor look like?: i've changed it to interpolate based on an update rate across a start and end position, update rate configurable in debug settings, defaults to 30 which is 0.03 seconds of interpolation. ..also added client prediction, feel free to review that. (togglable under in-game settings) |
Co-authored-by: ThatOtherAndrew <[email protected]>
Have you tested what happens with something that teleports you while you might be moving? For example, the Outback Helper portals |
say it was to occur it would interpolate from where the portal was triggered to where the portal teleports you over 1/playerUpdateRate (1/20th of a second, 0.05 seconds), i dont really think its an issue |
interpolating to 20 frames seems quite bad especially as a proposed default. I think this would look weird even just on someone doing an ultra or possibly even just wavedashes. I think this idea is nice in theory but quickly falls apart with the silly amounts of speeds and direction changes players can do in very few frames, even when not Thinking With Portals. https://www.youtube.com/watch?v=JpT-rEpQQr8 I just recorded a little comparison with this PR, recorded at 60 fps and then played back slowly in VLC (not the most scientific method) Also, check top left corner at ~00:47s I'm pretty sure just from the hyper's speed Tim gets over-predicted into the wall. There probably needs to be |
the default 20 is meant to be enabled with client prediction, so you could make it an in-game option instead of a debug option. |
I'm gonna experiment with distance checking from the predicted position instead of the current position and see if that works any better |
sort of like predicting where they would be predicted within 50ms and when the target position is changed if they arent where you predicted then warp them without interpolation? |
yup, basically that, with a bit of lenience to make sure its not falsely triggered |
Vector2 LastTargetPosition = Vector2.Zero; | ||
Vector2 CharacterPositionAtPacketReceived = Vector2.Zero; | ||
float TimeSinceLastPacket = 0; | ||
Vector2 CurrentPredicted = Vector2.Zero; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't those be private
? C# defaults to internal
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer there being some sort of toggle to turn the lerp off.
Personally I'm not a big fan, I think this is unnecessary. |
Co-authored-by: Snip <[email protected]>
Co-authored-by: Snip <[email protected]>
Co-authored-by: Snip <[email protected]>
I have not been able to test this with lag. (unless you mean ping, which i don't think that's what you mean) |
I originally meant ping, but that is also a valid thing to check. |
then yes, in a previous comment i stated this was tested with ~270ms. whenever possible ill see if i can simulate lag somehow. |
Well, I'd like to see how it looks like with said ping. Would the issues discussed previously be more amplified? |
I recorded some gameplay of a co-op map with 270ms, ill get that uploaded and send it here for you to view. The gameplay was recorded before the following comment: #135 (comment) gimme a sec, i gotta go diving in my clips folder for it lol |
might take a bit to upload but heres the link, its mostly unedited (making sure im not doxxing myself) (clipchamp only exports to 30fps so video is 30fps) |
Okay, while it feels a bit off it does seem like a big improvement. I'd still probably want the toggle to turn it on/off though. |
i will give it a toggle! |
ping wouldn't change anything to do with the client prediction or interpolation |
the only reason it looks "off" in that clip was because the update rate was too high |
i have no clue what im doing, but it looked like it worked!