O'Reilly logo

Procedural Content Generation for C++ Game Development by Dale Green

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

Coding the A* pathfinding algorithm

With an understanding of the fundamentals of A*, let's start implementing it in our game. This will allow the enemies to follow our player around the level regardless of its topology.

With a complex algorithm such as this, having a visual representation of what's happening is really helpful. Wherever it's appropriate, we will take a look at a visual representation of what's happening using the following example:

Coding the A* pathfinding algorithm

The Tile datatype

Let's start by taking a quick look at the Tile struct that was defined in Level.h. As we've seen, a node contains quite a few values. In the implementation, it's the level tiles that will ...

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