10 May

Let's Talk Animal AI

By Caspian

Hey Everyone!

With us on track to finish development work by the end of this month for our first KoE backer playtest, our next episode of Inside Chronicles of Elyria will be focused on showing off the foundation laid so far. In the interim, we wanted to share a little bit more about what to expect from the furry inhabitants of both Chronicles of Elyria, and more immediately, Kingdoms of Elyria.

Many games have simple AI routines for animals; and most traditional MMOs fall into this trap. Their animal population tends to roam in a small area, with no actual habits or wider intention. They come into existence based on pre-placed spawn points, are largely ambivalent of the world and, as a result, players often give little thought to how their actions may affect the AI of animals around them.

But animals, whether domesticated or wild, are an incredibly valuable component of the world of Elyria. From acting as a food source and offering other key resources (see A Closer Look at Gathering Resources) to providing a source of dynamic content (such as animal raids and infestations) they are fundamental to player progression and conflict, irrespective of whether you’re rearing livestock such as cows, sheep, or chickens, or exploring the wilds to tackle creatures head-on.

In CoE and KoE, we approach animal behavior in a unique way, giving them a set of both primal personality traits and needs like their more advanced counterparts - the non-player citizen.

Personalities

NPCs make decisions in part by their personalities. This includes a spectrum of attributes that together determine how likely they are to help you or hurt you, be sympathetic to your cause, or be willing to share information with you. Now, the animal “personalities” are far more primal in nature and are designed to represent something more akin to animal instincts.

We break these instinct types down into five key areas, which are then broken down further into behaviors. You can see the instinct areas in the image below.

Animal AI

Each serves a distinct purpose depending on the unique animal, and while there’s some natural overlap, this approach allows us to create animals the behave differently even in the exact same circumstances.

Take the humble chicken. As you’ll be keeping plenty of these on your settlement, especially considering they offer both meat and eggs, they fall into the following categories:

  • Domestic (because they stay within the radius of your settlement)
  • Colonial (because chickens tend to flock together)
  • Diurnal (because they’re active during the day)
  • Neutral (because they really don’t care too much about humans going near them)
  • Grazer (because chickens like to mill about on grass)

On the flip side, if we look at a predator such as a wolf, they do things a little differently. They are:

  • Wild (because they tend to stay away from settlements, preferring mountain regions or woodlands)
  • Colonial (because they prefer to roam as packs)
  • Nocturnal (because they’re primarily active at night to avoid the heat of the day)
  • Passive/Aggressive (because they’re bolder in packs, but timid when alone)
  • Forest (because they tend to prefer sheltered regions of a biome that make for easier hunting)

The purpose of applying AI in this way is so that we can differentiate what each animal consistently does, ensuring that, in most instances, players will be able to look at an animal and have a basic understanding of its habits, as well as anticipate and identify changes in behavior.

Needs

These changes in behavior are due to the other half of animal and NPC AI – Needs. While animals don’t have the full hierarchy of needs that NPCs do – such as the need for belonging, achievement, creativity, etc., they still have basic physiological and safety needs, and will take the necessary actions to fulfill those needs.

As an example, if a group of wolves attempt to hunt for food but are unable to find any (in line with their needs above), they may instead begin to raid villages because there's not enough food in the forest. This change in behavior creates a new challenge the players must overcome, or one that they can exploit against other kingdoms. This complex yet fragile ecosystem and the needs-driven AI intentionally create a source of imbalance and content generation by way of limited resources and competing needs.

Moving forward, our intention is to apply the above AI framework to all animals within Kingdoms of Elyria, with the desire to bring key Chronicles of Elyria wildlife into the frame, such as the Otterbear and Dryas Elk. The eventual goal is to deliver all creatures from CoE into Kingdoms of Elyria as our biomes expand out of our initial woodland habitat.

That all said, while the animal personalities will initially be in place, most of the dynamic behavior is yet to come. As it currently stands, by the end of the month animals in KoE will have only basic needs, with just their primary survival goal (to obtain food) implemented. From there, we’ll be adding more actions and goals based on their hierarchy of needs as development progresses.

The key aim in all of this is to ensure that our GOAP (Goal-Oriented Action Planning)-based system of AI offers dynamic, exciting behavior changes, with animals (and NPCs) using whatever actions necessary and available to them to achieve their goals. As time goes on, and as we give animals more awareness and actions to achieve their survival needs, a picture should begin to emerge as to the depth of gameplay animals offer in Kingdoms of Elyria and Chronicles of Elyria.