In the Armory
There are two fundamentally different types of weapons: melee (or contact) weapons and range (or projectile) weapons. They are generally designed for only one of these purposes—but sometimes both, such as the spear or even the musket and bayonet. Of course, one can physically use any type of weapon outside of its intended purpose, but it will not be too effective!
Instead of discussing the abilities required to use such weapons, this chapter focuses on the physical requirements for them to serve their purpose—and hence what the AI needs for shooting. This section discusses existing computer games and how they model weapons as objects. Different levels of weapon modeling are presented, including conceptual and physical levels.
Melee Weapons
Hand weapons, such as axes and swords, have the advantage of being reusable, a logical progress from throwing rocks or bits of tree. The important aspect of such weapons is the physical contact (naturally)—the impact of the weapon on its target causes harm. Therefore, any concepts that affect this collision (such as velocity, momentum, or pressure) need to be understood by the AI, too.
Computer games can capture the complexity of such contact weapons relatively well, although low-level details of limb control are often abstracted out for playability. This means the player cannot manipulate the weapon freely. Select attacking behaviors are instead provided; clicking the mouse is a poke action, and mouse movement is a slash of the sword—as in role-playing games or first-person adventures (for instance, Jedi Knight 2 and Die by the Sword). The alternative is to press combinations of buttons to control the weapon behavior, as in popular beat 'em up games (for instance, Soul Blade and Caliber). These design decisions can be reused directly to create interfaces to the AI.
Such games require a good model of weapons, because the gameplay relies on them heavily. Generally, however, contact weapons in first-person games do give the impression of desperate fighting, as a last measure before the fatal fall. Because sophisticated combinations of key presses reminiscent of beat 'em ups are quite rare, the skill often boils down to raw clicking speed or unpredictable slashes.
The modeling of the weapon itself is always simplified in games, because full physical simulations are rarely performed in great detail. This is typically just an animation of a weapon moving. The collision detection between the weapon and the target remains crude, for efficiency and simplicity purposes. Some games handle the contact as a Boolean fact; if the weapon hit the bounding box around a character, reduce its health. Simpler models such as these require lower levels of understanding from the AI, resulting in simpler behaviors.
Range Weapons
Rocks and sticks are often popular choices, although technology can significantly improve projectiles. The properties of projectiles (materials, shape) and the way they are thrown affect their trajectory the most. Therein lies the key concept: The object's flight through the air determines its impact on the target.
Fundamentally, all the computer model needs to do is simulate the trajectory of the projectile. When checking the targets, a simple Boolean hit test is enough, although variable injury models (where individual limbs can get hurt) are becoming increasingly popular (for instance, Soldier of Fortune). The AI needs to be aware of such concepts to perform realistically.
Fairly simple models of projectile weapons tend to work very well (that is, linear flight with no gravity). It's easier to develop nonplayer characters (NPCs) with an understanding of projectiles—or ballistics. Parameters are easy to tweak for playability by the designer (for instance, precision and velocity). As such, range weapons often prove much more fun than melee weapons. The process of aiming at a distance is both challenging and rewarding, and therefore interesting from the AI's perspective, too.
As for the process of aiming and firing, the simulation also contains different levels of realism. Depending on the weapon, the player's view can include wobble or angle restrictions. The timing for the release the projectile can also influence power and accuracy (for instance, arrows or grenades). Finally, the player may have to reload manually. The combination of these properties can contribute to the immersiveness of the game, but conversely can steepen the learning curve. Games tend to handle this very differently, so various restrictions may be imposed on the AI, too.
|