Hey guys i have a few questions for the more experienced users among you.
When doing a fast paced game like an action rpg or something like a 2D action shooter how you handle the latency issue?
The problem with extrapolation is, that it can predict wrong positions expacially when the player changes direction very quickly. So in result the correction can look a little weird and the higher the latency is the more incorrect the results are.
In interpolating things i see the problem, that the clients are noch perfectly in sync and something like traps , moving walls, which crash the player and so on ,are a problem because one client might see the player running into a trap while the other player with lower latency saw him dodging it. I know this is often discussed but how do expert game programmers handle it ?.
Are they only interpolating and do some extrapolation with hunge lag and take the different player views as they are or is there something else you can do about it to at least give the player the illusion that things are in sync?
Extrapolation generally breaks down as latency increases, which is not a good behaviour for a system that is supposed to minimize the impact of latency. Interpolation is generally used. I believe many games do use extrapolation for certain fast-moving objects, for example vehicles that generally don’t change direction or speed that quickly. For human player characters you’re better off with interpolation. To compensate for latency, a shooter game generally “rewinds” time back to the moment when the player shot and does collision detection against the enemies at that moment. That makes aiming work as expected for players that are lagging (they don’t have to shoot in front of enemies to hit), but also gives problems with lagging players seemingly shooting you around corners (they shot you before you ran around it from their perspective). There really isn’t a perfect solution to the problem.
First thanks for your time :). And jeah i know the problem and i use the method of position rewinding in my game too. It works good the only problem is that sometimes player got hit by monsters while others see the monster a few pixel away from the player . So yeay its the same shooting around the corner problem i think . When theres a ping of 100ms its ok an it doesnt actually stand out but a ping of 200+ and fast monster movement , from other players perspective, the monster often can be seen 100 or more pixel away. So you recommend to leave it as it is ? Besides for an action game what ping should be playable something like < 150 ms?
Thank you for the articles guys they are very useful . I read some articles before which covered the same topics and at least i have to say that like “theagentd” said there is no real solution showing players on perfectly synced positions. I think using clientside interpolation and accept small delays at the client view is the best solution. Extrapolation for predictable entinities seems also a proper way of doing it.
Glenn Fiedler tweeted this at the beginning of this month: “I plan to extent my article series on the subject to cover various network models, and describe latency hiding approaches 4 each”.
Somewhere (but I don’t recall where) he have a high level pros and cons on the major ways to design networking.
Really good talk.
Given how easy Java makes it to implement deterministic lockstep (w.r.t. strictfp), I’m surprised it’s not a more popular choice for Java games - especially with the quite significant downsides of the alternatives. (bandwidth / maintainability)