Saturday, 10 May 2025

Mating behaviour in C3 critters

Mating in C3 critters is a special state which is typically controlled by sex drive (OV21) increasing past a threshold (when they are old enough), and by a flag being set - although food is considered more important.

The normal logic flow in the timer script

 Typically, mating is switched on by OV00 (State) being 6, and it is an intermediate step in the normal logic flow in the timer of most C3 critters - which typically follows this pattern:

  1. increase age
  2. decrease energy
  3. if old enough, increase sex drive
  4. drown in water - lose energy rapidly
  5. if low on energy (sometimes also OR if too old) flag for death
  6. if hungry flag to get food
  7. if sex drive high, flag to mate
  8. obstacle checking - sometimes also water-shyness
  9. if flagged for death go to die subroutine
  10. if flagged to get food, get food
  11. if flagged to mate, mate
  12. if flagged to roam, roam

The logic flow in the timer script being arranged around two phases - first flagging, then checking the flags - is an example of a behaviour tree. This has the benefits of avoiding conflicts in behaviour, creating a predictable flow, allowing for lifelike complexity (flagging for multiple behaviours allows the system to choose between them with DOIF logic), while being performance friendly.

Mating strategies

Interestingly, some critters have male and female types (OV06 being 0 or 1) and find an opposite sex mate to impregnate (reusing some code from the hunting food behaviour, as in the hedgehog and the dragonfly), and some simply reproduce parthenogenetically (without needing to find or hunt a mate) when their reproductive drive is past a certain threshold (and they have enough energy), such as the hoppity.  Additionally, even some critters that find mates and get pregnant only use pregnancy as a binary state (pregnant or not) rather than having a gestation period.

Reproduction Step-by-Step: a Hedgehog in Love

Let’s walk through how a hedgehog goes from carefree youth to proud parent:

1. Maturity and Sex Drive

  • The hedgehog ages via the ov01 counter.

  • Once it passes age 1000 and enters adulthood (ov05 = 2), it starts building sex drive (ov20).

  • This happens gradually, simulating the onset of reproductive maturity.

Fun detail: The "youth" hedgehog is actually removed and replaced by an adult version—a trick to avoid bounding box errors.

2. Seeking a Mate

  • When sex drive (ov20) exceeds 200, the hedgehog changes state to "Find Mate" (ov00 = 2).

  • It searches nearby using genus and species markers (ov47, ov48, ov49) for a compatible mate of the opposite sex.

3. Mating Process

  • If a suitable mate is found, the state changes to "Mate" (ov00 = 6). If a mate is not found, the hedgehog returns to roaming behaviour. An error in this logic, fixed in the Norn Woodland Fix Patch, is that ov16 should not be set to null twice before calling the find subroutine, and that hedgehogs are curiously undiscerning of their target's gender when seeking a mate.

  • The mate subroutine verifies gender compatibility and, if successful, sets the pregnancy counter (ov70 = 1) for females.

  • The sex drive (ov20) is reset to 0 after mating.

4. Pregnancy and Birth

  • The pregnancy counter (ov70) increases over time.

  • When it exceeds 10, the hedgehog enters "Give Birth" state (ov00 = 7).

  • The layg subroutine handles the birthing process, spawning new baby hoglets.

Once their part in the mating ritual is finished, the parent hedgehogs return to roaming (ov00 = 0), ready to begin the cycle again.

Key Variables for Reproduction

  • ov06 – Gender: 0 = female, 1 = male

  • ov00 – State:

    • 0 = Roam

    • 2 = Find Mate

    • 6 = Mate

    • 7 = Give Birth

    • 99 = Die

  • ov20 – Sex drive level (increases with age and plays a role in determining when a hedgehog seeks a mate).

  • ov70 – Pregnancy counter: When it’s greater than 0, the hedgehog is pregnant.

  • ov01 – Age counter: When the hedgehog reaches a certain age (1000), the script starts checking for mating behaviour.

  • ov16 – Target (food or mate): Used to track the hedgehog’s current mate.

  • ov05 – Life stage (1 = youth, 2 = adult).

  • ov02 – Energy: Used for survival but also affects mating behaviour. If low, the hedgehog seeks food.

  • ov73 – Hunger threshold: If energy drops below this, the hedgehog seeks food.

Visualizing the Process:

  • Roam (ov00 = 0) → Find Mate (ov00 = 2) → Mate (ov00 = 6) → Pregnancy (ov70 1-10) → Give Birth (ov00 = 7) → Roam (ov00 = 0)

This flow ensures that hedgehogs mature, seek mates, reproduce, and care for their young, all while adhering to a life cycle that mirrors natural behaviours. Note that this is laser-focused on only the reproductive cycle, and seeking food takes priority in the hedgehog's mind - it cannot search for a mate until it has first checked if it is hungry.

 Bugs 

