n1m21nhow he liveswho is Namanback to the room

he is not an animation.
he is a small system.

Everything the man in the room does is decided by a stack of simple rules: what his body wants, how he feels, what just happened to him, and a little luck. This page explains each layer, with the real numbers the room is running on. The charts are drawn from the simulation's own data files, so they cannot drift from the code.

getting around

computer: arrow keys or WASD to walk, E or Enter to use what is near you, V to change the camera, M for music, Esc to close things. phone: drag the round stick at the bottom left to walk, tap the big pill at the bottom right to use what is near you, the camera icon at the top changes the view.

01the loop

One pipeline, always in this order. Emotion is never an input to the first step: it is the result of what he did, and it only reaches back into his choices through mood and memory (so there are no instant feedback spirals).

02drives and needs

Six slow, nearly fixed drives make up his personality. They push on faster-moving needs (motives). A drive's weight (0.5 to 1.5) multiplies how urgent its needs feel, so changing a weight changes his character without new code.

drivewantsfeeds
vitalitybody upkeepenergy, hunger, hygiene, bladder
stimulationnovelty, things to dofun, curiosity, boredom
masterymake and finish thingsfocus, pride
connectioncompanysocial
securitya predictable safe placecomfort, stress
autonomyroam and chooserestlessness, building

Each need drains over time and is refilled by acts, with diminishing returns (the last 20% takes the longest):

drain m -= rate_m * (1 + a * stress) * dt refill m += reward * rate * (1 - m) * dt urgency u(m) = (1 - m)^2 * driveWeight

how fast each need drains (relative, from the tuned constants)

03chemistry

Under valence and arousal sit six slow variables, loosely inspired by neuromodulators. They are a game-grade abstraction, not real neuroscience: one molecule does not equal one emotion. Each one relaxes back to a baseline with its own time constant, and is pushed by events from the ledger.

dx/dt = (base - x) / tau + sum( event_i * weight_i )
variableplays the role ofbaselinetau

how chemistry becomes feeling

Four read-outs (valence, arousal, stress, dominance) are weighted sums of these variables. Blue pushes up, pink pulls down.

read-outbiasDAHTNECORTOXYSLPmood

and straight into behaviour

effectDAHTNECORTOXYSLP

04memory

Feelings are traces that fade. Each event adds a bump that decays exponentially, so a bad bump is felt for seconds, a bad stretch for minutes, a good day for the better part of an hour. Time keeps running while you are away, so a returning visitor finds him still carrying the day.

trace(t) = sum_i delta_i * exp( -(t - t_i) / tau )

how long each feeling lingers (log time axis)

0527 emotions

An emotion is a point in a five-number space (valence, arousal, stress, energy, dominance). The face you see is the nearest prototype, with hysteresis: he must cross a boundary by a margin before the face changes, so it never flickers. Dots below are the prototypes; colour is stress, size is how wide its territory is.

calmsome stresshigh stressfirst 9 (original)
emotionvalencearousalstressenergydominance

the chemistry cube

Three variables (dopamine, serotonin, noradrenaline) each high or low give eight corners, a rough starting map from chemistry to feeling (after Lövheim 2012), blended with what just happened. It only counts when his chemistry is clearly away from its resting level.

HTDANELövheim affectleans toward

Frustrated, the one people ask about, sits at high arousal and high stress (valence .28, arousal .75, stress .7). Wall bumps and interrupted acts feed it; it fades in about 25 to 45 seconds.

06the ledger (the reward system)

Every event writes one entry to the ledger: some points on needs and feelings, some chemistry, then it fades. The ledger is also the explanation: any mood can be traced back to the entries that caused it. Normal events are small and mostly pleasant. Erratic events (outside his pattern: hitting a wall, skipping a meal while starving, a 3 am shower) weigh about times more per point.

an erratic point counts

what events do (change per event; blue up, pink down)

show / hide all events
eventkindeffect on feelings

07actions

He has things he can do. Each one is tagged normal or erratic, trivial or not (a sigh versus cooking), and a category. Every act has its own formulas for whether he does it, how long it takes and how intense it is.

acts per category

chance = sigmoid( k * (score - threshold) ) he may refuse for hours duration = base * moodFactor moodFactor = clamp( 1 + .4(valence-.6) - .3 fatigue - .2 stress + .2 absorbed, .4, 2 ) intensity = base * (.6 + .6 arousal) * (1 - .3 fatigue) * (1 - .2 stress) walkSpeed = 1.7 * (.6 + .6 arousal) * (1 - .3 fatigue) slower in clutter

