Advertisement

Smoothing out Network Corrections

Started by May 22, 2020 07:53 PM
3 comments, last by SerialFr 4 years, 5 months ago

Hey,

I've been working on a physics-based player in PhysX and right now I'm trying to get networking to work. Right now I send input to the server and simulate physics locally. Then every 100ms the server will send the last input that it has processed as well as the current position, velocity, rotation and angular velocity. The client then checks if what it calculated roughly agrees with what the server just sent. If it doesn't, the client rewinds to the server's snapshot and replays all of the input and re-simulates the physics.

Sometimes the corrections can be quite significant. My goal is to just instantly snap the physics actor to the new position and do some kind of visual smoothing, but I'm unsure what the best approach should be. Any ideas?

That sounds about right. The main thing you might want to do is store the physical state you HAD at previous points in time, so you can compare what the server sends back, to the state you had at that time. It's un-clear from your description if that's what you're doing, or if you're currently just comparing to your latest-simulated state (which is “ahead” of the server.)

enum Bool { True, False, FileNotFound };
Advertisement

@hplus0603 Yeah that's currently what I'm doing and then I also make sure to overwrite the saved values as the player is re-simulated.

For smoothing corrections, this post helped me a lot

https://www.gamedev.net/forums/topic/658931-smoothing-corrections-to-client-side-prediction/5168001/

This topic is closed to new replies.

Advertisement