Pixl under a pixel-art moon

Pixl explores how much character can emerge from a small system. The pet has hunger, energy and mood; time changes those values, while feeding, playing and sleeping affect what happens next. Personality emerges from the relationship between the rules and the sprites that make them visible.

A clock and three variables#

The update loop reads the clock, loads state, applies changing needs and chooses an animation. In the documented version, the periodic update runs every thirty seconds. Hunger rises and energy falls; visitor actions change that balance.

Behavior selection has priorities. Nighttime runs from ten in the evening to five in the morning, using each visitor’s local clock. Physical needs such as high hunger or low energy also influence the displayed state. A server does not synchronize the clock: each browser maintains its own pet.

Making the rules readable#

The artwork uses SVG sprites on pixel grids, with crisp edges. Changes in posture and expression reveal the creature’s state, while scenery responds to the time and season. Pocket pets and games that achieved a lot with few elements provide the visual reference.

The documented implementation uses Next.js, React and static export. State and a bounded interaction history are kept in localStorage; the simulation can run in the browser without a backend calculating every change.

What I wanted to explore#

An interaction makes sense when it can be connected to a consequence: a value changing, another animation or the creature falling asleep. Pixl explores that relationship without a language model or decisions hidden behind a remote request.

The article collects rules, equations, screenshots and implementation notes. The central idea is to use time, state and representation to make a set of instructions feel like a companion.