Thursday, September 28, 2017

collision detection - How are trajectories calculated and transmitted to other players, in multiplayer?


I play a lot of "Call of Duty", and can see tracers for gunfire, missiles, care packages falling from helicopters etc. There is a lot of activity. I am curious to know the algorithm one would use, at a high level, to manage all this action when you have 20 people on a map shooting each other to death.


This question touches on the subject, but doesn't ask for a more in-depth answer as to how you the developers go about calculating and transmitting movement and collision detection for projectiles, be it missles, bullets, or any other object that is flying through the air in real-time.


How are trajectories calculated and transmitted to other players, in multiplayer?



Answer



It depends on how important object for gameplay and how it working.


Generally projectiles like missles move along a predictible trajectory so server can spawn a new object, set its position, direction, speed and transmit data about new projectile to clients. Client-side code will simulate movements of a projectile using this data. If projectile hit something important (world geometry, other player or something else) server process this and inform clients about this.


Human controlled objects require different approach. Since it cannot be fully predicted on client-side, server frequently send updates about position and direction to clients. Often this data include speed of object to allow client to interpolate and/or extrapolate movements of object between updates from server.



No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...