Game Development Reference
In-Depth Information
direction = false;
breathHeight = breathHeight + 1;
if (direction == false) {
breathHeight = breathHeight − 1;
if (breathHeight == −5) {
direction = true;
if (breathing) {
aimY = aimY + breathHeight;
Here we are simply moving it up to some limit—in our case, 5 pixels—and then moving
it back down. A better implementation would increase the unsteadiness as the user
zooms in, as shakes are magnified also. There is no limit to the innovative functions you
can use to move the aiming circle away from the cursor to simulate the reality of having
to aim a gun. Yet this is certainly an area of first-person shooters that is lacking in variety.
When he is ready to fire, the user can left-click to hold his breath, the variable breath
ing becomes false , and the crosshairs will stop moving. This simple addition makes
the game much more challenging and engaging. It should be noted that if the shooter
holds his breath too long in real life, the aim will again become unsteady as his body
reacts to not having fresh oxygen. Another improvement to this algorithm would be for
the aim to become unstable after the left mouse button is pressed for some amount of
Many games also change the accuracy of a weapon depending on body position. There
are three basic types of shooting positions: standing, kneeling, and prone. Standing is
—you guessed it—standing up. Kneeling is some form of squatting rather than just
kneeling on your knees. Prone is laid flat on the ground. Because the rifle is locked to
your body, the less unstable your body is, the less unstable the aim. When standing,
your body's muscles have to do a lot of work to remain upright. When kneeling, they
do less so, and when prone, your muscles don't have to worry about keeping you standing
at all.
You can add these parameters as random twitches in the aim and tune them to change
the relative advantage of each position. However, prone should always be more stable
than kneeling, and kneeling more stable than standing.
Recoil and Impact
Now that we've aimed, fired, and figured out where the bullet is at any given moment,
let's talk about the last phase, terminal ballistics. To really understand what happens at
Search Nedrilad ::

Custom Search