Skip to content

Enemy Behaviour

erniecy0124 edited this page Aug 31, 2026 · 1 revision

Introduction:

The Enemy Behaviour determines how an enemy responds and interacts with the player and its environment. The existing framework includes features such as wandering and chasing, which are implemented for enemies in EnemyFactory.java. To support multiple types, behaviour values are stored in the config files, allowing behaviours such as detection range, wander range, or chase distance to be altered for each distinct enemy type.

Implementation:

To alter an enemy's behaviour, its values could be reconfigured in Enemies.json. This allows enemy types to have their own behaviour within the game without hardcoding the behaviour and making it universal for all enemy types:

image

These config values are called in CreateEnemy(Entity, EnemyConfig)

image

Enemy behaviour will also change based on its attack style (chase/range), and its task will be determined based on its categorisation

image

Flow Diagram

image

Testing:

Enemy behaviour is tested inside the game environment through observation. Various config values were used to test the enemy's detection range, chase distance and its attacking behaviour (stationary/continuous chase).

Clone this wiki locally