• Create Account

### #ActualTelanor

Posted 13 December 2012 - 02:14 AM

I'm having problems determining whether the client predicted the players location correctly or not. I have a circular array storing the player's position for each tick on the client. When the client receives an update from the server, which contains the server tick that it was for, it looks for the position it calculated for that tick in the array. It keeps coming up with the wrong answer though.

Say for example the client receives an update from the server that says "on tick 150, your calculated position was X = 10". So it looks at the array for it's position at tick 150, and it comes up with X = 13. When you look at the position for tick 145 though, it has X = 10. It's not that the client's numbers are wrong, it's just that the client and server don't agree on what tick that movement occurred at.

This is what I'm using to set/correct the client's current tick:

World.CurrentTick = tick + (int)Math.Ceiling(incomingMessage.SenderConnection.AverageRoundtripTime / 2f / Physics.Physics.WorldSpace.TimeStepSettings.TimeStepDuration);


Where tick is the tick from the latest update from the server. AverageRoundtripTime is measured in seconds, as is TimeStepDuration.

### #2Telanor

Posted 13 December 2012 - 02:14 AM

I'm having problems determining whether the client predicted the players location correctly or not. I have a circular array storing the player's position for each tick on the client. When the client receives an update from the server, which contains the server tick that it was for, it looks for the position it calculated for that tick in the array. It keeps coming up with the wrong answer though.

Say for example the client receives an update from the server that says "on tick 150, your calculated position was X = 10". So it looks at the array for it's position at tick 150, and it comes up with X = 13. When you look at the position for tick 145 though, it has X = 10. It's not that the client's numbers are wrong, it's just that the client and server don't agree on what tick that movement occurred at.

This is what I'm using to set/correct the clients current tick:

World.CurrentTick = tick + (int)Math.Ceiling(incomingMessage.SenderConnection.AverageRoundtripTime / 2f / Physics.Physics.WorldSpace.TimeStepSettings.TimeStepDuration);


Where tick is the tick from the latest update from the server. AverageRoundtripTime is measured in seconds, as is TimeStepDuration.

### #1Telanor

Posted 13 December 2012 - 02:10 AM

I'm having problems determining whether the client predicted the players location correctly or not. I have a circular array storing the player's position for each tick on the client. When the client receives an update from the server, which contains the server tick that it was for, it looks for the position it calculated for that tick in the array. It keeps coming up with the wrong answer though.

Say for example the client receives an update from the server that says "on tick 150, your calculated position was X = 10". So it looks at the array for it's position at tick 150, and it comes up with X = 13. When you look at the position for tick 145 though, it has X = 10.

This is what I'm using to set/correct the clients current tick:

World.CurrentTick = tick + (int)Math.Ceiling(incomingMessage.SenderConnection.AverageRoundtripTime / 2f / Physics.Physics.WorldSpace.TimeStepSettings.TimeStepDuration);


Where tick is the tick from the latest update from the server. AverageRoundtripTime is measured in seconds as is TimeStepDuration.

PARTNERS