Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Tutorials Unity Shader Python Arduino Machine Learning

Maths for Gamedev

Alan Zucconi in Discussion, Games, Science | July 27, 2020

The AI of Creatures

This is the complementary article to the short documentary titled “The AI of Crea-
tures“, which provides links, references and resources for you to delve further into
the world of Creatures.

Join me as we travel back in time to revisit this old classic that literally made the
history of Artificial Intelligence AND Artificial Life.

The AI of "Creatures" ● Alan Zucconi


Teilen

Ansehen auf

Back in 1997, my father brought home one issue of “Le Science”, the Italian edition
of the popular magazine “Scientific American”. Leafing through the pages, one arti-
cle in particular caught my attention. It talked about a videogame which dared to
do what no other game had done before. I was 11, and little I knew that article was
going to change my life.

Creatures is often described as an Artificial Life Simulator. In the game, you have to
look after small furry creatures called Norns. Hatching and raising them, until
they are self-sufficient. A glorified Tamagotchi on steroids, if that makes sense. But,
unlike a Tamagotchi, Norns were alive. Or at least, as close as you could get with an
Intel Pentium in 1996. Behind their furry look, the actions of each creature were
controlled by a primitive, yet sophisticated neural network. Norns might not have
been alive, but they were definitely intelligent.

Ok …perhaps they were neither of those two things. But they could learn. From ex-
perience… from each other… and, most importantly, from us. Creatures was de-
signed around the very concepts of empathy and nurturing. Making it the closest
experience possible to having a pet. To this date it was, and it still is, an experience
unmatched by any other computer game.

But how could, a game that is almost 25 years old, succeed where even modern
games are struggling? Please, join me on this journey to discover the AI of Crea-
tures.

Small Furry Creatures


“Small Furry Creatures” was one of the proposed titles for Creatures. The name
was chosen in place of “Little Computer Ewoks“, which felt too derivative. The
title originally appeared on an article written by Steve Grand in 1993: Small Fur-
ry Creatures: The Mythography.

The Game

The World of Albia


Creature’s secret lies hidden in the complex and interactive ecosystem that it mod-
els,
which provides the perfect ground for emergent behaviours. Norns live on Albia, a
disk-shaped planet which features a variety of different environments. Caves,
Mountains, Islands, Beaches. And the remnants of an ancient civilization which is
nowhere to be found.

With a size of 8352×1200 pixels, Albia was about 10 screens wide and 2 screens
tall. Below, you can see the full background used in the original Creatures. You can
use the mouse to zoom on it. The map also shows features that are normally hidden
in the game.

The Agents
Albia is actually static, being little more than a fancy background, but it is filled
with dozens of agents: objects that the Norns can interact with for things like food,
entertainment and transportation. Each object is a small program in itself, written
in an assembly-like language called Creatures Agent Object Script—CAOS, for
short.

Creatures is, effectively, an interpreter that executes CAOS code. Which allowed
players to customise virtually every aspect of the game.

CAOS
The CAOS language was very low-level, and seemingly impossible to decypher.
This is because the code uses a log of magic numbers, constants which have a
specific meaning, but no symbolic representation.

The following CAOS command, for instance, injects the selected creatures with
the progesterone (a chemical substance which helps to progress pregnancies):

1. stim writ norn 10 255 0 0 66 255 0 0 0 0 0 0

In here, 66 is the magic number that represents progesterone, and the 255 next
to it indicates the amount that has to be injected in the creature. The remaining
zeros are used to indicate that no other substance should be injected, since the
stim writ command injects four chemicals at a time.

The full list of chemical IDs can be found here, but this obviously makes for a
rather obscure language.

Below, you can see a proper script that injects in the world a toy Norns can inter-
act with. This script is taken from the Creatures Development Network website,
which also provides comments line-by-line.

1. ***create the Meerk Toy


