Game Development Reference
In-Depth Information
is different. Shooting our machine gun is a fairly rapid event. Similarly, a pistol is
quick but requires more effort to aim. The shotgun doesn't require as much time
to aim, but the reload time is going to be more involved. Lastly, the rocket launcher
is slower to wield, slower to aim, and slower to reload. The result of this is that,
while we have a defined action that constitutes a single decision, we don't have a
single amount of time .
The solution, therefore, is to recalculate the decision of whom to shoot next
after the conclusion of each shot. As we prepare to shoot the next target, we proceed
with all the nifty stuff that goes into facing the target and aiming. Upon completion
of that shot (regardless of how long that takes), the decision about whom to pum-
mel next is reevaluated and the process starts anew.
This seems simple and foolproof at the moment, but there are plenty of wrenches
that we could find haphazardly lobbed into our tidy little process. For example,
consider the following sequence:
1. We complete a shot at Bad Dude.
2. We reload our weapon.
3. We process the decision of whom to shoot next.
4. We turn toward the target.
5. We raise our weapon.
6. We aim our weapon.
7. We get ready to fire… and…
8. We find that Bad Dude is already dead!
Somewhere between step 3 and step 8, the decision of whom to dispatch was
rendered irrelevant. While this might not look too out of the ordinary for a fast-
firing weapon such as a machine gun or a pistol, our agent would look startlingly
ridiculous going through the protracted action of aiming a rocket launcher at the
space formerly occupied by a Bad Dude. If we only build our model to recalculate
after a shot, we have to go through with the shooting process to select a new target.
What's more, if the game code insists that the actual act of shooting requires a
valid, live target to complete, we may now be stuck.
To avoid all of this, we can add a verification process throughout steps 3
through 7. In essence, we are asking the simple question, “Can I still do this?� If not,
we can trigger our decision evaluation process immediately (through an event mes-
sage, for example).
Search WWH ::




Custom Search