A Mind for a Virtual Pet

Cats are very complex little creatures with a wide variety of emotions, preferences, behaviors, and quirks. I don't think any software model could fully capture the machinations of the feline mind.

Regardless, for the Catode32 project, I tried my best to create an abstraction that felt lively and interesting, and which was able to run on a microcontroller.

Stats

The system tracks 18 stats for each pet, each on a 0-100 scale.

Stats change over time, and in response to both player and pet actions.

Each of the stats is designed so that a higher value is more of a "good" thing. For example, a full stomach is represented as a higher "Fullness" (where 100 is totally filled) instead of tracking "Hunger" (where 100 would be starving).

The 18 stats are:

Stat What it is How to raise / what lowers it
Health Overall wellbeing, derived from the other stats No single action raises it directly. Keep fitness, fullness, energy, comfort, and affection balanced.
Fullness How satisfied your pet's belly is Feed meals and treats. Activity burns through it, especially sleep and exercise.
Energy How rested and ready your pet is Restored by sleeping. Drained by playing, zoomies, training, and hunting.
Comfort Physical ease with their surroundings Restored by sleep, stretching, and affection. Worn down by startles and long inactivity.
Cleanliness How clean your pet is Your pet self-grooms, and grooming them gives a bigger boost. Activity gradually dirties them.
Fitness Athletic conditioning Built through training, hunting, zoomies, and movement. Fades slowly during rest.
Focus Ability to concentrate Restored by sleep and affection. Scattered by mischief and active exploration.
Intelligence Problem-solving ability Developed through training and hunting. Fades slowly when idle.
Curiosity Drive to explore Sparked by rest, surprises, and your attention. Satisfied by investigating and observing.
Playfulness Desire to play Restored by sleep and affection. Spent through play, training, and zoomies.
Affection How loved your pet feels Filled by kisses, petting, grooming, and treats. Drains when your pet sulks or hides.
Fulfillment Sense of purpose Grows through training, grooming, and affection. Fades when idle too long.
Serenity Inner peace and calm Restored by rest, kneading, and grooming. Worn by vocalizing and active exploration.
Sociability Eagerness to interact Boosted by training, affection, and grooming. Falls when hiding, sulking, or causing mischief.
Courage Boldness in scary situations Strengthened by training and affection. Chipped by startles and sulking.
Loyalty Strength of your bond Grows through training and frequent affection. Eroded by mischief and sulking.
Mischievousness Tendency toward playful trouble Rises during mischief and hunting. Reduced by affection and training.
Maturity Behavioral self-control Develops through training and observing. Set back by mischief and zoomies.

To prevent runaway stat changes, the system dampens values with a curve in a way that favors the middle. I.e., at a low stat level, further decreases are dampened but increases are boosted. And likewise, for a high stat, further increases are dampened and decreases are boosted. It isn't exactly asymptotic, but it tends in that direction.

Further dampening also happens if the pet is sick.

Behaviors

The behavior system is built above the stats system. It consists of an interconnected graph of behaviors. The pet expresses one behavior at a time, and upon completion can either stay in the same behavior or transition to one of the connected behaviors. The transition is heavily influenced by the pets stats, which behaviors have happened recently, and an element of randomness. Some behaviors can be triggered by the player, for example feeding the pet will put them into the "Eating" behavior. (Unless they refuse the meal!)

As an example, a sleeping pet will transition next into stretching. Then a stretching pet might go to idle or to kneading. A kneading pet might go back to stretching, or might go to lounging.

At the end of each behavior the pet recieves stat rewards. For example, when finishing sleeping the cat will receive energy and comfort additions, and a fullness subtraction.

These stat changes can also be modified by the environment. When sleeping in the bedroom, the pet will get extra comfort and energy rewards. There are even small perks beyond that, for example the bedroom and treehouse have cat beds in them, and if the pet decides to sleep in those they'll gain extra-extra benefits.

Pets can use behaviors to help communicate their needs. For example, a pet will look bored if they haven't been played with, or will sulk if they've been neglected. Sometimes they'll even directly vocalize their needs, like if they're quite hungry.

Balance

The interplay between stats, behaviors, rewards, and decay was manually tuned over a period of months with ongoing manual testing.

I would use a debug mode to put devices into an accelerated time scale, while having debug output track the stats, behaviors, and their changes over time. I would then graph this data looking for runaway patterns.

It was an iterative and experimental process that still recieves small tweaks over time, but the pets are now well configured so that intentional stats will decay at expected rates without player intervention. And with player intervention, a reasonable amount of interactions keep pets healthy and happy.

For example, pets need to be fed about once per day. They need to be regularly shown affection and groomed, but not so much that it is unberable for the player or the pet.

Genome

Each pet has a unique genome that's generated at adoption time. The genomes are 64-bit integers, meaning there are 18,446,744,073,709,551,615 (over 18.4 quintillion) different possible genomes.

The genome is responsible for deriving a number of attributes for the pet and their world.

It sets:

  • The initial values for courage, loyalty, mischievousness, curiosity, and sociability
  • Gender
  • Star sign
  • Favorite weather
  • Favorite location
  • Favorite toy
  • Favorite meal and snack
  • Least favorite meal and snack
  • Default portrait
  • Suggested name
  • Star field (every pet has a unique star pattern in their night sky)
  • Initial weather and temperature

A lot of this can be viewed by going to the pet info screen.

Adoption

When you boot up the Catode32 for the first time (or after erasing the context file), you'll be presented with an adoption screen. The system generates four pets with four unique genomes. There will always be a 50/50 split of genders with two queens and two toms.

The player can click on each of the four pets to learn more about them (star sign, temperment, suggested name, favorites, etc) and can select which of the cats they'd like to adopt. The player will be prompted to either keep the suggested name or to give their pet a new name, and then they can confirm the adoption.

Published: November 9, 2026

Categories: gamedev, catode32