2. inst
3. *create one under the Norn garden
4. new: simp 2 21 1000 "Meerk" 0 0 5000
5. attr 199
6.
7. clac 0
8.
9. bhvr 43
10. accg 3
11. elas 0
12. fric 100
13. pose 59
14.
15. puhl -1 40 30
16.
17.
18. mvto 1850 950
19. cmrt 0
20.
21.
22. **activate 1 event
23. scrp 2 21 1000 1
24. clac 1
25. stim writ from 97 1
26. anim [94 95 96 97 98 98 97 96 95 94 255]
27. sndc "mb_2"
28. wait 130
29. pose 59
30. endm
31. **activate 2 event
32. scrp 2 21 1000 2
33. stim writ from 97 1
34. anim [22 23 24 25 26 27 28 29 30 31 32 33 59]
35. setv vely -15
36. sndc "ct_1"
37. clac 0
38. endm
39. **hit event
40. scrp 2 21 1000 3
41. stim writ from 97 1
42. sndc "hit_"
43. anim [70 71 72 73 74 75 76 77 78]
44. over
45. wait 10
46. pose 59
47. endm
48. **pickup event
49. scrp 2 21 1000 4
50. pose 0
51. endm
52. **drop event
53. scrp 2 21 1000 5
54. pose 59
55. endm
56.
57.
58. ****REMOVAL
59. rscr
60. enum 2 21 1000
61. kill targ
62. next
63. scrx 2 21 1000 1
64. scrx 2 21 1000 2
65. scrx 2 21 1000 3
66. scrx 2 21 1000 4
67. scrx 2 21 1000 5

Creatures Caves is currently one of the few places still available where you can
learn how to code in the CAOS language.

The Creatures
The world of Albia is also inhabited by two main species of creatures: the furry
Norns and the vicious Grendels. The game gives life to these creatures by simulat-
ing three of the most fundamental processes that keep us alive.

The vital signs of each creature are controlled by a complex network of chemical
reactions, which simulate processes like breathing, eating, and everything in be-
tween.

Within the game, the “Biochemistry” tab of the “Science Kit” offers a chance to peek
inside a creature’s bloodstream.

Every action a creature does is decided by a self-organising neural network,


which is constantly rewiring itself based on the rewards—and punishments—that
are being received.

And all of this, is constructed from a series of instructions, which serve as a digital
equivalent of our DNA. Norns can mate with each other, transmitting their physi-
cal, biochemical and behavioural traits to their offspring. This is ultimately what
allows for real evolution to take place in the small, simulated world of Albia.

The original Creatures shipped with three breeds of Norns.

Banana Norns Pixie Norns Horse Norns

The Player
Finally, the last entity that plays a role in Creatures is the player. Your hand does
more than just interacting with the creatures. Your direct actions can promote—or
discourage—Norns from doing certain actions, effectively training their neural net-
works to follow your rules.

The Brain
Creatures was so technically advanced that you could literally talk to your Norns,
and they could talk back to you. But how could, a game developed in 1996, achieve
so much …with so little computational power available?

First-generation Norns are controlled by what we would call today a four-layer


neural network, consisting of 952 neurons and around 5000 connections between
them.
These neurons are organised in 9 functionally distinct groups, which Creatures
called “lobes”, to mirror the terminology used to study and classify actual brains
(below).

You can have a closer look at a creature’s brain using this spreadsheet: Brain Struc-
ture.

In the game, each creature can perform 11 actions such as moving left, moving
right, stopping, sleeping and speaking. All of the others (like pushing and pulling)
require an object instead. The behaviour of every creature is then defined by two
pieces of information: which action to perform, and which object to perform it
onto.

This is reflected in their brain structure, which has two lobes called “Decision” and
“Attention”. Respectively, they choose which action to take, and which object the
creature has focused their attention onto.

The Decision lobe has a neuron associated with each action that can be performed.
At any given time, a creature is performing the action associated with the neuron
that has the highest value. This behaviour is called “Winner Takes All”, since only
the strongest neuron in the lobe is the one that will ultimately determine which ac-
tion the creature is doing.

Actions
# Actions Description

0 Quiescent

1 Push / Activate 1 push food: eat


push norn: sex
push vehicle: go left
push lift: go up

2 Pull / Activate 2 push norn: sex


push vehicle: go right
push lift: go down

3 Stop / Deactivate

4 Come Approach the target

5 Run Retreat from the target

6 Get

7 Drop

8 Think / Say Speaks

9 Sleep

10 Left

11 Right

12 unused

13 unused

14 unused

15 unused

The Attention lobe, instead, has 40 neurons, enough to represent the 26 categories
of objects in the game. The neuron with the highest value determines which object
the creature will be focused on.

Object classes
# Object classes Description

0 Current Norn

1 Hand

2 Call button

3 Water

4 Plant

5 Egg Creature eggs

6 Food

7 Drink

8 Vendor

9 Music / Instrument

10 Animal

11 Fire

12 Shower / Shooting

