Shooters have been one of the biggest and most common genres in the gaming industry, since the success of Wolfenstein 3D almost 30 years ago. Since then, the shooter genre has been constantly changing, with all the graphical updates, better physics, and even an Esports scene. The core mechanic of the genre, the shooting mechanics, have also evolved. There are games that could mimic the real thing super well. Below are some of the methods that games used for bullets.

1 – Hitscan

In the past, many games used a technique named raycasting to render the 3D assets into 2D images displayed on your screen – that technique required the engine to ascertain the first item intersected by a ray. Hitscan was created when the same thing was applied to the muzzle of a gun.

1 57b3uqvhpyihne 7vu514w
An example of Raycasting

This is how a Hitscan weapon would work – when a bullet was shot, the engine will:

Check the direction that the gun is pointing and cast a ray from the muzzle of the gun. Use raycasting afterward to see if it hits anything. If the object was determined to be hit – the engine would notify the target with a message so that the damage calculation would start.

1 Pcvfe9nueqhzxecc0l1hkw
A Hitscan attempt with the ray and the target

Hitscan is simple and could be further modified to add various new elements. For example, a rail gun would just be a normal gun, but with the ray continues past after the first thing it hit. Bullet drop would be a slightly downward ray. A laser would be a ray without any range limit. Bouncing bullets can also be achieved using raycasting as well.

1 Uoiqsmrbf Cmpszmagftcq
Overwatch's Soldier 47 using a Hitscan weapon

The best part about this method is that its very fast. No real bullets were fired from the gun, so no processing time was lost. It is also great in syncing multiple clients, as the server only needs to store the ray’s direction. Recoil is pretty simple to add. Hitscan was very popular back then and even now, there are a great many games still use it. Various characters from Overwatch have Hitscan weapons, along with many guns in Call of Duty.

What’s the weakness of this method?

Rays are too fast – once fired, they reach the target instantly. The lack of travel time is rather unrealistic. Adding a slight delay wouldn’t really change the outcome, as it would sometimes result in a “homing bullet”. Secondly, it is impossible to change the direction of a straight ray after it has been fired. Which means you cannot add any additional factors such as wind or gravity.

1 Z2ee Tqdu8ewkb1foioxlq
Hitscan looks pretty weird sometimes

Hitscan is very popular in casual shooters, as the method simplifies how guns work – you can just point at things and press the button. What about those games which aim to create a more immersive experience? An alternate method called “Projectile Ballistics” is used.

2 - Projectile Ballistics

This method would spawn a real physical object every time a bullet is shot. The projectile would have its own velocity, mass, and hitbox, which would be tracked by the engine separately. Projectile Ballistics would shine if your main goal is realism. Since each bullet is their own thing, you can factor in various side elements such as gravity, wind, friction and even temperature now. With this method, other weapons with slow-moving projectiles like a rocket or grenade launcher would be available to the players as well.

1 Ld4uyzcg11bo3nap7va2rw
Bullet time in Max Payne

Since bullets in this system are their own objects, you can also add several more features to your game like bullet-time (slowing down the game's speed so that you can see even the bullets firing out of your guns), travel time and delayed explosions. Bullet travel time is pretty important as it is one of the biggest factors for realism in most shooters.

1 Frzjtrwzp6vtwcavr6egww
There are characters in Overwatch who uses projectiles

This method is rather taxing to the system, however, with various new calculations factored in. Both your own system and the server would have to work a lot more to make sure all entities are in sync with each other. Connection problems would affect the quality of the game severely. There are ways to get more performance while still using projectiles: You can spawn all the objects needed before the game happen then “teleport” them in to do all the work. The system won’t have to create new objects over and over – which leads to a drop in memory cost.

3 - Hybrid System

Most modern game engines are able to use both Hitscan and Projectile Ballistics. This would give the developers the flexibility to add even more types of weapons. You can have various weapons with different properties in the same game.

1 Xpfvkncyq6qdvcxyx1ltrw
The Assault Rifle in Halo is a Hitscan weapon

Two different techniques can also be used to cover each other’s weaknesses. To minimize the issues that were caused by connection problems such as object phasing, each bullet can be used to draw a ray after every tick of the engine so that it could recognize the phasing problem and react accordingly.

1 2vnkvjcf9fzosjs62yvmiq
The Needler, however, is a projectile weapon

Hitscan can also be used to enhance existing features in-game. The slow-motion showcases in the Sniper Elite series is a great example, as the engine uses hitscan to check if the bullet is going to be close enough to the target to trigger the effect. If all conditions are met, the gun would execute the action with projectile ballistics.

1 V 4wmtvpgufz77sjzd7lkq
The slow-motion effect was triggered by hitscan

Overall, the ways bullets work in video games are pretty simple, with developers focusing more on making smaller adjustments instead of implementing massive changes. The hybrid approach would certainly be the norm in the future, as it provides the developer with more flexibility. Currently, the computing power of devices can easily handle most types of ballistic projectiles.

Interested in more of our posts related to video games? Please check out this article for the upcoming release of Resident Evil 3 Remake.