Jump to content
Posted 26 January 2011 - 04:35 PM
Posted 26 January 2011 - 06:06 PM
Posted 26 January 2011 - 10:50 PM
Posted 27 January 2011 - 01:37 PM
Some keywords are interpolation, extrapolation, client prediction and dead reckoning.
What type of game are you writing?
Most fps use a form of client prediction where they just update the local player immediately after input and correct its position if it differs too much from the received server state.
Other players will appear in the state they were about ping/2 milliseconds ago on the server. This way you will always (under stable network conditions) receive server updates at the right time to display smooth enemy movement. Of course you will then be shooting at an enemy where it was in the past. So the server needs to take that into account and see if you would have hit the target had it received the "shoot" command in the past.
At least that's how I got it. I am implementing something like this myself but haven't got to the point where I can test it.
Most games only use the last 1, 2 or 3 received messages. You can get away with the last received message if each data point is (position, velocity); if it's just position, you can get away with the last two.
Note that, if you extrapolate, you will have the problem that players will "overshoot" when they stop, because the stop packet takes some time to get to the destination. You may want to simply delay display, so that at time T, you display the user at time (T-0.1), assuming that you will get a new data point every 0.1 seconds to keep it up.
Posted 27 January 2011 - 02:40 PM
However, how do I account for jitter in this situation?
Posted 27 January 2011 - 02:42 PM
Posted 27 January 2011 - 04:57 PM