Ai System

In Sons of the Forest, the artificial intelligence system for each living entity is designed to provide a dynamic and evolving experience for players. This is achieved through a set of cognitive capabilities known as "thoughts," which generate paths for each entity based on a variety of variables that adapt and evolve in response to the player's actions and decisions. To achieve this level of complexity, the game's AI system uses a rule-based modeling approach, which allows for the pre-programming of specific rules and constraints that guide the entities behavior. Each entity within the game is categorized based on their name, emotions, fear, anger, and energy levels which significantly influence their interactions with the player.

Although this type of information may not be visible to the player, it plays a crucial role in comprehending the game's artificial intelligence system. By leveraging rule-based modeling, the Developers are able to create a rich and immersive experience that provides players with a dynamic and evolving gameplay experience.

## Entities

### **Name**

In most cases, an entity's name corresponds to its model or characteristics. For example, Moose, Turtle, MuddyMale, and MuddyFemale are simple names used to identify entities lacking complex features. However, the naming for regular cannibals differs, as they may be referred to as Carl, Andy, Angel, Billy, Danny, Brandy, Crystal, or Destiny. The origin behind these names remains unknown.

* Angel
* Danny
* Andy
* Billy
* Carl
* Destiny
* Brandy
* Crystal
* Goldmask
* Muddy Female
* Muddy Male
* Fat Male
* Fat Female
* Heavy Male
* Faceless Male
* Fingers
* Demon
* DemonBoss
* John2
* MrPuffy
* Miss Puffy
* MrPuffton
* MrsPuffton
* Slug
* Timmy
* Kelvin
* Virginia
* Moose
* Rabbit
* Squirrel
* Seagull
* Deer
* Land Turtle
* Humming Bird

### **Sentiment**

Sentiment plays a crucial role in Sons of the Forest, influencing how the cannibal AI remembers past interactions with the player. The only way of decreasing sentiment towards the player amongst entities involves causing them damage through any means possible. If a cannibal endures severe injuries and remains alive, its negative sentiment towards the player will persist for an extended duration. Notably, entities such as the Golden Mask Cannibal maintain their sentiment towards the player, even if they are subjected to attack from the player.

While the full extent of sentiment's effects remains uncertain, it currently serves no practical purpose within the game. However, there is a possibility that the developers will allow players to establish friendly relationships with certain cannibals or offer tributes in the future. As of now, sentiment levels will only increase if interacting with Kelvin or Virginia.

### **Fear**

Fear works in a similar manner to sentiment. It is important to note that there are two types of fear in the game. The first is player-influenced fear, which is relatively straightforward and is a direct response to the player's actions. The second type of fear is more complex and is based on general environmental factors. This type of fear is more challenging to explain and understand.

Player-influenced fear can be interpreted as a rational behavior which varies for different entities. For instance, Dirty Cannibals normally begin with a value of 30 fear, in contrast to a normal cannibal which starts at 0. This value prompts entities to flee from player when their fear level approaches 100. Fear levels can currently only be increased by shooting guns or by building custom effigies.

Despite the presence of this variable, it is still possible for cannibals to flee even when their fear level is at 0. Taunting cannibals with a severed head is one method. This type of fear is primarily driven by the environment surrounding the entities. This can result in cannibals making more unpredictable decisions compared to the player-influenced fear, which typically only causes cannibals to flee with 100% predictability.

The best way to comprehend this type of fear is by comparing it to human stress during a fight. The fear level of a cannibal, for instance, may start at around 20 during a fight, but can quickly increase to 100 as they suffer damage. During such situations, fear levels tend to fluctuate frequently, rising and falling in response to changing circumstances.

### **Anger**

The most influential variable among the bunch is anger, which directly affects entities within the game. Essentially, anger represents the probability of a cannibal attacking the player. Although this variable is not fully understood, it is established that the initial anger level of cannibals at the start of a game is 10 towards the player, which increases based on the player's actions throughout the game. Actions such as destroying villages, killing cannibals, being in a village camp, being in close proximity to cannibals, cutting trees, and shooting either at cannibals or in general can all contribute to an increase in the anger level. Once it reaches 100, cannibals will exhibit aggressive behavior and will actively pursue and attack the player. As of now, there is no way to decrease this variable. Consequently, players cannot maintain peaceful relationships with any clans or cannibals.

The game employs two types of anger levels, which are player-influenced and environment-influenced. The former is determined by the actions of the player, while the latter is determined by various environmental factors, such as the presence of enemies or perceived threats. These anger levels are known to fluctuate frequently, rising and falling in response to changing circumstances. Their impact on the behavior of the entities makes them a crucial variable to consider when playing the game.

In the most recent update, the developers have calibrate anger levels for certain entities of the muddies cannibal. It appears that the anger levels for this entity have been reduced from 10 to 6, resulting in a decrease in their level of aggression. In the foreseeable future, we anticipate that such changes to entities behavior may become more frequent. As a result, we plan to make a board to monitored all entities when it will be necessary.

### **Energy**

