Thursday, June 15, 2017

Hello Crows,

I'm Chris, a programmer at ArtCraft, here to be your tour guide on recent developments in our AI systems.

Soon after the reveal of Big World, all sorts of systems were coming online really fast, and the whole team was busy with Shiny New Things. Well, it turns out that AI drew the short straw during that phase of production. During this time we let the AI behavior and performance slip a little too much because our attention was drawn to said SNTs.

My recently-assigned task was to go in and evaluate what we have for AI and to get it in better shape for our larger maps. In the case of Eternal Kingdoms, the map can be changed on the fly by placing parcels and buildings, adding a level of complication to the proceedings. My other task is to hammer away at implementation on our future plans for AI, which includes appropriate and stable behavior when the 'static' world changes in this way.

Team Effort

The AI is a real team effort, even if we don't always think of it as one. Since I was assigned the AI refactoring a few weeks ago, I've come to be thought of in-house as the "AI guy" since nearly every one of my status updates or morning stand-up meeting notes has involved some AI thing or another. But, even if a teammate hasn't felt like they're directly contributing much to AI these days, nearly everyone has contributed in some way. Replication, object management, behavior design, movement code, performance and memory improvements; the stats, inventory, and harvesting systems; animation, modeling, texturing, sound, and original concept art all contribute to the final result. I'm sure I left something out.

The problem that we faced was that the code was in dire need of an update to make everyone's prior work on the AI shine. The code was originally written for simpler, relatively flat maps, with no dynamic placement of buildings or props, in a very static world; it made a lot of convenient assumptions about the environmental conditions an AI could find itself in. This system was written pre-Big World, with Band-Aids applied over time in an attempt to keep it "just good enough" in lieu of spending too much time away from more immediately pressing work. Finally, we decided that we had to turn it off for at least a couple of core reasons: behavior and performance were not up to par.


Musk Hogs

Let's start with the lowly musk hog. You may recall that they could get stuck climbing up hills to chase after you, and that they had a particular affinity for the edges of the map.

The first issue was caused by attempting to wrap its 3D model with a pill that was shorter, wider, and lower to the ground. This wasn't really workable because we had not done the necessary work to support capsules of varying position and dimension, even though we had exposed those exact settings in the editor.

For example, changing the radius of the capsule means that our pre-generated navmesh -- which is generated for a certain standard character radius -- can't be trusted to give a path that the AI could navigate. (The navmesh is a data structure describing the walkable areas of the world and is pre-built so that fast queries can be performed on it at run-time.)

The second issue was that one of the states in the AI’s “brain” could request a path to a random location that has no ground. It's common sense that you shouldn't do that, right? Well, for a long time one of the brain states (loiter) could potentially request a location off the map.

Briefly, the loiter state is a state that an AI can be in when it’s not in combat. It has a radius and center point. AIs in loiter will ask for a path to a random location within those constraints. When it reaches the location, there is a time interval where it will remain at that location (at least until interrupted by combat, for example).

Previously, the AIs would run as far as they could to that location, and then get blocked by the zone border. They weren't reaching their goal, but would still stubbornly try to get there anyway. Without the zone border (which we ran without for a time), they would simply walk off the edge of the world, never to be seen again. The solution of course, is that it's okay to request a path in a specific direction, but any portion of the distance past the edge must be clipped off so that the AI simply paths to the edge and then stops.


These also shared the problem of getting stuck at the edges of the map, because loiter is a state they can enter as well. And loiter was simply broken. As for their intended behaviors, we may increase their aggression, and shorten their loiter radius so that they stay a little closer to their spawn area.


The Risen grunts would occasionally have issues with movement, too. We also went through some experiments with their attacks, like a powerful knockback blow that they could deliver. I don't think that was very popular.

Some of the newer Risen are modeled after classes that players can use, such as the Druid and Champion, and have the ability to use powers that only players could up to that point. It's impressive that they came together so quickly albeit in a rough form, which really speaks to the power of some of our systems.


It's totally unknown, right? I mean, if you really just stare into space and think about it... like, whoa.

We know we want to tackle a few things next. The AI must manage themselves better when they are crowded in with other AIs and players. The AI also needs to behave appropriately (not necessarily realistically) when parcels are added, removed, rotated, or moved, and when building pieces are placed or unplaced.

Here's the breakdown:

Parcel movement or rotation

AIs will be moved/rotated to their new relative position/rotation within the parcel.

Parcel addition

AIs will be free to roam on the new land if they happen to reach it once the new navmesh region is generated and stitched to the surrounding navmesh. (This happens in the background). AIs that spawn on these new parcels will act like you'd expect -- they're free to do whatever they want once the parcel’s navmesh region is updated.

Parcel removal

AIs on a parcel that is removed will blink out of existence. Sorry not sorry. Since they ultimately came from a spawner, there will be new ones to take their place in short order anyway (unless the removed parcel housed the spawner).

Building placement

AIs will block placement until they move out of the building’s footprint or are killed. (If they are dead, their corpses and any items they have will also be lost forever.)

Building un-placement

AIs will be free to roam the freed-up footprint once the new navmesh region is generated and stitched to the surroundings.


With the reintroduction of AI, we have a desire to proceed with caution. So initially, AIs cannot climb steep inclines, nor can they get too close to static obstacles like trees, rocks, walls and steep terrain. We will slowly roll these capabilities back out as we collect reports from the playtests and gain better confidence in the refactored behavior code.

Crowfall AIPath Watermarked-1024x646


I just said that AIs can't get too close to obstacles. Well, they can. And they will. And they will occasionally get stuck. Hopefully not as much as they did before. We are tracking the issue down, but in the meantime, you can usually free them by attacking and moving off in another direction.

AIs also have trouble navigating around one another. We don't tend to have large crowds of them, so this issue isn't as bad as it may seem, and we don’t have to commit resources to an extremely robust crowd system. Due to this current limitation, however, their melee range is artificially bumped at the moment, so they can hit you from the back row. We do have a brain state that helps AIs to encircle their target, but there's still a little more work to do on that before we introduce it into the live testing environment. Some form of dynamic avoidance will help matters, too.


We hope you enjoyed this update on the state of AI in Crowfall. Our plans for it are not hugely ambitious, but we must reach a level of stability, performance and feature set that makes the team and all of you contented enough that we can snap our focus back firmly to everything else that will make this game great.

Your testing and feedback has helped us get to where we are. You can really help us out a lot by identifying AI bugs and providing videos, screenshots, or repro steps.

Thanks for reading, and I’ll see you on the forums and in-game.

Chris Ledwith Principal Programmer, ArtCraft Entertainment

need help??