Hitscan

Last updated

Hitscan in video game design, most commonly in first-person shooters, is a type of hit registration system that determines whether an object has been hit or not simply by scanning if the item used was aimed directly at its target and then applies the effects of the item (usually damage) instantly. A weapon, for example, does not launch a projectile the player needs to lead, damage is applied as soon as the player's crosshair is on a target and the fire button is pressed. Internally, this is most commonly done by simulating a ray from the origin of the item along the trajectory of the "projectile" and simply scanning for any objects touching the ray. Games might still show a visual of a projectile although it technically has no effect. In contrast, a projectile-based weapon would launch an actual projectile object that moves through the virtual space at a certain speed and will apply damage only once it has actually touched ("hit") a target.

Contents

A projectile weapon which uses unmodified hitscan information to dictate whether or not it has hit its target is often called a hitscan weapon. Shooting the weapon calls the hitscan function, and if an object is detected in the projectile's path, a hit is registered. Once it's determined if something was hit or not, the system will then give a damage output based on where the ray hit the object. Since the effect is immediate, the projectiles effectively travel at infinite speed and have a linear or otherwise simple trajectory—a practical approximation of a bullet's speed and accuracy over short distances.

The hitscan method is modifiable by making some surfaces reflective, making the hitscan rays go on forever with no stop, or able to penetrate multiple objects at the same time in the same line. To improve the realism, programmers may use hitscan functions in slightly different ways; for example, applying a random perturbation to the calculated path to simulate inaccuracy. [1] [ self-published source ] A simplified version of this occurs in the first-person shooter DOOM ; when the player holds down the fire button with the pistol, it fires inaccurately from the second shot. As another example, the submachine gun in Half-Life 2 calls a hitscan function in the middle of a 'blazing gun' animation, creating a small amount of lag between weapon deployment and the hitting of the target to better approximate real-life ballistics.

Advantages

The primary advantage is the simplicity of the simulation, which uses relatively simple mathematics to calculate hits. Although bullets do not move at infinite speed via perfectly straight trajectories, they move fast enough that a hitscan solution is normally a reasonable approximation. It leaves the question of where a weapon has hit to just one function, streamlining the programming of weapons.

