Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Game Networking Projectiles Implementation/Concept Issue [closed]

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.


EXAMPLE PROBLEM:

Client A
Client B
Server

  1. Client A and B are just standing facing each other.
  2. Client B starts to fire toward A and sends input to server as usual. Server detects fire input and starts to fire weapon in its simulation while relaying the event to client A.
  3. Client A receives the message but is still interpolating client B in the past (meanwhile the projectile is now coming toward A on the server and client Bs machine).
  4. Client A's rendering finally gets to the point where B shot the projectile and starts rendering that.
  5. Client A sees it and jumps, easily clearing it on his screen. However, the projectile hits him on the server and on client Bs point of view.

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.


QUESTION:

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 :(.

like image 875
Joshjje Avatar asked Sep 04 '12 23:09

Joshjje


1 Answers

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

like image 93
Remco Brilstra Avatar answered Oct 02 '22 09:10

Remco Brilstra