How did shooting simulation in FPS evolve?
First-person shooter(FPS)Wolfenstein 3DHas been one of the major genres in gaming since its launch. The game itself called FPS has evolved through improvements in graphics and e-sports, but software engineer Tristan Jung talks about how simulation of the laws of physics in shooting has evolved.
Gamasutra: Tristan Jung's Blog-How Do Bullets Work in Video Games?
◆ Hit scan
In the 1990s, shortly after FPS appeared,Ray castingThe mainstream was to render the 3D environment using a method called, and determine the intersection of the objects.
The following image is an example of a 3D map generated by ray casting (click to play GIF animation: about 229KB)
And the idea of "hit scan" was born from the idea of "what if a muzzle emits a bullet-like bullet?"
In hit scan, when a player fires a bullet, the physics engine works as follows:
1: Identify the direction the gun is pointing.
2: When fired, it emits light rays from the muzzle to the specified range.
3: Use ray casting to determine if a ray (wall, enemy, etc.) has crossed an object (trajectory).
4: The ray intersects with the object, and the target determined to be "hit" is calculated such as being broken or damaged.
In the image below, if point A is a gun, emit light to point B. If the ray intersects the cube, it is considered a collision.
Hit scanning is a simple technique, but can be applied to a variety of attack patterns. For example, if a ray penetrates an object, you can destroy multiple objects at the same time, or you can set the maximum range of the ray to infinity and fire a laser that lasts forever until it hits something.
Another advantage of ray casting is that processing is fast. The server only needs to track the direction of the light beam, so the processing required when multiple users synchronize is minimized.
As a result, Jung says that many games in FPS use hit scans. "Wolfenstein 3D" or "DOOM, And many games still use hit scans as of 2019.Overwatch"Or"Call of DutyThe guns that appear in "" also employ the technique of hit scanning.
Below is a scene where hit scan is used in Wolfenstein 3D (click to play GIF animation: about 204 KB)
The scenes used in Overwatch are as follows (click to play GIF animation: about 2.28MB)
The disadvantage of hit scans is that the bullets reach their destination in an instant because the rays emitted from the gun have infinite travel speed. In other words, if there is a target on the line of fire, the bullet will hit the target at the moment of firing even if it is hundreds of kilometers away. In addition, because the trajectory of the hit scan is straight, once the bullet is fired, wind pressure, gravity, etc. do not affect the bullet.
Hit scan systems tend to be used in casual FPS for beginners. According to Jung, hit-scanning cannot create a satisfactory experience if the game is designed to create an "immersive and realistic" shooting experience.
Projectile is a method of generating all bullets and projectiles fired from weapons as new physical objects. The physics engine can calculate the mass and speed of the bullet, the wind pressure, friction, gravity, temperature, etc. that the bullet receives after firing. With the emergence of the Projectile, weapons with non-linear trajectories can be reproduced, and weapons such as grenades and rockets have appeared.
The following is "Mac Spain 3", where the trajectory changes according to the movement of the character etc. (Click to play GIF animation: about 7.1 MB)
The following is a scene in which the trajectory bouncing in “Superhot” is drawn (click to play GIF animation: about 3.47 MB)
Projectiles are more computationally intensive than hit scans due to the increased computation of the physics engine. On the server side, it is necessary to confirm that all objects are synchronized and resolve inconsistencies and conflicts between players so that there is no lag between players on the same server It becomes.
Many people tend to think of projectiles as a relatively new method, but in fact, Jung said projectiles were born before hit scanning. Since the 1970s, before FPS was born,Asteroids"Or"Space invaders, "GalaxianWas used in arcade shooting games.
The following is a scene in which a projectile is incorporated in Asteroids (click to play GIF animation: about 4.97 MB)
◆ Hybrid system
According to Jung, at the time of writing, most game engines incorporate both hit scan and projectile. "HALO"Or"Grand Theft AutoGames such as the "" series have weapons that support both hit scanning and projectiles.
The following is a scene where the hybrid system is used in "HALO" (click to play GIF animation: about 3.68 MB)
Game developers combined the two techniques to create more realistic gun movements to cover the weaknesses of the hit scan and projectile systems. For example, to correct for trajectory shifts, a ray is drawn on each trajectory, and the physics engine determines if the rays intersect and collide in the air.
Also,"Sniper EliteIn the series, after pulling the trigger, the physics engine uses hit scans to determine if the bullet is approaching a detectable target, and if so, changes the trajectory. We adopt a system that fires bullets. (Click to play GIF animation: about 1.93MB)
"It's interesting that the basic drawing of bullets in the game focuses on small improvements, not big changes," said Jung. In the future, Jung predicts that shooting simulations will evolve in a way that adds features to the hybrid approach and increases the CPU power, etc., so that the shooting experience can be more realistic.