开发者

Synchronizing AI NPCs on a multiplayer game

开发者 https://www.devze.com 2023-01-29 10:13 出处:网络
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 - howev

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 playe开发者_JS百科r A hit one of those cars...

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消