Book Image

Creative Greenfoot: RAW

By : Michael Haungs
Book Image

Creative Greenfoot: RAW

By: Michael Haungs

Overview of this book

Table of Contents (17 chapters)
Creative Greenfoot
About the Author
About the Reviewers

Chapter 7. Artificial Intelligence


"Wisdom begins with Wonder."


We looked at moving, controlling, detecting collisions between, and animating Greenfoot actors up to now in this book. What we will look at in this chapter, is giving our actors a semblance of intelligent behavior. Doing so will allow us to tell better stories and create more engaging user interactions.

Now, the field of Artificial Intelligence (AI) is very complex, and creating truly intelligent behavior for our actors is beyond the scope of this book. However, there are some simple techniques we can use to simulate various levels of intelligent behavior using probability and heuristics. We will then look at a popular algorithm (used in many AAA games) that will allow an actor to traverse a path through a set of obstacles. Specifically, you will learn how to apply the following to simulate intelligence:

  • Randomness

  • Behavior heuristics

  • A* (pronounced A-star) pathfinding

Throughout this book, you have been acquiring the...