Exercises

To help you test your knowledge of this chapter's content, here are a few exercises that you should work on. They are not imperative to the rest of the book, but working on them will help you assess your strengths and weaknesses in the material covered:

  1. When calculating pathfinding, we currently do not allow diagonal movement. Update the algorithm so that this is now allowed. To get you started, when calculating the G cost, you'll need to determine whether we moved diagonally or straight.
  2. Currently, the enemies will chase us throughout the entire level. Amend the function so that the enemy will only chase the player if they are within a certain distance.
  3. Currently our enemies move at a fixed speed and don't take into account the speed variable ...

Get Procedural Content Generation for C++ Game Development 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.