One particularly odd case is the dragonfly, whose mating behaviour appears to be a bit of a bug—literally and figuratively. While it starts the process of finding a mate using the same targeting logic as other critters, it sometimes treats them as prey instead of a partner—approaching the intended mate only to eat them rather than complete the mating process. This quirky behaviour likely stems from overlapping use of the ov16 target variable, the fact that dragonflies hunt their own whole genus, the fact that dragonflies are more likely to be in contact with energy-draining water bodies, and a bug in state transitions, causing the dragonfly’s natural instincts to blur in a way that's more predatory than romantic. This bug is fixed in the Steam and GOG.com editions of Creatures Exodus.

Conclusion: Added realism and depth

While the mating logic in Creatures 3 operates entirely behind the scenes, it plays a fun and crucial role in making the ecosystem feel alive, real and self-sustaining. It’s not something players typically see directly—but it quietly governs when critters reproduce, how they prioritise needs, and how population dynamics shift over time, such as when a norn develops a taste for hedgehogs.

At the heart of this system is a behaviour tree structure: a two-phase loop where the critter first flags possible actions based on internal variables (like hunger or sex drive), and then acts based on priority. This design avoids conflicting behaviours, keeps things running efficiently, and allows complex decision-making to emerge from relatively simple rules.

This kind of background scripting, although largely hidden from view, adds realism and complexity to your creatures’ world—creating behaviours that feel organic, even when driven by simple variables and checking a list of possible states.

Sunday, 4 May 2025

Hunger and Hunting in C3 Critters

Eating in C3 critters is a special state which allows them to keep living, and is a multi-step process beginning with low energy triggering the search, searching for food, finding food and hunting for food.

The normal logic flow in the timer script

Typically, getting food is switched on by OV00 (State) being 1, and it is the first step in the normal logic flow in the timer of most C3 critters - which typically follows this pattern:

  1. increase age
  2. decrease energy
  3. if old enough, increase sex drive
  4. drown in water - lose energy rapidly
  5. if low on energy (sometimes also OR if too old) flag for death
  6. if hungry flag to get food
  7. if sex drive high, flag to mate
  8. obstacle checking - sometimes also water-shyness
  9. if flagged for death go to die subroutine
  10. if flagged to get food, get food
  11. if flagged to mate, mate
  12. if flagged to roam, roam 

The logic flow in the timer script being arranged around two phases - first flagging, then checking the flags - is an example of a behaviour tree. This has the benefits of avoiding conflicts in behaviour, creating a predictable flow, allowing for lifelike complexity (flagging for multiple behaviours allows the system to choose between them with DOIF logic), while being performance friendly.

The gfod Subroutine: Your Critter’s Inner Forager

When it’s time to eat, the gfod (get food) subroutine takes over. It’s more than a simple “go to food” instruction—gfod is a nest of smaller routines: find, hunt, vect, anim, and move, all working together to give your critter a believable foraging pattern, while avoiding the common coding error of repeating yourself.

Let’s walk through the full food-finding journey:

Step 0.5: The Critter Gets Hungry

Every time the timer runs, the critter’s energy (OV02) drops by 1. If it falls below the hunger threshold (typically stored in another variable, OV73), the critter flags itself as needing food—and gfod is called into action.

Step 1: gfod — Search Phase Begins

This is where the critter starts searching for food:

  • Temporary variables (VA47, VA48, VA49) define what kind of food it’s looking for—based on family, genus, and species. A 0 means “any”.

  • If there’s already a food target saved in OV16, the critter jumps straight to hunting it with hunt.

  • Otherwise, it calls the find subroutine to scout for the nearest edible object.

Bonus: Some critters, like hedgehogs, have varied diets—gfod can be expanded to look for secondary food types if the favourite isn’t found. (Just be careful they don’t accidentally target themselves if the critter is looking for its own genus in general.)

Step 2: find — Locating the Nearest Snack

In this subroutine, the critter:

  • First sets up a temporary variable to hold a massive number (VA99 = 99999999) and then changes that to be the shortest distance found from a target food item (VA58).

  • Scans nearby objects using esee, filtering by the desired food types.

  • Calculates the squared distance to each object with the Pythagorean theorem.

  • If something closer is found, it updates the new, closer target (VA58) and sets OV16 accordingly.

  • If nothing is found, the critter gives up—for now—and sets the target to null before changing its direction.

Step 3: hunt — Move to Target and Eat

Once a target is locked in, the critter enters hunting mode:

  • It checks that the target (OV16) is still valid and hasn't disappeared.

  • It figures out the direction to move by comparing its own coordinates with the target’s, adjusting movement vectors (OV10 and OV11) accordingly.

  • When it reaches the target—touching it—the critter switches its state to the next one in the main logic's behaviour tree and tells the food it’s been eaten (mesg writ OV16 12) and adjusts its own energy. (targ ownr subv ov02 ov72)

