The Monsters of Adi’s Maze

In Adi’s maze the player has the objective of collecting coins, while trying to avoid the monsters. We wanted each monster to have a unique set of behaviours giving the impression of a personality. We were assisted in this process by one of our first play-testers who’s descriptions of the monsters provided inspiration for their names and characters.

Ditsy

We wanted an unpredictable monster, so we came up with the idea for Ditsy. Ditsy has the most simple algorithm of all, at each junction Ditsy picks a random direction and continues to move.You can never predict his behaviour because it is basically random. Ditsy doesn’t try to move to a specific point in the map, and he doesn’t try to chase the player.

Squiffy

Squiffy is a hunter, she wanters round the map until she sees the player, once the player has been seen, she chases them. To achieve this behaviour, Squiffy follows the same random wandering behaviour as Ditsy. This allows her to search the environment reasonably effectively. Once the player is seen (i.e. they are on the same corridor, with an unobstructed line-of-sight) then she begins to move towards the player’s position. If the player turns at a junction, moving out of Squiffy’s line-of-sight, then squiffy logs the direction of that turn. Once Squiffy gets to that junction she turns the same way, effectively “chasing” the player. If after taking that turn, the player is still out of Squiffy’s line-of-sight (because they have turned a second time) then she returns to her random wandering behaviour.

Stinky

We wanted a character to patrol the border of the map, and we designed Stinky to do that. Originally Stinky was designed to be a zombie-like character, a visual metaphor for his repetitive behaviour. However, one of our early play-testers suggested that he would look better if he expelled noxious gasses, so we included that suggestion… Stinky was born! 

Stinky is spawned on the border, and he moves from corner to corner until he sees the player. Once the player has been seen, he chases the player using the same algorithm as Squiffy. If he loses the player after chasing them away from the border, he randomly wanders using the same algorithm as Ditsy. Squiffy continues to randomly wander until he reaches the border. Once back on the border, he continues to patrol following his original behaviour.

Red (rename)

Red switches between two behaviours, Stinky’s and Ditsy’s. She switches her behaviour every 10 to 13 seconds between a Patrol State, and a Wander State.

While she is in a wander state she moves randomly around the environment. When she is in a patrol state she follows Stinky’s border patrolling behaviour. Specifically If she is on the border, she patrols around it, if she happens to be in the centre of the maze she randomly wanders. This produces a character that deviates around the environment, but generally stays close to the edges. However, unlike Stinky, chomp doesn’t chase the player.

Chomp

Chomp is indented to be the mirror of Stinky. While Stinky patrols the centre of the maze, Chomp guards the centre.   When Chomp reaches a junction she looks at all the possible connected junctions and adds these options to a Array. She then measures the distance to the centre of the maze along the X and Y axis.  This measurement is used to weight the various direction options.

For example, If Comp was at a 3 way junction with the option to move, Up, Right, and Left. These 3 options would all be added to its movement table. In this example, Comp is in the bottom left of the map, 3 tiles down from the centre, and 2 tiles to the left. The directions that would take comp closer to the centre are Up and Right. These options are weighted based on the distance measure. So, (in this example) Up is weighted 3, and Right is weighted 2. We can think of this as an array with the following  six entries:

Left Up Up Up Right Right

Chomp then generates a random number between 1, and the length of the array (6).  The random number is used to select the direction that chomp will turn, but selecting the direction in that position in the array. For this example, the number 3 has been randomly selected, this corresponds to the direction Up.

1 2 3 4 5 6
Left Up Up Up Right Right

Using this method Chomp performs a basic greedy search towards the centre of the maze. The non optimal direction (in this example – left) is kept as an option (though not weighted) for two reasons. Firstly it provides Chomp with a small amount of random deviation, keeping her slightly unpredictable. Furthermore, this random deviation helps to stop her getting stuck in dead-ends (which may be a local optimum).

The closer Chomp gets to the centre, the less weighting each direction option has, making the movement more random. This results in Chomp wandering around, close to the centre of the map.

If Chomp see’s a player, they chase them following the same behaviour as Squiffy. If they lose lose the player, they return to their centre-guarding behaviour.