Sign in to follow this  
thedupdup

What is the best way to lerp in a multiplayer game where the update rates are inconsistent?

Recommended Posts

I've followed many guides on the internet and I have found success in none of them so far. My situation is having a game where updates from the server are inconsistent, so-far I have found no lerp that can handle this without jumping and jittering a bunch.  

Share this post


Link to post
Share on other sites

I explained exactly why this happens in your other topic, with a solution and a link to my blog post where I go deeper into details regarding that issue. If something wasn't clear, maybe ask a question rather than make a new topic.

 

Share this post


Link to post
Share on other sites
11 hours ago, Antriel said:

I explained exactly why this happens in your other topic, with a solution and a link to my blog post where I go deeper into details regarding that issue. If something wasn't clear, maybe ask a question rather than make a new topic.

 

Hi, whilst reading through your blog, I have found this http://buildnewgames.com/real-time-multiplayer/#entity-interpolation-other-clients, which seems like a solid way to do this. But I am having troubles understanding what current_time is, maybe you can help me understand? 

Share this post


Link to post
Share on other sites

`current_time` is simply the time that is now. If server sends you `{x: 100, time: 0}` and then `{x: 200, time: 100}`, and your current time is 50, you interpolate x to be 150.

Of course it's a bit more complex as you need to keep that time relative to what server is sending out. And interpolate a bit in the past to cover delayed messages. So server sends you e.g. 4 positions, you start showing the first, second... meanwhile you get 5th, 6th... etc.

Share this post


Link to post
Share on other sites

No, in a way it's `Date.now()`. Or some number that's relative to that and the server's time.

E.g. I simply start counting time when first message arrives and I know what rate to expect, so I know what timestamp the other messages have. Imagine starting a stopwatch when first message comes and timing your whole game based on that.

Share this post


Link to post
Share on other sites
3 minutes ago, Antriel said:

No, in a way it's `Date.now()`. Or some number that's relative to that and the server's time.

Does that mean I can just use Date.now() for the client and server? They would technically have the same start times. 

Share this post


Link to post
Share on other sites
19 minutes ago, Antriel said:

Essentially yes. It's all nicely explained in my blog too.

So I re-looked at your examples, so in this example: http://buildnewgames.com/real-time-multiplayer/#entity-interpolation-other-clients I don't see current_time ever altered, wouldn't this mean the current_time would always be ahead ahead of the server? Since in your example you subtract 0.2 from the current time. 

Share this post


Link to post
Share on other sites
17 minutes ago, Antriel said:

There isn't `current_time` ever used there, it's just used to describe the principle. If you look at it properly you see it also subtracts time from the current time.

Okay so in that code they subtract net_offset from current_time? Is net_offset just the time it takes the packet from the server to reach the client? 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.