What he picks next is a weighted draw over every act's score. The score blends how much each act refills his most urgent needs, what he was just doing, how often he did it lately, and which acts naturally follow which (a table learned from public time-use diaries, so showers tend to follow sleep and meals tend to follow the fridge).

08chains

Chains are not a fixed list; they are planned. The room has a state (teeth clean or not, food cooked, dishes in the sink, caffeine in him, dressed or in pyjamas), and every act reads and changes it. What he wants most becomes a goal, and the planner puts in front of it whatever the world needs first: to eat he needs food, food needs cooking, cooking needs something from the fridge. Some steps are soft (brush before bed), kept more often when he is rested and calm. The order of steps that do not depend on each other is drawn from which acts tend to follow which and from his own habits, which strengthen each time he uses an order. So any permutation can happen, and each run of his life grows its own routine.

goal = draw(score) plan = fill(unmet preconditions of goal, recursively) order ~ affinity x (1 + habit)

Interruptions and branches fall out of the same rule. A detour or a knock suspends the goal; he comes back with odds that fade with time away and with every restart, and replans from the state the room is in then, so steps already done stay done. A step that fails (food burnt) leaves a precondition unmet, and the replan is the branch (eat a snack instead). Over 200 simulated weeks he lives thousands of distinct sequences. The named chains below are just recognised motifs: finishing one pays a bonus into the ledger; breaking one costs, scaled by how many steps were left, and the next sequence is drawn from its branches (filtered by what broke it and how he feels).

chainkindsteps

when a chain breaks

09luck and mishaps

Not everything goes to plan. Seeded random events (so everyone watching sees the same one at the same moment) fire at a rate that rises with stress and fatigue:

rate(t) = h0 + kStress * stress + kFatigue * fatigue + trigger(t) events per second
eventbase ratestress addsfatigue addstrigger

Even a normal act can go well or badly. Each act has a distribution over outcomes, nudged by fatigue, stress, skill and clutter:

outcome odds by kind of act

as intendedpartialfailedside effectsurprise

10instability

No stage is a pure function of the one before it. Each carries noise, a slowly drifting gain that wanders and returns to centre, and some cross-talk into its neighbours (stress mistaken for hunger, loneliness for boredom). He also keeps a self-model of what he expects to happen; the gap between expectation and outcome feeds dopamine (good surprise) and cortisol (bad surprise). Four hidden regimes shift all the noise levels, and emotion labels describe the regime rather than choosing it.

regimenoise xtypical stay (hours)
Honest status: the instability layer is built and tested, but it ships switched off by default. The day-to-day variety you see comes from the seeded randomness in choices, outcomes and hazards.

11how it was tuned

Hand-set numbers made a believable person only by luck, so the numbers were searched. About 20 targets describe a believable, varied, stable life (sleep 6 to 9 hours, 2 to 4 meals, no single act hogging the day, never stuck asleep or starving). Each target has a band; being outside costs a penalty and "hard" targets must hold on every test run. A search over 50 factors (decay rates, pulls, penalties) minimised the total penalty, then the winner was re-checked on 480 simulated lives of 14 to 20 days using seeds it had never seen.

total penalty (lower is better, log scale)

Still outside the bands: valence runs a little happy (about .71 to .78 versus .5 to .7), chains break more often than the target ratio, art he is satisfied with is rarer than hoped. These are listed, not hidden.

12one shared life

He is one person for everyone. His life is a pure function of a fixed seed and the real clock, with a saved checkpoint every four weeks, so any two visitors see the same man doing the same thing. What you do (bump him, startle him, knock at the door) is a small private layer on top that never changes his real life. While nobody is looking, time still passes and he lives it, up to two weeks act by act and in bulk beyond that.

13music as reward

Each of the piano and guitar pieces was analysed for how it feels (calm, tense, bright, nostalgic) and stored with the emotions it suits and how much it relieves stress. When he plays keys or guitar he picks the piece whose feeling is closest to his mood, and leans toward soothing pieces when stress is above .45. Pieces are public-domain or openly licensed scores; each is credited where it plays.

14how it was made

layermade with
the mana 3D toon figure built in Blender, faces drawn per emotion, posture driven by the same numbers
the roomthree.js, hand-built furniture, riso-print look
the simplain JavaScript modules that run in your browser and in node for testing; data lives in JSON files and a generator bakes them into the site
checks47 simulation tests (determinism, bounds, decay, hysteresis, catch-up), 200-life Monte Carlo runs, and a design test of the page itself
hostingCloudflare Pages, with a small database that keeps the shared state