Ants behave a bit differently here: instead of eating on the spot, they pick up the food (OV18 tracks the carried food) and head back to the nest, with a message (mesg writ OV16 4) sent to the food to signal collection.

Step 4. Return to roaming

The critter reuses a little roaming behaviour after it has been hungry, got food, found food, and hunted food successfully to randomly change direction and start moving - and the behaviour tree will continue on with other activities.

Conclusion: A Background Mechanic With Quiet Complexity

While critters eating is a simple background function in Creatures 3, it's a surprisingly intricate part of what keeps critters behaving believably. From hunger detection to food targeting and pursuit, the eating system is built with clear logic, modular structure, and enough flexibility to support varied diets, differences between critters, and environmental challenges.

It’s not flashy, and it rarely calls attention to itself if it's done well—but it quietly supports the broader simulation and creates a vibrant world for creatures to live in. By using a behaviour tree model, flag-based decisions, and reusable subroutines, the developers created a system for critters that’s both efficient and extensible.

Understanding how critters eat offers a window into how even the “invisible” mechanics in Creatures 3 are carefully crafted. It’s a reminder that beneath the surface of every lifelike action is a system designed to keep the world moving.

Moving on

Sunday, 31 July 2022

Researchers trained an AI model to ‘think’ like a baby, and it suddenly excelled


Shutterstock
Susan Hespos, Western Sydney University

In a world rife with opposing views, let’s draw attention to something we can all agree on: if I show you my pen, and then hide it behind my back, my pen still exists – even though you can’t see it anymore. We can all agree it still exists, and probably has the same shape and colour it did before it went behind my back. This is just common sense.

These common-sense laws of the physical world are universally understood by humans. Even two-month-old infants share this understanding. But scientists are still puzzled by some aspects of how we achieve this fundamental understanding. And we’ve yet to build a computer that can rival the common-sense abilities of a typically developing infant.

New research by Luis Piloto and colleagues at Princeton University – which I’m reviewing for an article in Nature Human Behaviour – takes a step towards filling this gap. The researchers created a deep-learning artificial intelligence (AI) system that acquired an understanding of some common-sense laws of the physical world.

The findings will help build better computer models that simulate the human mind, by approaching a task with the same assumptions as an infant.

Childish behaviour

Typically, AI models start with a blank slate and are trained on data with many different examples, from which the model constructs knowledge. But research on infants suggests this is not what babies do. Instead of building knowledge from scratch, infants start with some principled expectations about objects.

For instance, they expect if they attend to an object that is then hidden behind another object, the first object will continue to exist. This is a core assumption that starts them off in the right direction. Their knowledge then becomes more refined with time and experience.

The exciting finding by Piloto and colleagues is that a deep-learning AI system modelled on what babies do, outperforms a system that begins with a blank slate and tries to learn based on experience alone.

Cube slides and balls into walls

The researchers compared both approaches. In the blank-slate version, the AI model was given several visual animations of objects. In some examples, a cube would slide down a ramp. In others, a ball bounced into a wall.

The model detected patterns from the various animations, and was then tested on its ability to predict outcomes with new visual animations of objects. This performance was compared to a model that had “principled expectations” built in before it experienced any visual animations.

These principles were based on the expectations infants have about how objects behave and interact. For example, infants expect two objects should not pass through one another.

If you show an infant a magic trick where you violate this expectation, they can detect the magic. They reveal this knowledge by looking significantly longer at events with unexpected, or “magic” outcomes, compared to events where the outcomes are expected.

Infants also expect an object should not be able to just blink in and out of existence. They can detect when this expectation is violated as well.

A baby makes a comical 'shocked' face, with wide eyes and an open mouth.
Infants can detect when objects seem to defy the basic laws governing the physical world. Shutterstock

Piloto and colleagues found the deep-learning model that started with a blank slate did a good job, but the model based on object-centred coding inspired by infant cognition did significantly better.

The latter model could more accurately predict how an object would move, was more successful at applying the expectations to new animations, and learned from a smaller set of examples (for example, it managed this after the equivalent of 28 hours of video).

An innate understanding?

It’s clear learning through time and experience is important, but it isn’t the whole story. This research by Piloto and colleagues is contributing insight to the age-old question of what may be innate in humans, and what may be learned.

Beyond that, it’s defining new boundaries for what role perceptual data can play when it comes to artificial systems acquiring knowledge. And it also shows how studies on babies can contribute to building better AI systems that simulate the human mind.The Conversation

Susan Hespos, Psychology Department at Northwestern University Evanston, Illinois, USA and Professor of Infant Studies at MARCS Institute, Western Sydney University

