A framework for modelling believable behaviour of ambient non-player characters

The majority of computer games feature virtual computer-controlled characters, namely non-player characters (NPCs). They are an essential part of game worlds, providing the player with context, challenges, and interactions. Ambient NPCs are characters used to simply populate the game world. While these agents may not have a significant impact on the storyline of a game, they play a crucial role in enhancing the player’s immersive experience by creating a sense of realism. To achieve this, ambient NPCs must behave in a way that would be perceived as believable by the player. Among other elements, such NPCs should exhibit some degree of autonomy and also give the illusion of life.


Modelling human behaviour is a challenging task because humans are inherently unpredictable, and their decision-making process is not only controlled by rationality, but also conditioned by emotions. This project proposes a framework to model the behaviour of ambient NPCs to generate believable populations in game worlds.

 
The core concepts of the framework are: Traits, Needs, and Abilities. The Traits category, which includes kindness, provides ‘characterhood’ to NPCs, differentiating them from one another and also from other objects in the game world. Intentionality also plays a role in decision-making. The intention behind an action comes from the need to achieve a particular goal. The Needs category, which includes elements such as energy, captures this idea of intentionality, where the goal of an agent’s behaviour is such that these needs would be met. Lastly, the set of actions that an agent can perform would fall within the Abilities category.


Calendar, Inventory, and Environment are additional concepts defined in the framework to help shape NPC behaviour. The Calendar concept would define the schedule of an agent, which determines what they will do at specific times of the simulation. The Inventory component defines what an agent has in their possession. The Environment component defines the characteristics of the game world that the agents inhabit, such as time. It also includes non-NPC entities such as buildings and objects.

 
The behaviour of each agent in a simulation is determined by a rule-based system that uses fuzzy logic to define conditions for an action. This rule engine generates probabilities for actions that agents could take, based on the values of its inputs. These inputs could be the Needs and Traits of an agent, as well as Environment factors.


The framework follows the entity component system (ECS) architecture, where the NPCs are the entities. This architecture was found to be ideal, as it increased performance, flexibility in modifying the behaviour of entities, and also the reusability of the defined components.


To measure the credibility of the generated behaviour, the agents’ actions were encoded as behavioural traces. These traces were generated after each simulation run, and used for comparison and similarity analysis. This approach evaluated the framework’s ability to model believable behaviour. Furthermore, the results of each simulation were analysed to adjust the simulation input parameters, with the goal of improving the agents’ behaviour in future runs. The framework was also evaluated on its expressivity, in terms of varying simulation environments, by considering a few case studies.

Figure 1. The core concepts of the framework

Student: Mariah Zammit
Supervisor: Dr Sandro Spina