Hitscan

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

A hitscan in computer games, most commonly in first person shooters, is where the programming system determines where the gun/ object is pointing, casts out a ray in that direction when shot, for a certain range programmed into the system, and see if that ray comes in contact with any object in the line of fire.

A projectile weapon which uses unmodified hitscan information to dictate whether or not it has hit its target is often called a hitscan weapon. Deploying the weapon calls the hitscan function, and if an object is detected in the path of the projectile, 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.

You can modify the hitscan method 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] As another example, the sub machine 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[edit]

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). While a 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.

It's also quick, which means that servers go down less often due to less stress on the server.[1]

Disadvantages[edit]

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's hard to change up 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 someone at a full sprint 200 yards away and aiming right on them and still hitting them. If it were a realistic shooting engine you would have to lead that target but with hitscan you don't. We can't have things like projectile ballistics or projectile motion in our hitscan games. There are hybrid systems that use both hitscan and projectile ballistics but not at the same time. Some games detect with the hitscan method, then provide an animation with projectile ballistics.[1]

Projectiles can be added into a hitscan game with every bullet is a tracer programming, but this can be problematical because characters in game will react before the tracer gets to them.[2] Hitscan would also let pro players dominate just by simply being good at aiming. [3]


Here is a link to a youtube video to help further explain the hitscan programming in games. [4]


For more information on how bullets move while not in hitscan and when given ballistics please see Projectile motion

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.

Hitscan Game Examples[edit]

  • Wolfenstein 3D.
  • Doom
  • Quake 1 and 2
  • Medal of Honor
  • GoldenEye
  • Perfect Dark
  • Deus Ex
  • Far Cry
  • Call of Duty- except in mission "One shot one kill"
  • Turok 1, 2, and 3
  • Killer7- Synth weapons
  • Fallout 3- Not in VATS
  • Halo- Most human weapons
  • Unreal- Gunpowder weapons

And so on. The complete list is on this link provided. https://tvtropes.org/pmwiki/pmwiki.php/Main/HitScan

References[edit]

  1. ^ a b c Jung, Tristan (2018-07-14). "How Do Bullets Work in Video Games? - Tristan Jung". Medium. Retrieved 2019-07-18.
  2. ^ "Hitscan". TV Tropes. Retrieved 2019-07-18.
  3. ^ "Hit Scan vs. Projectiles in FPS Games | Aiming.Pro". aiming.pro. Retrieved 2019-07-18.
  4. ^ gameranx (2016-03-26), How Do Bullets Work In Video Games?, retrieved 2019-07-18