This article is republished from The Conversation under a Creative Commons license. Read the original article.

Friday, 18 May 2018

Three Eggs in Creatures Village

Three eggs waiting to be hatched
The official manual for Creatures Village, available through GOG.com, says in its walkthrough that you can choose any one of three eggs to start your game, however only two are provided when you start up a new world.  This was drawn to my attention by a recent help topic in the GOG.com forums.

The most comprehensive way of getting more eggs and norns in Creatures Village is to install Grendel Man's CV Population Update, which gives four eggs at startup and allows you to keep 8 norns, and changes the genetics of the creatures to improve their memory.

If you'd just rather recover the three eggs ability, download this file and put it in your C drive > GOG Games > Creatures Village > Bootstrap > 001 Main folder - it will replace a file in there, restoring the 3 eggs ability.

To see results, start a new world.

Wednesday, 4 April 2018

How to make a simple remover COB for a Creatures 2 official object

Download Slink's Creatures 2 scriptorium and unzip it.  

Then open the "c2scrp.htm" file in your web browser and you'll get a list that looks a little like this: with sprite files, names, class numbers.


The Scriptorium browser that's available with the Creatures 2 CAOS Tool is more comprehensive, as it comes directly from your copy of the game, particularly for more complex objects, like the Vibraphone, but for a quick reference to sprites and class numbers, Slink's Creatures 2 Scriptorium is where it's at.





Open up Bobcob and choose the autoscript function:


Choose preferences

Tick Source type: Creatures 2, and output of Remover.  Then use the C2 Scriptorium list from before to choose the correct class number, then click Build:


It will then create a new script for you.

inst
enum 2 13 12
kill targ
next
scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6
endm

Note that this script will remove all the purple balls from the world:

inst
enum 2 13 12
kill targ
next

and all the associated scripts:

scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6

before quitting:

endm

To have a script that simply removes the balls while leaving their scripts intact, you would use the code:

inst
enum 2 13 12
kill targ
next
endm

Move the script from the "Remover Script" section to the "Install Scripts" section, and remove the script from the remover section.

This will allow you to inject it as if it was any other COB.

Final touches


In the Picture tab, use Slink's C2 Scriptorium to find the correct sprite file name from your game and import the image - this can help prevent crashes.  The sprite for the purple ball is dbal.s16.


Now, the little * in the name of the COB means that the file needs to be saved, so I'll go ahead and do that.  The amount being -1 means there are infinite amounts of purple ball remover.  

Download

If you just want to get rid of those purple balls right this second, download the fruits of this tutorial.

Moving on

It's possible to stack remover scripts together in one script so that you can remove more things at once, for example to write a script removing the purple ball (2 13 12) and the green tennis ball (2 13 5) AND all their scripts, you would use the following:

inst
enum 2 13 12
kill targ
next
enum 2 13 5
kill targ
next
scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6
scrx 2 13 5 1
scrx 2 13 5 2
scrx 2 13 5 3
scrx 2 13 5 4
scrx 2 13 5 5
scrx 2 13 5 6
endm

Note that the green tennis ball has more scripts associated with it than the purple one does.  I would not recommend creating a 'Remove All' remover COB like this because the inst command makes things happen in 1/10th of a second - so putting too many things in one remove script might make the game crash.

Another use for a simple remover script like this:

inst
enum 2 13 12
kill targ
next
scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6
endm

would be to put it in an installation script for a new object using the same class number - so that the purple ball is removed before a new object is created.  

Thursday, 5 October 2017

Free Art Source - Pixabay.com!


Pixabay.com is a website with the purpose of providing art, photographs, and videos for free.

The images can be searched for by whether they are photographs, vector graphics, illustrations (including CGI), or videos.  Furthermore, you can search by if the image is in portrait or landscape orientation, and by several broad categories, like Nature/Landscapes.  

When you find a picture, you can download a smaller resolution version for free, under a Creative Commons 0 license.  A larger version is available if you sign up for free.  Pixabay is partnered with Shutterstock, so make sure you are careful not to fall in love with the first image you see - there is a line of Shutterstock content for sale up the top of all search results, and to the right.  

There are some oddities with spriting for the Creatures series that Pixabay images  may need to be altered to fit - in particular, pure black  appears transparent in-game.  However, Pixabay has a wide variety of free art which could easily be adapted into background images for digital collage metarooms.

Sunday, 11 June 2017

Updated Metaroom Map

Just a quick note to say that Pilla of Pilla's DS Agents has created an updated metaroom map, with 99 known metarooms on it!  This is based on a collaboration at the Creatures Wiki, the Creatures 3 and Docking Station metaroom coordinates.  Don't forget to open this page to see what the different metarooms in the map are!