Build Log

Building a Tamagotchi Engine on an ESP32-C3

How we built a persistent virtual-pet engine on an ESP32-C3 — modelling hunger, happiness and energy, surviving power cuts with flash storage, and animating a 'soul' on a 128x64 OLED.

A Tamagotchi-style virtual pet is a deceptively rich little system: it has to feel alive, change over time, and — crucially — remember who it is after you unplug it. Here's how we built that engine on an ESP32-C3 for Nameless, and what we learned.

The hardware we're working with

Modelling a 'soul' with three numbers

At its core the pet is three values — hunger, happiness and energy — that drift over time and shift in response to how you treat it. Touch interactions feed those values; neglect lets them decay until the pet gets sick. Layered on top is age, which only ever increases, plus accumulated 'memories' that make each unit's history unique. Keeping the model this small is what lets it run comfortably alongside the display driver and everything else on the chip, entirely offline.

The hard part: surviving a power cut

Because Nameless runs on USB-C with no battery, it can be unplugged mid-thought. If state lived only in RAM, every pet would reset to a blank newborn each morning — which would destroy the whole illusion of continuity. So the engine periodically writes its state to the ESP32's non-volatile flash. On boot, it reads that state back and resumes, applying elapsed-time decay based on the device's internal clock. The result: the pet you left last night is the pet you find today, a little hungrier.

Animations on a 128x64 canvas

With a monochrome 128×64 display, expression comes from motion and timing rather than detail. Each touch triggers a different short animation, so repeated interaction stays surprising. Frame budgets are tight, so animations are hand-tuned sprite sequences rather than anything computed on the fly.

More than a pet

The same engine shares the device with four mini-games and a Pomodoro timer and breathing coach — all running fully offline, which we cover in our piece on why Nameless stays offline. Coordinating all of that on one small chip is the real engineering, and it's the kind of thing the maker community loves to dig into.

Want to see the finished product these notes describe? Take a look at Nameless, or read what a desk companion robot actually is.

Meet Nameless.

A desk companion robot that reacts, remembers, and stays with you. Available now.