Game Development Reference
Each weapon has a characteristic muzzle velocity: the speed at which the projec-
tile is emitted from the weapon. This will be very fast for a laser-bolt and probably
considerably slower for a fireball. For each weapon the muzzle velocity used in the
game is unlikely to be the same as its real-world equivalent.
S ETTING P ROJECTILE P ROPERTIES
The muzzle velocity for the slowest real-world guns is in the order of 250 m/s, whereas
tank rounds designed to penetrate armor plate by their sheer speed can move at
1,800 m/s. The muzzle velocity of an energy weapon, such as a laser, would be the
speed of light: 300,000,000 m/s. Even for relatively large game levels, any of these val-
ues is far too high. A level that represents a square kilometer is huge by the standard
of modern games: clearly a bullet that can cross this in half a second would be prac-
tically invisible to the player. If this is the aim, then it is better not to use a physics
simulation, but to simply cast a ray through the level the instant that the weapon is
shot and check to see whether it collides with the target.
Instead, if we want the projectile's motion to be visible, we use muzzle velocities
that are in the region of 5 to 25 m/s for a human-scale game. (If your game represents
half a continent, and each unit is the size of a city, then it would be correspondingly
larger.) This causes two consequences that we have to cope with.
First, the mass of the particle should be larger than in real life, especially if you are
working with the full physics engine later in this topic and you want impacts to look
impressive (being able to shoot a crate and topple it over, for example). The effect
that a projectile has when it impacts depends on both its mass and its velocity: if we
drop the velocity, we should increase the mass to compensate. The equation that links
energy, mass, and speed is
where e is the energy and s is the speed of the projectile (this equation doesn't work
with vectors, so we can't use velocity). If we want to keep the same energy, we can
work out the change in mass for a known change in speed:
Real-world ammunition ranges from a gram in mass up to a few kilograms for
heavy shells and even more for other tactical weapons (bunker-busting shells used
during the second Gulf War were more than 1000 kg in weight). A typical 5 g bullet
that normally travels at 500 m/s might be slowed to 25 m/s. This is a s of 20. To get
the same energy we need to give it 400 times the weight: 2 kg.
Second, we have to decrease the gravity on projectiles. Most projectiles shouldn't
slow too much in flight, so the damping parameter should be near 1. Shells and mor-
tars may arch under gravity, but other types of projectiles should barely feel the effect.
If they were traveling at very high speed, then they wouldn't have time to be pulled
down by gravity to a great extent, but since we've slowed them down, gravity will have