Vectors in First Person Shooter Games

So there was a time when I delved a bit into game development. One thing I learned was how the game would know you hit someone with a bullet you fired, or if you were hit by an enemies bullet.

It seemed impractical for the game to literally create every bullet fired and track its velocity, speed, how gravity would affect it, etc. Especially in bigger games where you would have 30+ people all firing a lot of bullets in a short amount of time.

What actually happens is when the player fires his gun, the game draws an imaginary vector starting from the tip of the gun and extending outwards. The first object to touch this vector is what the bullet hits, whether it be a wall, or a player.

Please refer to my well rendered diagram as an example. Here you fire a bullet. The game then draws the vector and sees that the first thing it hits is the enemy player followed by the wall. The game then registers the enemy player as being “hit”.vectors