Using other waypoint systems
Waypoints are a way of writing pathfinding algorithms. They are extremely easy to write. However, if not thought out properly, they can be extremely buggy and the AI can look extremely stupid. Many older games often had this sort of bug, which resulted in a revolution in the implementation of waypoint systems.
Getting ready
To work through this recipe, you will need a machine running Windows with an installed version of Visual Studio. No other prerequisites are required.
How to do it…
In this recipe, we will find out how easy it is to create waypoint systems:
#include <iostream> using namespace std; int main() { float positionA = 4.0f; float positionB = 2.0f; float positionC = -1.0f; float positionD = 10.0f; float positionE = 0.0f; //Sort the points according to Djisktra's //A* can be used on top of this to minimise the points for traversal //Transform the objects over these new points. return 0; }
How it works…
In this example, we will just discuss...