Energy can be considered a variable that is shared between the player and other entities in the game. This parameter is crucial in providing a realistic experience for the entities, as it introduces a sense of vulnerability and limits their endurance, similar to that of the player. With each movement, an entity loses 0.1 units of energy. However, certain entities such as the golden cannibal may deplete their energy reserves at a faster rate, especially when charging at the player. Depending on the type of attack, the energy loss for an entity can range from 2-3 units for a slash, to 6-9 units for a powerful strike.

In addition, Kelvin, one of your companion in the game, is also affected by this variable. His ability to perform tasks and assist the player is directly impacted by his energy levels. For instance, chopping trees in quick succession can cause him to lose up to one energy level per second. Once he finishes the task, Kelvin will take a break and rest to gain energy levels. Despite Kelvin having a limited amount of energy, he is capable of continuing to perform tasks even when his energy levels have been depleted to zero.

## Memory

Memory is an important component of an entity's decision-making process because it enable entity to recall past actions. However, not all interactions and events can be stored in memory, as it would require significant computational resources. Instead, only important events and interactions that have a significant impact on the entity's behavior are recorded and retained in memory. This includes fighting regular cannibal, fighting muddies, getting sticks and firearm usage by the player.

Each entity's memory value decreases by 0.01 every 3 seconds, which means that the impact of past events and interactions on an entity's behavior decreases over time. However, the memory value will stops decreasing once it reaches a certain threshold, which depends on the frequency and intensity of the observed actions of the player. For instance, when a player attacks a village and engages in combat with a member of a cannibal family, the event is recorded in the memory of the entire family and influences their behavior towards the player. It is important to note that if the player fights a certain type of cannibal close to other types of cannibals, this event will be recorded in their memory and will have a lasting impact on their behavior.

**A point to note is that Cannibals in the game will not remember if you spare them or their injured family members. However, they can retain other values such as fear and sentiment towards the player. It's important to consider that these entities are not capable of complex emotions or thought processes beyond what is programmed into their AI. So, while they may exhibit certain behaviors and responses, they do not have true memory or consciousness like a human being.**

## Stats

The variables referred to as "stats" are integral to the behavior of all entities. However, the current implementation of this variable is incomplete and requires further refinement from the developer as it has little impact on their behavior. As of now, Entities are not penalize for having low values for their stats. The statistics are categorized into three main components: fullness, hydration, and energy.

Fullness will varies depending on the entity's food intake. For example, cannibals exhibit little to no fullness and rely on consuming body parts to replenish their fullness levels rapidly. Although they seem to exhibit hunting behavior, it has yet to be observed in action. In contrast, animals such as birds display more apparent fullness behavior, as they actively seek out sources of food and water. The seagull is a notable example of this, as it will land to consume something on the ground, even though it cannot be interacted with. Fullness levels decrease by 0.1 for every entity every 2-3 seconds.

Hydration levels are essential to the survival of all entities and can be replenished by consuming any available source of water, including cave water for the blind mutants. Hydration may become more apparent in the future as it has the potential to significantly impact the behavior of entities if not consumed. Currently, however, it is not a requirement for entities to consume water and does not have a significant impact on their behavior. While cannibals may occasionally be observed consuming water from a nearby body of water, it is not a priority for them. As of now, hydration levels decrease by 0.1 approximately every 0.7 seconds.

## Status

Each entity within the game has a permanent status that communicates its current actions to the game in real-time. These statuses are categorized based on their specific meanings, which can vary depending on the entity's current situation. The following are all of the possible statuses:

* Flying
* Combat
* Sleeping
* Exploring World
* Captured
* Swimming
* Dead/Dying
* Underleaves
* Injured
* Burning
* Electrocuted
* Onrock
* Leave Combat
* On tree

## Thoughts

In AI, thoughts are essentially programmed decision-making processes that determine an entity's behavior in response to various environmental factors. In other word, They are essentially sets of rules or instructions that the AI of entities will follow for their next action (the rules are designed to be flexible). Since there are numerous factors that can influence an entity's behavior, there are countless thoughts that can occur. These thoughts are often programmed with a degree of randomness, to make the entity's behavior appear more natural and unpredictable.

### Full List

To facilitate a comprehensive understanding, I will make a list of all thoughts an entity may possess by their status:

Dying/Dead

Flying

On rock

On Tree

UnderLeaves

Injured

## Behavior

Each entity exhibits a unique and distinct behavior. To gain insight into those behaviors, understanding and analyzing their patterns is necessary. In the following section, a comprehensive presentation of each entity present in the game will be provided, along with a detailed analysis of their observed behaviors in-game:
TBA

### Turtle

The reptilian entities tend to remain in offshore with occasional forays onto land for purposes such as exploration or laying eggs. Their behavior is relatively simple, lacking complexity and they do not display any signs of attempting to seek food or water. Furthermore, they appear to be free from predation by Cannibal entities. It is worth noting that when their eggs hatch, baby turtles emerge which cannot be interacted with or harmed in any way, and thus, do not qualify as a separate entity.