Building the AI features for Wolcen: Bloodtrail
The launch of Wolcen: Lords of Mayhem was a multi-year journey for us and our close partner Wolcen Studios, but we knew there was so much more we wanted to create. So, we were excited to get that chance when Wolcen began work on Bloodtrail, continuing to use the Kythera AI toolset to drive core gameplay.
Wolcen: Bloodtrail, the first in a long line of free content patches for the base game, included Chronicles, Wolcen’s equivalent of what other ARPGs might call ladders, leagues or seasons. Each Chronicle introduces new gameplay mechanics and environments. The economy and progress are reset to give players a fresh start when exploring the new content and competing against each other.
For Chronicle 1, Kythera AI developed two new features: the pathfinding behind the headline Bloodtrail theme, and Monster Reactions.
In this post we’ll share a behind-the-scenes look at what it’s like to collaborate with our partners to build innovative AI-driven gameplay.
Building new features is an iterative process. It’s fun, but it can also be extremely challenging, which is why we're fortunate to have a talented team of AI experts and game industry veterans to bring our partners' visions to life.
The Hunt
Outside of busy launch periods, we sync up with licensees who’ve opted for in-depth development support every 1-2 weeks, sharing sprint progress, and discussing issues and design. It was in one of these dedicated meetings that Wolcen’s team shared the designs and ideas for the features they wanted in their first content patch. So the Kythera AI team got to work! We spent the next few sprints working closely with Wolcen's team, collaborating on design documents, iterating to focus the scope and testing early prototypes.
Watch the trailer for Wolcen Chronicle 1: Bloodtrail to find out how Hunts work in-game.
When Wolcen came to us with the idea for the new type of mission we were excited by the interesting challenge. Usually, game developers want AI agents to find the shortest path between points as efficiently as possible. This way, developers can ensure consistent behavior even at a scale when hundreds of agents are all searching for paths at the same time across a massive world - something Kythera AI already does well.
However in the case of the prey in Hunts, chasing down an agent that just take the shortest path isn’t exciting. Wolcen’s designers wanted to motivate players to explore more of the level by following seemingly organic paths, the kind of path a fleeing monster would leave behind. What's more, our solution had to work on both the hand crafted campaign levels and the end-game procedural levels, all automatically.
We presented the following solution, illustrated in Figure 1. Interesting (green) paths through the level have no overlapping segments, are sufficiently long and take players past points of interest (the blue icon in the middle of the map). Paths with overlapping sections (yellow) are bad, as they are more difficult to follow and take the player through already explored areas. Short paths that miss points of interest (red) are too optimal or boring.
Figure 1: Kythera AI’s proposed solution highlighting interesting, bad and boring paths.
The algorithm to generate interesting paths has two phases:
Phase 1: Discover multiple paths to the goal
Executing a path finding algorithm from the start to the goal will always generate the same optimal path. To discover more paths that are less optimal but more interesting for the player, the path finding algorithm needs an incentive to generate these different paths. To do this we used an existing feature of our path finding code which allows us to mark specific parts of a map as having a high cost to cross. For example, a character is much slower to cross a swamp than a paved road, so the swamp section has a high cost associated with it. The path finding algorithm will then use this cost and will try to find the "cheapest" path, instead of the shortest or most direct.
This cost feature can also be used to find more path options to the goal. First, find a path from the start to the goal, recording all crossed sections. Then, mark all those sections as having a high cost to cross. Finally, rerun the path finding from the start to the goal. The path finding algorithm will try to avoid those sections now and generate a different path to the goal if possible. We repeat that process multiple times, every time setting the new found sections to a high cost.
Figure 2: Debug draw of various stages of the The Hunt pathfinding algorithm.
Phase 2: Select a path
In the second phase, we generate a directed, acyclic graph from all the paths generated above. Every section (NavMesh polygon) that is traversed by a path is added as a node to the graph. Edges in the graph are the connections between sections. Some paths may use the same sections as other paths, so they use the same node in the graph. As a last step, we traverse the graph from start to goal.
At every junction, we take one of the edges at random, creating a more interesting and diverse sets of paths. In Figure 2 image 4, we see a generated path in yellow which was not generated in the discovery phase, but a completely new one generated from the graph.
Video 2: Early-stage algorithm testing with the lighting and AI disabled so that we can clearly explore possible paths without the urge to slay monsters and collect loot.
Monster Reactions
The second set of features we developed for Bloodtrail was Monster Reactions. You’ll encounter this feature when fighting bosses at the end of hunts. It makes the bosses aware of Damage over Time areas (DoTs) from the player’s spells, and allows them to react with their dodge skill. In this example, when the player casts a damage over time (DoT) spell beneath an AI monster it becomes aware of it and uses our Spatial Query System to search the environment for a safe place to dash to.
First, the reaction system generates points within a radius of the monster's escape ability. These points are represented as circles and cylinders on the navmesh.
Next the algorithm removes and grays out all invalid points. In this case, invalid points are those that are still in damage zones or are out of reach according to the limits of monster's escape ability. For example, some abilities only allows horizontal dashing so non-horizontal options will appear grey.
Lastly, the remaining points are scored to select the best candidate. In the example above, we've opted for a natural feeling approach by giving each valid point a random score, indicated by cylinder height. The point with the highest score (represented by a green cylinder) is selected, and the others (represented by red cylinders) are discounted.
The reactions are customizable and allow developers to implement more sophisticated scoring mechanisms which could utilize the environment more, take into account the player's position and even their available skills and gear - the possibilities are endless!
Find out what Kythera AI can do for your game
The pathfinding behind The Hunt and the usage of SQS and Behaviors for Monster Reactions are examples of how Kythera AI’s advanced features set can be used to build entirely new innovative mechanics or add depth to existing gameplay.
If you’d like to find out more about Kythera AI or start an evaluation please get in touch.