Lag compensation model for a projectile-based 2d shooter.

I’ve been researching/pondering a good way to set up the lag compensation techniques for a 2d shooter where the attacks are mostly, if not all, projectile based (i.e. a rocket). Imagine the game features 2-8 players moving about their body’s distance in half a second. A rough cut of what a lot of modern day shooters do follows:

  1. Player sees all other players some interval in the past. Say, an arbitrary 100 ms. This way the game feels very “smooth” as the other players run around (interpolation)
  2. Player sees itself in the present, and predicts where it should be. If all goes well, it guess correctly and so the game feels “instant” to the player. (client-side prediction)
  3. Player aims at someone in the past. If he fires a weapon, the server rewinds everyone BUT the player who fired and checks for hits. (reverse-…something)

Unfortunately with projectiles, number 3 is a little more tricky, how’s best to go about firing a rocket? We’ve got some options here with pros and cons.

Lets say we’re still showing other players 100 ms in the past.

3a. Player fires a rocket and the rocket is rendered in the present. The shot feels instant, but the targets are 100ms in the past, the player would have to lead its shots to score hits.
3b. Player fires a rocket and the rocket is rendered 100ms in the past. Well the collisions are accurate now and no rewinding needs to be done, but this makes the game feel a little less responsive.
3c. Player fires a rocket and the rocket is rendered in the present. The server rewinds everyone to check for rocket hits. This is great for the player, but the other guy getting hit has the short end of the stick because the rocket is being compared against his/her past self. He/She could very well dodge out of the way, but his/her view of the rocket isn’t right because he/she is going to get moved back in time. So, to deal with this for the other player. We accelerate the rocket 100ms along its flight path to the other player. This has some other downsides. The rocket on the other player’s game wont look quite right; its ignition will be rushed and it would “stick” in the ground for 100ms before it detonates accurately.

This “players viewing everyone else in the past” thing is messing us up; so what if we just skipped the interpolation and rendered everyone in the present via extrapolation?
3d. Player fires a rocket and everything is done in the present.

Well the game becomes more jerky, since players who change direction will move quicker than usual. But, the server no longer needs to rewind the game to check hits. The other nice bit is that rocket’s don’t have to be fake-accelerated on the other player’s game and won’t appear to stick in the ground before detonating.

I think that for the simplicity and functionality, 3b. is a very solid choice. The only real downside is that there is a slight delay when firing the rocket. The main reason I would consider implementing 3c is that the game would also be playable on a local machine in split-screen fashion. Since there’s no need for lag compensation, the rockets would not be delayed upon firing. This would make the game play differently in local mode and online mode, an inconsistency worth avoiding. Therefor I would think to try 3c. and fiddle with the delay to see how short of a time I could get away with.