Bullets come from Guns
Guns are an inescapable part of video games. In fact, they feature promptly in movies, TV shows comic books and pretty much every type of media going.
No matter what your stance is. They could be a tool to introduce action, suspense, drama and intensity, especially, into a video game.
Ever since 1992’s Wolfenstein 3D – the grandfather of the FPS genre, developers have tried to create weapons that balance realism, satisfaction and various other considerations with what the technology at the time could achieve.
Now we all know how frequent the sight of a firearm is in video games.
But how do they actually work?
How did guns and bullet physics change between games? How does the bullet go from one place to another?
The most common type of shooter mechanics is hit scan. This technique uses technology similar to the one that first allowed 3D games to be developed.
Ray Casting was used to render a three-dimensional scene into a two-dimensional image that could be displayed on your screen.
Rays would be traced from the virtual eye of the player through each pixel in the virtual space.
Things like the colour and light of the object visible are calculated through it to ensure it rendered correctly.
Implementation in computer
In the game world, the algorithm was made up of a bunch of complex mathematics and geometry. But the calculations could be done relatively quickly which was perfect for first-person shooter games. Especially when resources computing, power was fairly limited.
Take Wolfenstein 3D, for example, it’s built from a square based grid with walls being at a uniform height. To render the world onto the screen a rate is traced for each column of visible pixels.
The algorithm can then scale each object to the correct size, depending on how long the ray takes to intersect or hit each object.
Hitscan weapons work in a very similar way to ray casting. Instead of a wide array originating from the player’s eye, a more narrow one will be cast from the barrel of a weapon being fired.
On the most basic level :
- It will determine where a weapon is being pointed
- Use that information to generate a ray
- Then check if a ray is intersecting with something
- It will determine if that object is being hit
On a hit, the game engine will then enact the desired result rendering damage in the environment or to an enemy. It will also initialize the correct sound effects logic.
What happens after a gunshot is fired?
The cause and effect of the player clicking their mouse or pulling a trigger and the bullet hitting its target all takes place instantly.
And while that’s obviously not how real-world weapons work, game designers use clever lighting graphics and sounds to make the gunfire look and feel as realistic and satisfying as possible.
Post-development of the algorithm
Bullets bouncing off the ground
After game designers have nailed these fundamentals, they can go on to add things like bullets ricocheting by programming rays to bounce off surfaces or adding bullet penetration by allowing the ray to continue travelling through each target up to a set distance.
Another method used widely
Another method to mimic realism was to add variables to the angle or placement of the ray. It would give a sense of bullet spread.
Games using this method
From Wolfenstein 3D, Doom and Goldeneyesome more modern games like Call of Duty, Overwatch and Counter-Strike most weapons in FPS games use this method of implementing their gunfire.
Hit-scan games are easier to start
Hit-scan games tend to be a little more accessible as you’re not asking someone who just picks up a game to start learning things like bullet drop or lead times. The learning curve is a little more shallow but it does mean you get instant gratification from utilizing your virtual armoury.
New object for each bullet ?
But there’s also another method that’s a little more grounded in realism, many shooters used to create a more immersive experience.
Games that want their simulated weapons to be as close as possible to the real world counterparts are more likely to implement a physical projectile system rather than computing shots fired with the detected intersecting rays.
How it works?
A new object is spawned with each round fired from the weapon as the bullets exist as a real entity in the game world.
It means that they can have their own values and behaviour. Each shot has its own mass and velocity with a potential of in-game systems influencing each individual bullet.
Things taken into consideration
Things like gravity and wind can start to affect the flight path of your lethal payload with this system. But it comes at the cost of requiring extra computing power since each object will have its own behaviour and logic applied to it.
Disadvantages of this method
The game engine, as well as the game client and any multiplayer servers, must make use of both raw computing speed and clever workarounds to ensure the game experience remains consistent between each player.
Read More : Mystery Behind Game Load Time?
Games that use this method will tend to have a slightly steeper learning curve and the highest skill ceiling. Because obviously, they need to take into consideration things like bullet drop and lead time.
Most widely used technique
Of course depending on how far they choose to engage two of the most popular titles that predominately use physical instances of bullets are PUBG and the Battlefield series games.
They boast of more realistic combat experience and two franchises that I personally really enjoy but even I can admit they are the easiest to get into for first-time players.
Game designers don’t stick to one technique
But game designers don’t have to stick with one technique or the other. In fact, it’s pretty commonplace to have both techniques merge together into the same game.
Take Fortnite for example:
For the most part, the weapons are hit-scan which lends itself to the faster paced close combat gameplay experience . But then their sniper rifles use physical projectile system.
Read More :How does Game actually load on your screen?
Player reward system for firing bullet
Players that take the time to consider bullet drop and compensate for a moving target are rewarded with a high damage attack from a potentially safe range.
It’s also extremely common to see games that have weapons like rocket launchers and bows use a physics system for those while the rest of the arsenal will be hit-scan.
Overwatch is another example of this combined system.
Soldier 76, in particular, his assault rifle is hit-scan. But then the helix Rocky he can also fire is physical.
Read More : The Trending Mobile Games of 2018!
Mechanics of bullet chosen by the developer
But the mechanic a developer chooses will depend on its audience, the genre of its game and the technical restrictions it’s under.
But what’s most interesting is that while shooters look and play so vastly different from those, from the PS1 and 64 and even MS-DOS, they still have very similar central mechanics and ideas at their core.
Improved over time
These mechanics that have been refined and improved over time of course but fundamentally they are still very much grounded in the first iterations of these ideas.
But I suppose you know what they say:
If it ain’t broke don’t fix it
But for now, at least you should have a better understanding of how the enemy team keeps mowing you down but would you infer the instant gratification of hit-scan or taking the time to learn a physics system of a ballistic based FPS.
Let me know your thoughts in the comments section
Thank You for reading.
Please be sure to Like, comment and subscribe to Delhite Blog to get notified whenever we post new content.