O'Reilly logo

Microsoft® XNA™ Unleashed: Graphics and Game Programming for Xbox 360 and Windows by Chad Carter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required