Book Image

iOS Game Programming Cookbook

Book Image

iOS Game Programming Cookbook

Overview of this book

Table of Contents (19 chapters)
iOS Game Programming Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing wander


You might have observed very often in the game that few characters are just randomly moving around in their environment. These characters are waiting for some event to happen. For example, in any warfare game, the enemy soldiers are just wandering around in the castle to catch the player and they will keep on wandering till they find the player. Once the player is in the vicinity, then they will change their behavior to seek. So, the wandering ability of the characters makes them visually pleasant and realistic.

Making a game object follow the path will make it unrealistic and will affect the overall game play by making it more predictive. So these wandering behaviors add much more fun and realistic behavior to the game.

The wander steering behavior produces a realistic movement, which makes the players think that the character is just walking and to feel the whole environment more alive.

Getting ready

There are various ways to implement the wander behaviors. They are as...