Publishers of technology books, eBooks, and videos for creative people

They're Behaving Like Monsters! An Introduction to Stimulus-Based Behavior in Computer Role-Playing Games

• Print

Combining the Stimuli

If implemented properly, these stimuli can make for some very interesting and unpredictable results, as shown in the following examples.

Example 1: A goblin has to choose between fighting a closer, weaker rat or a slightly stronger one a little further away. He'll move toward the weaker one first. If the larger rat is guarding something of value, though, desire outweighs practicality and the goblin might change his mind.

```#####..##
#......r#  g = goblin  (strength 4)
#....g..#  r = rat   (strength 2)
#.R.....#  R = big rat (strength 4)
#########```

Example 2: If the same goblin is presented with the following situation, his fear of the troll would cause him to move left and up alongside the rat (r). He may or may not attack it, but would eventually move away to the left. The main goal of the goblin at this point is to avoid the much tougher troll (T). Two goblins may still avoid the troll, but three goblins might be bold enough to attack it.

```##########
....r....#  g = goblin (strength 3)
###......#  r = rat   (strength 2)
#.....T.  T = troll  (strength 6)
#..g...#
#......#
########```

Example 3: A group of goblins encounters a dragon. Because the dragon is stronger than the entire band together, all of the goblins will likely flee. If the dragon were slightly less powerful than the sum of the goblins, some interesting behaviors could result.

```##########
#.D......#   g = goblin (strength 3)
#...g....#   D = dragon (strength 25)
#..gg.g..#
#..gg....#
#...g....#
####.g####```

Example 4: Our lone goblin weighs the risk of the traps against the risk of being eaten. Depending on how far away the dragon is, he might risk running through the traps, since, if he tried to go around them, the dragon would most likely attack.

```############
#.......XX.#
#.....g.XX.####   X = traps (strength 4)
#.......XX.....   g = goblin (strength 3)
#.......XX.####   D = Dragon (strength 25)
#....D.....#
############```

Example 5: Here the goblin would probably allow his greed to get the better of him. Even though he's frightened by the zombies, the three heaps of gold may prove to be too much temptation to ignore. As he gets closer, his fear increases, so he may just grab one pile and take off for the safer exit.

```####..####
#........#    z = zombie (strength 5)
#......\$.####   \$ = heaps of gold
#.g...\$.z.z..   g = goblin (strength 2)
#......\$.####
##########```

Example 6: A dwarf takes refuge behind a barrier, which allows us to reduce the threat value slightly. As a result, our goblin may be less afraid. If the dwarf moves around the barrier and after the goblin, the threat increases and the goblin will flee in the opposite direction. If the dwarf stays still but starts firing arrows, the threat increases, likely causing the goblin to flee.

``` #########
#...d...#   X = barrier
#..XXX..#   g = goblin
###.......###  d = dwarf
......g......
#############```

Interesting behavior: Let's say that we have a greedy but very cowardly goblin. If the goblin comes upon a strong warrior hauling a nice assortment of treasure, he'll stay back a few spaces, moving further back as the warrior encounters other monsters (due to the increased threat level of that area) and moving closer if the warrior is injured (and therefore becomes weaker). The goblin would essentially "tail" the warrior, picking up any goodies left behind, and moving in closer only if the warrior is weakened enough for the goblin to finish him off.