Building the AI features for Wolcen: Bloodtrail
It seems like almost yesterday that we were celebrating the launch of Wolcen: Lords of Mayhem. Reaching that milestone 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. Now, almost 10 months and many performance and balance patches later, we’re celebrating the launch of Wolcen: Bloodtrail. After all, it’s not every day that an AI feature drives such core gameplay that it features in the title.
Video 1: Wolcen: Bloodtrail release trailer
Bloodtrail is the first free content patch for the base game and also the launch of Chronicles, Wolcen’s take on ladders, leagues and seasons from other ARPGs. Each Chronicle will introduce new gameplay mechanics and reset the economy and progress to give players a fresh start to explore the new content and compete against each other. For Chronicle 1, Kythera AI developed two new features: the pathfinding behind the headline Bloodtrail theme, which involved hunting down prey for rewards, and Monster Reactions which we featured in our Q3 2020 Update blog post.
In this post we’ll share some behind-the-scenes of 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 partner’s visions to life.
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. Back in May, Wolcen’s team shared the design for the features they wanted in their first content patch. We spent the next few sprints going through the team’s design documents, following up with further questions to focus the scope and trying out early prototypes.
The Hunt was a very interesting feature to work on. Normally, in game development you’re trying to find the shortest path as efficiently as possible so that you can scale to hundreds of agents all searching for paths across a massive world at the same time. Kythera AI already does this well for fully dynamic 2D and 3D worlds. But for The Hunt, chasing down the shortest path isn’t exciting. Wolcen’s designers wanted to motivate players to explore more of the level by chasing down organic paths a fleeing monster would leave behind. Our solution had to work on both the hand crafted campaign levels and the end-game procedural levels, all automatically.
Figure 1: Kythera AI’s proposed solution highlighting interesting, bad and boring paths.
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.
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, we have to give the path finding algorithm an incentive to generate different paths. A feature of our path finding code is that we can 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 take this cost into account and will try to find the "cheapest" path, which might not be the shortest.
We can use this cost feature to find more paths to the goal: First, find a path from the start to the goal, recording all crossed sections (those are the blue polygons on the NavMesh in figure 2). 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.
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. This way, we get more interesting and diverse sets of paths compared to just taking a random path discovered in the first path. 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.
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 our Q3 update blog post, we demonstrate and explain how we built Monster Reactions by using our Spatial Query System (SQS) to find safe spots to dodge to.
Figure 2: Read our Q3 Update blog post to learn more about Monster Reactions.
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.