Dev Blog - How Bots Work in Vermintide 2


How Bots Have Evolved in Vermintide 2

During the lifetime of Vermintide 1 bots were worked on in chunks of improvements. Features such as the bots being able to pick up and give potions and bombs originated from this period. Compared to when Vermintide 1 was first released back in 2015 a lot has happened with the bots.

Pathfinding. Vermintide 2 introduced a lot of new area based dangers, such as warpfire, lamp oil fire, troll bile and vortexes. Because of this, bots received new behaviour to avoid and escape such dangers.

Combat capabilities. Bots had previously no knowledge about the required timings to execute the attack chains of a certain weapon – instead they would perform simple tap or hold inputs in order to perform light or heavy attacks. While this worked in most cases, it could lead to them being unable to perform certain attacks for weapons whose attack chains differed too much from that of other weapons.

For Vermintide 2 we reworked this so that the bots now have access to the different timings required to perform attack chains of various light and heavy attacks. In order to fight more efficiently against moving targets we also added attack velocity anticipation so that they can start charging a melee attack before reaching a target.

Talents and abilities. Last, but not least, we added support for the bots to use talents and career abilities.

How Bots Fight

Avoidance. Bots rely heavily on area of effect threat objects when fighting enemies with area-based attacks. Whenever an attack is triggered a time-based shape will be created around the danger zone of the attack. If the bot is inside of the shape it will be prompted to trigger a dodge and movement input to avoid the attack. After a set time has passed the bot will stop doing the dodge and movement input.

Attacks. Bots will choose which attack to perform based on simplified metadata stored in the currently equipped weapon, e.g. sweep attacks will be used when surrounded by a large amount of enemies and attacks with armour piercing against armoured foes. By comparing its current velocity, the enemy’s velocity, the reach of the weapon and time until the currently executed attack would hit the bot can predict whether the currently executing attack is going to hit an enemy and thus perform attacks whilst moving.

Bots and Pathfinding

Each player has a couple of points that the bots use to follow them. These points are generated by estimating the future position of the player, based on the speed and current heading of the player, to minimize unnecessary repathing and avoid making the bots fall behind.

They will also attempt to stay out of the player’s view to minimize interference. This process is not without error though, which is why when moving through narrow passages the bots will often end up walking in front of your view. The points are then distributed along the bots so that they receive one which minimizes the amount of movement required to reach it.

Which player they choose to follow is based on a couple of factors, such as is any player in need of aid, is there an event going on and how many human players are there. For example, when there are three human players and only one bot it will attempt to stick with the largest grouping of players except during certain events, such as the wagon event on Ussingen, in which the bot instead will try to stick with the most lonely player to assist him/her.

Designing Bots For a Co-Op Game

The bots were primarily designed to achieve two objectives:

Learning the game. Function as training wheels for new players, enabling them to try out the game and also showing them some of the core gameplay such as combat, revive mechanic, pickups and career abilities.

Waiting for other players. Enabling gameplay whilst waiting for players to join or when someone drops out of your party.

The reason these two were our main focuses is that Vermintide 2 is first and foremost a co-op game and only secondarily a single player experience. Therefore our choices are guided by getting people into multiplayer games and supporting that style of play.

They are intended to feel and play like human players as much as possible during normal gameplay. This is of course something that is very hard to achieve, we’ll never be able to achieve bots that can hold up to a human on close inspection. However, if we can achieve bots that function well, are not in the way and are not something that you actively have to think about then we’re in a good place. Thus, a lot of time is spent trying to identify and fix crucial situations where the bots goof up.

Since they are supposed to play like human players, the bots rarely cheat. Except for teleporting when they get stuck, they mostly use the same mechanics as a human player. Bots actually run the same code as players but control their character through virtual key presses on a virtual controller. They even have a system for simulating aiming in order to lessen the amount of faster-than-human reaction shots. All of these things are done since we don’t want to teach the player that his or her teammates should be able to do things that only a bot can do.

The Future for Bots in Vermintide 2

In the future we will continue to improve the path following of the bots, resolving situations where they can get stuck or unable to reach the player, improve their combat capabilities whilst in hordes and improve their pathing when dealing with bosses.

We also hope to look into new features that grant you more control, such as the much requested ability to pick up grimoires. Being able to pick up grimoires would require some new kind of interface so that there is a way to let the bot know when you want it to pick up a grimoire and when it is time to throw it away in order to survive the day.

Simply having the bots immediately pick up grimoires won’t do, perhaps you had planned for your friend to take it, perhaps you are in bad situation where picking up a grimoire would make it impossible to win or perhaps you are simply an exploring newcomer just trying to manage your way through recruit.

We also want to avoid implementing it by using the existing tagging functionality since this would mean that a tag could mean a multitude of things and result in unintended side effects. Perhaps you tagged a grimoire to communicate to your fellow human players that one of them should take it and having the bot take it in that case would be frustrating.

Whilst implementing this feature we would also have a look at improving the bots tome carrying, so that you have a way of telling the bot to keep the tome. The bots will currently prioritize healing items before tomes since there is no way of letting the bot know that you want it to commit to the tome. If the bots would always keep the tome without any input from the player it could lead to situations where they or a fellow teammate later on would die due to not having brought along a healing item, something that would be especially frustrating for new players. Simply put, a player must be able to decide what is more important to maximize at the moment: survivability or the amount of tomes.

Christoffer Wiss

Gameplay Programmer (Enemy AI / Player Bot AI)

Dev BlogHanna Holmgren