JavaScript EditorFree JavaScript Editor     Ajax Editor 



Main Page
  Previous Section Next Section

Part III: Learn to Shoot!

In this part, the animats learn how to shoot—as true action game bots should. The shooting behaviors are split up into subtasks that can be handled independently. A combination of physics and neural network technology produces the ideal balance between effectiveness and realism. This proves to be a surprisingly challenging problem (although equally entertaining).

Motivation

Given a satisfactory solution for movement, the next step to building up a deathmatch bot is to give it weapon skills. The nonplayer character (NPC) can handle a variety of lethal weapons, ranging from slow rockets to instantaneous railguns.

After forward and side movement, turning is the most primitive capability of animats. Turning has already been put to use for movement, but tight control wasn't necessary. Shooting, on the other hand, emphasizes the capability to turn precisely. Together with other simple actions to control the weapon, this will provide an interesting challenge for the AI.

The shooting behavior can be split up into different tasks, including anticipation, prediction, target selection, aiming, and firing. Unlike the previous examples, the shooting behavior requires more than just one function. This behavior will give us a feel for simple architectures using a single-level decomposition.

Outline

The process of development is covered in order through the chapters. Theory is split into two chapters, with a welcome practical interlude!

Chapter 13, "Combat Settings." The platform for the AI is analyzed, with a description of both the game engine and the environment. We're particularly interested in how they affect the task of shooting.

Chapter 14, "Player Shooting Skills." The problem itself is analyzed (and understood) thanks to a case study of human players. We discuss the information required to shoot and discuss criteria to evaluate the outcome.

Chapter 15, "Shooting, Formally." The specification of world interfaces is established to provide a hook for our AI. The world interfaces allow the animats to interact with the environment in terms of sensors and effectors.

Chapter 16, "Physics for Prediction." As a first prototype, an AI capable of predicting the movement of enemies is implemented. Both a mathematical solution and one based on physical simulation is demonstrated.

Chapter 17, "Perceptrons." We tackle some theory, covering perceptrons, one of the first types of neural networks. Simple technology is the focus, including an explanation about how the algorithms manage to solve problems.

Chapter 18, "Dealing with Aiming Errors." This chapter provides a practical interlude in which perceptrons are applied to aiming. Neural networks learn to shoot smoothly and to compensate for error—combining efficiency and realism.

Chapter 19, "Multilayer Perceptrons." After that practical break in the preceding chapter, this chapter continues the theory behind neural networks with a discussion of multilayer perceptrons, which is a generic form of perceptron. This chapter explains the crucial improvements that allow perceptrons to solve arbitrarily complex problems.

Chapter 20, "Selecting the Target." In this chapter, multilayer perceptrons are applied to target selection. The neural networks learn to estimate the damage inflicted by the rockets so that the AI can pick spots with high chances of damaging the enemy.

Chapter 21, "Knowledge of the Problem." Finally, we investigate the elusive skill of understanding a problem. These concepts shed light on the application phase of development.

Assumptions

Naturally, the same fundamental requirements as in Part II are assumed. Specifically, we need a game engine and a framework for the AI. To develop shooting behaviors, there are a few more prerequisites:

  • Support for weapons in the game, including many different environments with weapons and ammunition.

  • The ability to respawn bots back into the game no matter what they do! Moving around was fairly simple; there were few opportunities for dying. With shooting, we must expect the worst.

  • Independent movement behaviors that can explore the terrain without needing assistance.

This should be more than enough to get us started. We'll develop the rest as we progress through this part! Be sure to check the web site at http://AiGameDev.com/ for the corresponding source code and demos.

      Previous Section Next Section
    
    R7


    JavaScript EditorAjax Editor     JavaScript Editor