JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section


To emphasize the benefits of prediction, the animats use the blaster—which fires fairly slow projectiles. Rockets are an option, but they reduce fight time and increase self-damage. We'll use rocket launchers in Chapter 20, "Selecting the Target," when the animats can prevent blowing themselves up. Naturally, making each of the animats invulnerable is an option for development, too. However, using the blaster instead means fights in fact finish, still lasting long enough for us to get a feel for the abilities of the animats.

It's also more interesting to force the animats to shoot from a distance, which really emphasizes their prediction skills. This is done by declaring a truce at short distances. When the animats are in proximity, they'll stare at each other, and eventually walk away. After ten paces, they can open fire, like in a duel. This is a gimmick in many ways, but it serves a valid purpose!

Very simple movement code can be used to test the prediction. In fact, a slightly modified version of Pinbot is used. The only additions were to allow the animats to look somewhere other than the direction of travel. This is important during fights because the attention is focused toward the enemy rather than in the direction of movement.

To handle movement without always seeing the obstacles, physical contact is used for the animats to bounce of walls. The steering behaviors perform well when the animats can see where they are going. During the fight, however, it's not always possible to look for walls (when traveling backward, for example). Bouncing off walls is also very predictable in nature, so it's a great test for the prediction.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor