JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section

Sketching Possible Options

At this stage, we're interested in collecting and sketching rough ideas about how to handle ranged combat. Specifically, the inputs (that is, information needed from the weapon and environment), the outputs (that is, the possible ways to control the weapon), and the context (that is, how the weapon and projectiles behave, how the animat holds the gun) need to be modeled.

In this case, the options possible are mostly borrowed from existing game designs—or at least the aspects that are obvious from playing the games. This explains why some of the drafts seem familiar. However, other ideas are not as obvious, but are still worth exploring for potential options.


The model of the weapons, projectiles, and the animat itself are part of the context.

Weapons and Projectiles

One of the most important questions is how to model the weapon itself. Although the weapons could be represented as a 3D mesh, fewer details are exposed within the game logic to the AI. A relatively low-level model could be used, with physical properties of the weapons exposed to the AI (for instance, using a bow and arrow). In this case, the loading of projectiles and handling of the weapon's behavior when it fires is left to the player. This would require particularly precise limb control, allowing the body to deal with the weapon in all its detail (for instance, to load the arrow, arc, and release).

On the other hand, the design can use ideas similar to the handling of movement; the low-level details can be abstracted out of the model. Weapons can be considered as an entity on which actions can be performed conceptually (that is, reload and fire). Much of the capabilities of the weapons can be exposed this way, while still retaining a simple high-level approach.

As for the projectiles, they will generally fly in a straight line. Most popular first-person shooters add gravity only to a few projectiles, such as grenades.


How does the animat hold the weapon? This could be linked to the body itself, so the animat has to look in the direction it wants to shoot at. This is a popular option in first-person shooter games.

This seems fairly restrictive, but there is a surprising amount of flexibility because the animat can move in any direction independently for its orientation.

It would be possible to handle the weapons independently from the body. This is generally not done in most games, undoubtedly because of the challenges of the animation and the control issues for human players.


The information required by an animat can be split into three categories: weapons and projectiles, target, and environment.

Weapon and Projectiles

Some sense of the current weapon is needed to maximize its use. How is it possible to fire a projectile without knowing what kind of weapon it is, or whether it's loaded and ready to go? Such information may be provided in a conceptual way (for instance, symbols indicating the weapon "isReady"), or in a more implicit fashion. (For instance, if the weapon doesn't fire, it wasn't ready.) Using this second approach, the animat would require learning the reload times.

The information about projectiles is not directly needed by the AI to perform aiming. Only understanding of how the projectile reaches the target is necessary to shoot. This can be assumed by the AI, or potentially learned within the game. Alternatively, projectiles can be represented explicitly and perceived as entities, or they can be tracked implicitly given their effect on the environment (for instance, explosions or damage).


To engage combat with a particular target, an animat needs to perceive it first! Unlike the projectiles, this requires explicit sensing, allowing direct action can be undertaken. One option is to consider the enemies as an entity, and communicate that to the animat as a symbol. Alternatively, the enemy can be perceived visually as a human would see the game environment and isolate the target—although this is unlikely to be feasible technically and computationally. (We're aiming for biological plausibility not accuracy.)


As mentioned in Chapter 14, "Player Shooting Skills," a player requires knowledge of the environment to optimize the aiming performance. This knowledge can be acquired by perceiving the structure of the terrain surrounding the target. Specifically, the distance from the attacker to points around the desired impact point can help reveal the gross structure of the terrain, improving the decisions about where to shoot.

Tracing the path of the projectile is also useful, because it may prevent embarrassing shots into close obstacles, or shots that are blocked before reaching their intended target.


The actions provide a way to control the weapon as needed. Depending on how the weapon is modeled, this can be achieved as high-level actions, or on a much lower level via the control of limbs. Either way, this needs to indirectly allow firing and, potentially, reloading.

The aiming is a similar process to turning the body of the animat (defined for movement). It's possible to lock the body and the weapon's orientation together, so aiming is done by turning. Alternatively, the two can be handled separately, providing more control but increased complexity.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor