thedupdup Posted December 6, 2018 Share Posted December 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
Antriel Posted December 6, 2018 Share Posted December 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
thedupdup Posted December 6, 2018 Author Share Posted December 6, 2018 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? Quote Link to comment Share on other sites More sharing options...
Antriel Posted December 6, 2018 Share Posted December 6, 2018 `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. Quote Link to comment Share on other sites More sharing options...
thedupdup Posted December 6, 2018 Author Share Posted December 6, 2018 18 minutes ago, Antriel said: `current_time` is simply the time that is now So is it the time that has elapsed since the last update? Quote Link to comment Share on other sites More sharing options...
Antriel Posted December 6, 2018 Share Posted December 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
thedupdup Posted December 6, 2018 Author Share Posted December 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
Antriel Posted December 6, 2018 Share Posted December 6, 2018 Essentially yes. It's all nicely explained in my blog too. Quote Link to comment Share on other sites More sharing options...
thedupdup Posted December 6, 2018 Author Share Posted December 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
Antriel Posted December 6, 2018 Share Posted December 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
thedupdup Posted December 6, 2018 Author Share Posted December 6, 2018 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.