Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I play alot of COD4. And can see tracers for gunfire, missles, care packages fall from helicopters etc.

There is alot of activity. I am curious to know the algorithm (at a high level) that manages 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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Ahh.. so you just transmit starting point and trajectory to all co-op players that need to see it. The local console just renders based on that instruction. So, what if the effect cannot be seen in the players viewport, but could be heard, would that be a different transmission to render sound depending on distance from the effect? Or would it just get calculated by the console getting the transmission about the bullet/missile and then determining that you can't see it but you need to hear it ? –  giulio Jun 15 '11 at 5:57
2  
@giulio: The server would need to be aware of the proximity for sounds (such as explosions), and inform all clients within that proximity. Based on distance, the client can calculate the appropriate volume level to use when generating the sound for the explosion. –  Randolf Richardson Jun 15 '11 at 7:00
    
@giulio: The trajectory is usually transmitted to all players (whether they see it or not), because it is usually client's responsibility to calculate visibility (as it would require too much resources from the server). The obvious weakness in this is that all kinds of wall hacks are possible. –  Cloudanger Jun 20 '11 at 13:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.