Chapter 16. AI Algorithms

IN THIS CHAPTER

We discussed finite state machines (FSMs) in the previous chapter, but in this chapter, as we look at common algorithms, we will put the knowledge into motion by having enemies that will move randomly, chase, evade, and move in patterns.

Setting Up Our Demo

We need to create a new solution called AIDemo. We need to reference our XELibrary but do not need to change it. We can either include it as a project or just add it as a reference.

We need to add the sphere0.x file to our Content\Models folder. We can create a private member field called sphere to hold our model:

private Model sphere; ...

Get Microsoft® XNA™ Unleashed: Graphics and Game Programming for Xbox 360 and Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.