I am trying to come to some sort of solution to a common problem with synching projectile firing and game networking in general, but am unsure on what would be the best fit.
This is a 2D action side-scroller with several projectiles (no instant hit weapons) and already has much of the framework in place (C# XNA Framework and Lidgren library).
At this time I am thinking the architecture is going to be modeled similar to the half-life source engine. Clients will interpolate remote entities ~100ms or about 3 frames in the past (fixed step 30fps) and using client side prediction. Server has authority over the simulation. Thinking about coding the implementation with movement seems fine, but when it comes to projectiles I am unsure of how it would best work to provide the best gameplay for all players.
Client A
Client B
Server
This is also 2D sidescroller so everything is visible.
It seems to be a fundamental side affect of using interpolation (which I think is a must, but am open to suggestions), as even without any network latency there is inherent interpolation latency.
I know it cant possibly be perfect, but are there any more or better ways that I can implement to obfuscate or ameliorate this so that it looks good/seamless, or am I missing anything obvious? The firing of the weapon does have a short animation time before the projectile is actually fired which I realize we can use that time to hide some of the latency, but the weapons are not instant fire, and any way I look at it there is always going to be this large gap with the client trying to dodge projectiles and other clients seeing their projectiles hitting them.
We can use lag compensation on the server for cases where the players are moving, but I dont think that could help this situation?
If the projectile hit causes client A's position to be altered I would have to rewind client A and replay his inputs with the new data, or if it doesnt, I have to remove the projectile from mid-air (and maybe they die), ugly either way :(.
Funny you should mention half-life, valve actually published an article about this, Latency Compensating Methods in Client
Dead-Reckoning, is a pretty generally used technique in networked games so you should be able to find some more information about this online.
Google brought me this gamasutra article which might help you as well, Dead Reckoning Latency Hiding
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With