In terms of game design, it readily ties cause (the player presses a 'fire' button, executing a hitscan function) to effect (the hitscan returns a result, the player sees the weapon's effect at that location). As a heavily simplified model of real world ballistics, it makes games more accessible in that there is no need to aim slightly ahead of a moving target in order to compensate for the time it takes for the projectile to reach it. Although less realistic, this model requires no understanding of real weapon handling in order to play the game, and reinforces the intuitive understanding that whatever the reticle is placed over will be hit.

Disadvantages

Visually representing the firing effect of a hitscan weapon can be difficult: since the weapon hits its target instantaneously, any bullet or projectile that comes from the weapon is merely a 'ghost', and where it lands may not necessarily represent its actual hit. In particular, a projectile bullet effect will always lag behind the effect of its hit, a problem which can be compounded by Internet latency in online multiplayer gaming.

It is hard to change the path of a projectile once it leaves the gun with things such as wind and gravity. Since it is shooting out a beam that hits the target almost immediately, there can be no real changes to the path. An example of this would be shooting at a high speed object over a long distance. Under hitscan, a user aiming right on the target would hit it. However, if it were a realistic shooting engine, one would have to lead that target. It is impossible to have projectile ballistics or projectile motion with hitscan projectiles. There are games that use both hitscan and projectile ballistics, but not at the same time. Alternatively, some games may detect with a hitscan method and then provide an animation with projectile ballistics. [1] [ self-published source ]

With advances in processing and Internet bandwidth, it has become more practical to simulate the ballistic nature of real-world firearms in real-time games by using a more realistic "projectile" model, spawning bullets as actual game objects with mass and velocity, and continuously simulating them until they reach their target.

Related Research Articles

<span class="mw-page-title-main">Bullet</span> Projectile propelled by a firearm, sling, or air gun

A bullet is a kinetic projectile, a component of firearm ammunition that is shot from a gun barrel. They are made of a variety of materials, such as copper, lead, steel, polymer, rubber and even wax; and are made in various shapes and constructions, including specialized functions such as hunting, target shooting, training, and combat. Bullets are often tapered, making them more aerodynamic. Bullet size is expressed by weight and diameter in both imperial and metric measurement systems. Bullets do not normally contain explosives but strike or damage the intended target by transferring kinetic energy upon impact and penetration.

<span class="mw-page-title-main">Hollow-point bullet</span> Empty tipped expanding bullet used for controlled penetration of solid objects

A hollow-point bullet is a type of expanding bullet which expands on impact with a soft target, transferring more or all of the projectile's energy into the target over a shorter distance.

<span class="mw-page-title-main">Tactical shooter</span> Video game genre

A tactical shooter is a sub-genre of first- and third-person shooters, associated with using strategy, planning, and tactics in gameplay, as well as the realistic simulations of ballistics, firearm mechanics, physics, stamina, and low time to kill. Dating back to strategy games from the late 1980s, the genre first rose to prominence in the late 1990s with the releases of several well-received tactical shooters. The popularity of the genre saw a decline in the late 2000s as fast-paced "arcade"-like action shooters rose to prominence, it has seen a revitalization since the mid-2010s with the successful releases of several modern tactical shooters.

<span class="mw-page-title-main">Projectile</span> Object propelled through the air

A projectile is an object that is propelled by the application of an external force and then moves freely under the influence of gravity and air resistance. Although any objects in motion through space are projectiles, they are commonly found in warfare and sports.

<span class="mw-page-title-main">Terminal ballistics</span> Projectiles behavior after reaching their targets

Terminal ballistics is a sub-field of ballistics concerned with the behavior and effects of a projectile when it hits and transfers its energy to a target.

From the viewpoint of physics, a firearm, as for most weapons, is a system for delivering maximum destructive energy to the target with minimum delivery of energy on the shooter. The momentum delivered to the target, however, cannot be any more than that on the shooter. This is due to conservation of momentum, which dictates that the momentum imparted to the bullet is equal and opposite to that imparted to the gun-shooter system.

<span class="mw-page-title-main">Ballistics</span> Science of the motion of projectiles

Ballistics is the field of mechanics concerned with the launching, flight behaviour and impact effects of projectiles, especially ranged weapon munitions such as bullets, unguided bombs, rockets or the like; the science or art of designing and accelerating projectiles so as to achieve a desired performance.

<span class="mw-page-title-main">Ricochet</span> Rebound of a projectile off a surface

A ricochet is a rebound, bounce, or skip off a surface, particularly in the case of a projectile. Most ricochets are caused by accident and while the force of the deflection decelerates the projectile, it can still be energetic and almost as dangerous as before the deflection. The possibility of ricochet is one of the reasons for the common firearms safety rule "Never shoot a bullet at a flat, hard surface." Ricochets can occur with any caliber, but short or round ricocheting bullets may not produce the audible whine caused by tumbling irregular shapes. Ricochets are a hazard of shooting because, for as long as they retain sufficient velocity, ricocheting bullets or bullet fragments may cause collateral damage to animals, objects, or even the person who fired the shot.

<span class="mw-page-title-main">External ballistics</span> Behavior of projectiles in flight

External ballistics or exterior ballistics is the part of ballistics that deals with the behavior of a projectile in flight. The projectile may be powered or un-powered, guided or unguided, spin or fin stabilized, flying through an atmosphere or in the vacuum of space, but most certainly flying under the influence of a gravitational field.

<span class="mw-page-title-main">Ballistic gelatin</span> Testing medium used in ballistics

Ballistic gelatin is a testing medium designed to simulate the effects of bullet wounds in animal muscle tissue. It was developed and improved by Martin Fackler and others in the field of wound ballistics. It is calibrated to match pig muscle, which is ballistically similar to human muscle tissue.

A smart bullet is a bullet that is able to do something other than simply follow its given trajectory, such as turning, changing speed or sending data. Such a projectile may be fired from a precision-guided firearm capable of programming its behavior. It is a miniaturized type of precision-guided munition.

<span class="mw-page-title-main">Transitional ballistics</span>

Transitional ballistics, also known as intermediate ballistics, is the study of a projectile's behavior from the time it leaves the muzzle until the pressure behind the projectile is equalized, so it lies between internal ballistics and external ballistics.

<span class="mw-page-title-main">Ballistic coefficient</span> Physical measure of overcoming air resistance

In ballistics, the ballistic coefficient of a body is a measure of its ability to overcome air resistance in flight. It is inversely proportional to the negative acceleration: a high number indicates a low negative acceleration—the drag on the body is small in proportion to its mass. BC can be expressed with the units kilograms per square meter (kg/m2) or pounds per square inch (lb/in2).

<span class="mw-page-title-main">Kill house</span>

A kill house or shoot house is a live ammunition small arms shooting range used to train military and law enforcement personnel for close contact engagements in urban combat environments. Kill houses are designed to mimic residential, commercial and industrial spaces and are used to acquaint personnel with techniques to infiltrate structures and the methods used to overwhelm the target(s) in the quickest and most efficient manner. The construction of one of these facilities can vary in material and cost depending on the needs and the resources available. Like any shooting range, there are rules that must be followed to ensure a safe kill house training session.

Computer animation physics or game physics are laws of physics as they are defined within a simulation or video game, and the programming logic used to implement these laws. Game physics vary greatly in their degree of similarity to real-world physics. Sometimes, the physics of a game may be designed to mimic the physics of the real world as accurately as is feasible, in order to appear realistic to the player or observer. In other cases, games may intentionally deviate from actual physics for gameplay purposes. Common examples in platform games include the ability to start moving horizontally or change direction in mid-air and the double jump ability found in some games. Setting the values of physical parameters, such as the amount of gravity present, is also a part of defining the game physics of a particular game.

<i>B-Wings</i> 1984 video game

B-Wings is a vertically scrolling shooter first released as an arcade video game by Data East in 1984. A version was released in 1986 for the Family Computer. It was Data East's very first home release for the console. The Family Computer version is notable for its inclusion in many unofficial Famiclone multicarts.

The meplat is the technical term for the flat or open tip on the nose of a bullet. The shape of the meplat is important in determining how the bullet moves through the air. In particular the size and shape of the meplat has a significant effect on the ballistic coefficient of a bullet.

The following are terms related to firearms and ammunition topics.

Deflection shooting is a technique of shooting ahead of a moving target, also known as leading the target, so that the projectile will "intercept" and collide with the target at a predicted point. This technique is necessary only when the target will have significantly displaced its position during the time the projectile would take to reach the target, which can become the case over very long distances, due to fast moving targets, or while using relatively slow projectiles.

<span class="mw-page-title-main">Kinetic energy weapon</span> Weapon based solely on a projectiles kinetic energy

A kinetic energy weapon is a projectile weapon based solely on a projectile's kinetic energy to inflict damage to a target, instead of using any explosive, incendiary/thermal, chemical or radiological payload. All kinetic weapons work by attaining a high flight speed — generally supersonic or even up to hypervelocity — and collide with their targets, converting its kinetic energy and relative impulse into destructive shock waves, heat and cavitation. In kinetic weapons with unpowered flight, the muzzle velocity or launch velocity often determines the effective range and potential damage of the kinetic projectile.

References

  1. 1 2 Jung, Tristan (2018-07-14). "How Do Bullets Work in Video Games? - Tristan Jung". Medium. Retrieved 2019-07-18.[ user-generated source ]