Game Development Reference
In-Depth Information
Let's go through the process of determining how long it will take the Space Based Laser to
destroy an enemy missile. The average power of the laser will be assumed to be 7.5 MW , and
the diameter of the beam when it strikes the target will be assumed to be 70 cm . If the energy
density required to destroy the missile is 10000 J / cm 2 and the absorption factor of the laser is
assumed to be 0.75, the beam duration time to destroy the missile can be calculated from a
rearranged version of Equation (14.5).
2
()
10000 *
π
35
EA
s
(14.6)
t
α ==
=
6.84
P
0.75* 7.5
e
+
6
There are some other issues to keep in mind when modeling a laser attack upon a target.
Because the energy absorbed by a target due to a laser beam is a function of the power of the
beam multiplied by the duration of the beam, the beam must be held fixed on a particular spot
on the target for the required amount of time. If the target is moving, the laser will have to track
and adjust to the movement of the target during its flight.
Unlike projectiles, laser beams are not affected by gravity, aerodynamic drag, or wind.
A laser beam will travel in a straight line from laser to target. The diameter of the beam will increase
very slowly, but the effect is so gradual that you can usually ignore it for game programming
purposes. The only other thing that will affect a beam as it travels from laser to target is whether
it travels through dust, smoke, mist, or fog, in which case some of the light will be reflected
away and the beam will lose some of its power.
Laser Simulation
Let's use the results from the previous section to create a simple laser air-defense simulation.
A typical screen shot for the Laser Simulation is shown in Figure 14-8. The laser is housed in a
square block on the ground. The user has the ability to specify the beam power, beam radius,
and absorption coefficient of the target. The mouse controls the target point of the beam. If the
mouse is clicked or if the cursor is dragged across the display window, the target point of the
laser is moved to that point. The Start button starts the airplane flying across the screen and the
Reset button redraws the GUI.
The airplane is destroyed if the user can keep the laser beam in contact with the airplane
until the plane absorbs 10,000 J/cm 2 worth of energy. The time required for this energy absorp-
tion level is determined by Equation (14.6). The simulation is implemented in a class called
LaserSimulator . The entire code listing won't be discussed, but we will talk about the three
methods that are used to control the action.
Search WWH ::




Custom Search