3

I've started developing a small multiplayer racing game, obviously we're using all the player prediction, dead reckoninng and lag compensation techniques that Half Life, Quake and Unreal use - however we plan on having dozens of AI cars in the game as well.

Initially we decided to simply send a random seed to all clients and they will calculate AI positions, etc - however, we've reached the following problem:

  1. All clients receive a seed to run AI cars
  2. Clients only receive movement updates for players within their line of sight
  3. Player A hits an NPC car
  4. Player B enters player A's frame

Now since player B didn't receive player A's movement, he'll assume the AI car is still moving as it should, and wouldn't calculate in the fact that player A hit one of those cars...

So long story short - how can you synchronize AI units that were affected by players?

Laymain
  • 1,450
  • 18
  • 25
Ron Rejwan
  • 73
  • 6

1 Answers1

1

Presumably, your server is aware of any collisions. In that case, simply notify all your clients of collision results--essentially re-seeding the AI on the clients, at the point of the collision, with the new directions, velocities, RNG seeds, etc.

TreDubZedd
  • 2,571
  • 1
  • 15
  • 20