13 Toy Small toys that can be carried around

14 Big toy Large toys that cannot be carried around

15 Weed

16 Incubator

17 unused

18 unused

19 unused

20 unused

21 unused

22 unused

23 unused

24 unused

25 unused

26 Mover / Vehicle

27 Lift

28 Computer

29 Fun The A/V projector

30 Bang Guns and cannons

31 unused

32 unused

33 unused

34 unused

35 unused

36 Norn

37 Grendel

38 Ettin

39 Shee Unused in the original Creatures


Sometimes referred to as “Geat”

For instance, if the decision is “push” and the attention is on “food”, the creature
will eat the closest piece of food. Yes, pushing food in Creatures is how you eat it.

Deciding which object the creature is interested in is relatively easy to calculate.


Each neuron in the “Attention” lobe (and, consequently, each class of object the
creature can interact with) is connected to the “Stimulus Source” and the “Noun”
lobes.

Like the “Attention” lobe, they both have 40 neurons each, which maps again onto
the types of objects available in the game. Neurons in the “Stimulus Source” lobe
fire up based on which objects are being seen by the creature. If a creature sees a
toy, the neuron associated with the concept of “toy” will increase its activity. And if
the toy is making a sound, its neuron will be even more active.

Neurons in the “Noun” lobe, instead, activate when the player is typing the name of
an object. Typing “push toy”, for instance, will cause the neuron associated with
“toy” in the “Noun” lobe to fire up.

This allows some control over which object a creature will act upon, regardless of
how interesting it is. Both the “Stimulus Source” and the “Noun” lobes operate on a
“Winner Takes All” policy. Meaning that at any given time, only the most attractive
object and the most recent spoken word are being considered.

The “Attention” lobe sums up the results from the “Stimulus Source” and “Noun”
lobes (below).
The neuron with the highest response will determine which class of object the crea-
ture is looking at.

In the same way the “Attention” lobe determines what class of object a creature is
looking at, the “Decision” lobe determines which actions to take. Each neuron cor-
responds to an action the creature can perform, such as going left, going right,
speaking, pushing, pulling, and so on. Every second or so, the neuron with the
highest value determines which action the creature performs.

Each neuron has 256 connections, from as many neurons in the “Concept” lobe
(below). You can imagine neurons in the concept lobe as “situations” the creature
can be in. Out of the 256 connections each “Decision” neuron can receive, 128 of
these will contribute positively towards the action it represents, suggesting it is the
right thing to do.

The other 128 will contribute negatively, discouraging the creature from perform-
ing a certain action in the situation they represent. The “Concept” Lobe is not only
the biggest lobe, but also the most complex. Each neuron receives inputs from one
to three other neurons in the “Perception” lobe.

Intuitively, its neurons fire up when certain situations occur. For instance, a specif-
ic neuron could represent the condition “I am hungry and food is near me”. The
concept lobe is, essentially, a collection of “perceptible things”.

Each neuron is in fact connected to the “Perception” lobe, which contains all of the
inputs (“the perceptions”) that a creature can use for their decision making.

In reality, the perception lobe is nothing more than a container for the “Drive”, the
“Verb”, the “General Sense” and the “Attention” lobes. This was necessary because,
due to technical limitations, a lobe could only be connected to two other lobes.
Copying the values of four lobes into a new one, allowed to overcome this limitation
and to connect all of them to the “Concept” lobe.

The “Drive” lobe has 16 neurons, 13 of which are used to indicate the physical and
emotional state of a creature. Its neurons map drives such as “pain”, “hotness”,
“coldness”, “hunger”, “fear” and so on, which mirrors the creature’s chemical reac-
tions in their body.

Drive Neurons
# Drive Description

0 Pain

1 Need for Pleasure Boredom

2 Hunger

3 Coldness

4 Hotness

5 Tiredness

6 Sleepiness

7 Loneliness

8 Overcrowdedness

9 Fear

10 Boredom

11 Anger

12 Sexdrive

13 unused

14 unused

15 unused

Similarly, the “General Sense” lobe is used for specific events such as being patted,
being slapped and bumping into a wall. Some neurons also activate based on prop-
erties of the object the creature is interested on (whether is active or not, for in-
stance) and, if they are watching another creature, they can also tell if it is of the
same species and whether or not it is their parent, child or sibling.

General Sense Neurons


# General Sense Description

0 I’ve been patted

1 I’ve been slapped

You might also like