Advertisement

AI to predict another players movement in multiplayer

Started by August 08, 2007 03:29 PM
1 comment, last by Gagyi 17 years, 3 months ago
I recently wrote some netwrok code and bumped into a well known problem: Lagg. I've seen two methods to handle it: Interpolaiton: Basically doubles lagg but never make mistakes Extrapolation: Removes lagg but overshoots Well, it's really awful to see that a player just "slide out" from behind a corner because of extrapolation (in a tactical shooter...). I thought that a really good solution would be to use AI to extrapolate... It would analyze player movement, tactics, and It could predict further movement accurately. Like not stepping out from behind the corner, keep jumping aroun, etc... Is this feasible? [Edited by - Gagyi on August 8, 2007 3:58:22 PM]
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)
You should consider both server-side and client-side latency correction methods. Client-side you are restricted to predictive methods (either own-unit prediction or other-unit prediction). Server side you can perform, as you say, interpolation or extrapolation, or you can also use backstepping (also known as time warping). (I would do this before worrying about complex player modelling, which will ultimately make errors in many instances).

The general gist of the problem is that due to latency, unit commands are delayed in transit to the server and this delay varies between players. Thus, commands are processed out of temporal order, permitting some players to react to situations that should not actually occur...such as shooting the unit that slid out from behind cover. Clearly, had the 'stop' command been processed at its correct time, the unit would not have been seen by other players, not shot by other players and would have been alive when the 'stop' command is finally processed.

So, if the server receives a command that has a time stamp (say t1) earlier than the last processed command (say t2), the game state is backstepped (rolled back) by undoing all commands between t1 and t2. This command is applied and the game state is rolled forward to t2 again, reapplying subsequent actions. Any changes to the game state that occur because of this backstepping and rolling forward are sent to any client that had previously received an update in the interval t1-t2. If the time stamp of the out-of-sequence command is too far back in time, it should be dropped and notification sent to the client (which might trigger a network connectivity warning to the player).

If you combine this technique with client side unit prediction techniques you can provide players with a balanced view of the game state that overcomes small latency variations between players.

Cheers,

Timkin
Advertisement
Yes, I already knew about that server method, I was only talking about client side prediction.
Maybe my client prediction is flawed, thats why ppl slide out from corners, but i dont think so.
Oh and it's not about shooting the player, who slid out, but *seeing* him. Not fair.
(actually, now its simple extrapolation... Interpolation didnt work well too, because playres had to shoot in front of the running enemy to shoot him down... now thats just annoying)
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)

This topic is closed to new replies.

Advertisement