This semester, I had the pleasure to take a course on programming general AI patterns and algorithms as a way to further my skills in pursuit of my Game Programming minor. Over the course of the semester, we learned the basics of steering, pathfinding, and state machines, and our final assignment was to research and develop a technique or pattern that we didn’t learn and demonstrate it. As a designer, my main interest was in learning how to program a tool that could help design work for whatever game it fit into. This led me to become interested in the waypoint tactics technique.
Waypoints, in terms of pathfinding, are positions in a level that a pathfinding system uses to connect areas of the level. In normal pathfinding, they’re essentially used to tell an AI how to get from point A to point B without walking through walls or taking a route that seems unreasonable to a player. Waypoint tactics is the idea of giving waypoints more information so that AI can make more complex and informed decisions. Examples of waypoints are sniper nests and places that it is safe to heal. This type of system is insanely helpful for designers because it allows them to place key interest points wherever they’d like in the level without having to have the programmers implement new systems for each of them. It also makes controlling the habits of larger groups of AI much easier.
For my demo, I decided to show off the intelligence of enemy AI when utilizing waypoint tactics, while also making use of everything I’d learned previously. Essentially, 2-3 spawned AIs navigate the level and change between many different states in an attempt to defeat the player. Enemies hunt down the player, fire at them, reload and restock ammo in safe and relevant locations, and heal at med stations when low on health. The reloading, restocking, and healing are done at specific waypoints, and I created a simple heuristic to determine the waypoint to go to.
The heuristic takes two pieces of information to determine a measurable value for a waypoint. First, the distance from the enemy to the waypoint is important because an enemy will want to reload or heal as quickly as possible. Second, the waypoint’s visibility to the player makes sure that an enemy doesn’t try to heal right in front of the player. That second value is determined by setting the player at various angles around the waypoint and shooting a raycast to see if the player would be able to shoot the enemy. Players make this safety-distance check every time they switch to a state that needs to find a specific waypoint.
References and Sources
I first started exploring the topic in our course’s textbook, Artificial Intelligence for Games: Second Edition by Ian Millington and John Funge. The book discusses the basics of using the node-based pathfinding system we created during the course of the semester and simply adding more information to the nodes. It also broadly goes over the way that waypoint nodes can be implemented into a state-based system. Seeing as my idea for the demo would utilize the state machine, pathfinding, and steering I had already built thanks to this book, I found it a great place to start.
I then looked at a document by Lars Liden from Valve about Strategic and Tactical Reasoning with Waypoints, which gave me a more in-depth look at how this fairly simple technique is used to bring relatively simple AI to the next level of intelligence. The major thing I pulled from this reading was a better understanding of visibility and how it can factor into a heuristic of determining a “safe” choice for an AI. The previous source was a good introduction and is what I based the heuristic in my demo off of, but Lars made the use cases much more understandable.
Lastly, one of the biggest sources I found was a GDC Europe talk done by Arjen Beij and Remco Straatman of Guerilla Games on how they uses waypoint tactics in Killzone. The most intriguing part of the talk, to me as a designer, was the various reasons to use waypoint tactics outside of just making design easier. It’s scalable to any number of players and can allow combat in more places from a gameplay perspective, but it also allows AI behavior reuse and changes are not tied to the level or encounter themselves. The slides were also where I finally realized that the heuristic was the heart of the technique and that even that was modular depending on usage.
Uses and Viability
In terms of what types of games this technique could really help, it’s pretty broadly applicable to most games with groups of enemy AI. Genres with “tactics” in the name like tactical shooters or tactics RPGs need to make smart decisions in order to make the player adapt and react, and giving the AI more complex information to mull over can really make or break a game like that. If an enemy doesn’t run to safety to reload or take cover when being shot at, the player can very easily be pulled out of the experience because it doesn’t feel like they’re fighting against humans. Waypoint tactics are also a really simple system that opens up a lot of opportunities for any pathfinding, even pathfinding that helps the player. In my demonstration of the technique, I created very simple waypoints that both the player and enemies could use if the functionality were added. However, I only used 3 examples, and every game that uses the technique will be able to utilize it differently to their advantage.
As for what platforms this technique might be suited for, I’d say it could fit on every platform due to its fairly lightweight nature and ability to be scaled to use more memory or more processing depending on which is more available. The size of the game also matters because larger games may not be able to store the information ahead of time due to the sheer amount of nodes while smaller games might not have this issue. The point is that it is a modular system that can be capable on almost any platform.