Artificial Intelligence

KEY TOPICS

  • AI Basics
  • Take Away Those Godlike Powers!
  • State Machines and Reacting
  • Probability Machines
  • Making Decisions
  • Patterns
  • Object Spawning
  • Putting It All Together
  • Evolution
  • Other Game AI Ideas
  • Summary

One of the first games I ever tried to make was a Pac-Man clone. It had 16 colors, was written in BASIC, ran on a 486, and flickered—a lot. But the point is, my first attempt at making the ghosts move was a little bit off the mark. Whenever a ghost would have to decide which way to go, it would always move in the direction of the player. This essentially made "super-ghosts" that were so good at tracking Pac-Man down that he rarely had time to eat a power dot. But if he was lucky enough get to a power dot in time, all the ghosts would be nearby, ready for Pac-Man to chomp them. Advantage: Pac-Man. The lesson here is that it's easy to make enemies too smart. It's also easy to make them too dumb. The trick is finding the right balance of intelligence that makes the game both enjoyable and challenging. In the Pac-Man clone, I had to "dumb down" the ghosts so that they occasionally made a decision to move in a random direction rather than toward the player. This solution wasn't exactly like the original Pac-Man game, but it made the game playable. Artificial intelligence is simply mimicked intelligence and behavior. AI is a rather large topic and has countless apps, but in this chapter, we just scratch the surface and focus on game-related AI. In this chapter, we talk about seeing and hearing, state machines, probability, attack-and-dodge patterns, aiming, and even evolution. Plus, we touch on a few topics such as object spawning and graphical overlays to make the demo a little better.



   
Comments