   Handling collision events between 2 networked objects
  Hi,I have consumed all the material I can find on networked physics simulation, and have implemented similar to how the unreal engine works with replication of state between client and server with a lockstep / predicted model for player entities.This works nicely, even over a simulated lossy laggy connection.One topic that I have not been able to find much info on is the collision of networked entities where position information for one of the entities is derived from a remote client's owned state and therefore is non-deterministic.So the situation is this:We are workin in a 2d space where all entities are circular for simplicity.There are 2 players in the game which are represented by 2 circles a distance apart.Player 1 fires a projectile toward player 2. The projectile moves toward player 2 which may or may not move out of the way. Server determines a collision has happened and can update the state of each entity accordingly.The state of the projectile is deterministic to both Players, but to Player 1, Player 2's position is constantly changing via updates from the server and may vary slightly from its actual position at the time of collision.At the same time the client of 'PLAYER 1' is faced with 1 of 2 situations:1. The client state is accurate to the server, and can predict the collision correctly2. The client state is wrong and the collision never happenedI want the collision to have a particle effect on collide, I am wondering if I should:-Wait for the server to tell the client  via some sort of event that a collision has happened before applying effects?-Simulate the expected collision with effects and wait for state corrections from server?The second could get nasty as the client may predict hits that dont actually hit, and vice versa. Then I may even have to go and find an effect in progress and remove it.If anyone has some insight into how current games solve this problem would be greatly appreciated.Thanks,Speno   
  I don't think anyone solved it. And I'm not sure you'll ever can. Without determinism that is. And a full deterministic system means a lot of extra latency (since you need inputs from everyone). Afaik, Counterstrike and such do fake blood splats and bullet holes in walls on the clients. However, the lag compensation is pretty good, but not perfect ('bullet dodging' by moving rapidly left to right). all in all, it depends what looks good for your game. Either do a fake 'hit' effect, or do nothing until you receive the confirmation. For bullets and such, I'd just do a fake hit so it looks good and responsive, albeit not 100% accurate, and hope the lag compensation is precise enough on the server.   ;  Yeah in my last game we did "fake hits" as well (if your client thinks the bullet hit, spawn the impact particle effect immediately, don't wait for confirmation).  Responsiveness > 100% accuracy imho If your status updates for other players (like shield, health, armor, etc... values) are separate from the bullet impact confirmation, there will always be slight time lapse between the bullet actually hitting on your client and their health bar going down.   ;  One very popular method is to show everyone forward extrapolated ("predicted,") and show the player what he would expect to happen given his actions (muzzle fire, bullet holes, perhaps blood splats, etc). The authoritative state, however (in this case hitpoints,) are updated on the server, so the targeted player won't actually be injured/die until that decision has been made.The question is where to put the authority. On a trusted computing environment, like the Xbox or Nintendo DS, you can make a determination on the player client that he hit someone else, and send a "I hit you" message, and deduct hitpoints directly. In a non-trusted environment, like the PC, you have to make that determination on the server, which makes things more complex -- but you can still send a request from the player, saying "I think I hit," and let the server figure out whether that is true or not. Or just run the full simulation on the server, given the inputs from all players, and determine the actual outcome (change in hitpoints) based on that simulation. Which means high-lag players need to aim in front of other players, a la Quake 2.;  Thanks for the info guys,My server will be authoritive over everything except player input, so yes I will simulate state changes like hp on server.I will give the "fake hit" scenario a go, and try to tune my lag compensation to minimise this happening incorrectly.Cheers,Speno   