Writing · Side project

Mark's Place: A life sim drawn entirely in code

A little house, a little me and 1,022 things. Every pixel is drawn by JavaScript as the page loads. How I built it with Claude, and what broke along the way.

There isn't a single image file in Mark's Place. The sofa, the sunset, the rain and the six-storey bunk bed are all drawn by JavaScript while the page loads.

Half past four to half past eleven in ten seconds. Everything here, the light included, is drawn in code.

01The brief

I wanted a page on my site that felt like a game you lose an evening to. A little life sim in isometric pixel art, in the house-and-needs tradition, starring me. You build the house, fill it with furniture, and Mark cooks, sleeps, plays records and gets on with his day when you leave him to it.

Before any code, I wrote the brief with Claude as a spec. The quality bar was one line: someone who opens it should think "how is this a web page?"

The spec set the rules. No image files, no outside requests and no copyrighted art: every sprite is drawn in code on a canvas. One plain script with no build step. A strict 2:1 grid of 64 by 32 pixel tiles on a 40 by 40 lot. Lighting is the showpiece: a full day and night, sun shadows that move with the hour, and warm pools of lamplight after dark.

It also fixed the architecture before anything was built. Every piece of furniture is an entry in one list of items, and every thing Mark can do is an entry in one list of actions. Adding something new should only ever mean adding entries. That rule paid for itself later. At times several Claude sessions were adding to the game at once, and none of them needed to understand all of it to add a goat.

02A working house in under an hour

I asked Claude to build it from the spec, one small, checked piece at a time. The first commit drew an empty lot. Eleven minutes later there was a furnished house. Four minutes after that, the sun went down.

The first commit: an empty green lot with a stone path, a corner of road and the edge of a pond.0 min
Eleven minutes in: a furnished house with a bedroom, bathroom, kitchen and living room, walls cut away, trees and benches outside.11 min
Fifteen minutes in: the same house at dusk, under a pink sky, with lamps glowing inside.15 min
Forty-two minutes in: the Meet Mark editor over the house, with a preview of Mark with brown hair and glasses, and swatches for skin, hair, top and trousers.42 min
The game as it was at four of the first commits, rendered from the git history. At 42 minutes Mark still had hair.
AfterWhat worked
0 minThe renderer, the camera and the lot
11 minFurniture, walls that cut away when they hide a room, and the starter house
15 minSun shadows, day and night, and life outside
42 minMark, the character editor, his needs, and free will
49 minBuy and build modes, with touch controls
52 minSave, load, export and import
1 hr 12 to 1 hr 55Eleven homages to my other side projects
14 hr 26The 70th commit

That's the quick part. The other twelve hours went on what makes it feel finished: sound, a proper catalogue, sitting down properly, and phones.

03How a sprite is drawn

Each piece of furniture is a short list of shaded boxes. Every box gets three tones, one per visible face, coloured outlines rather than black ones, and painted details like drawer handles, cushions and book spines. The game sorts the boxes from back to front and paints them in that order.

The six-storey bunk bed, one box at a time, in the order the game paints them. It has 23.

Each item is drawn once for each rotation and colour, then kept, so the game isn't redrawing a sofa sixty times a second.

The catalogue is part hand-drawn and part generated. A generator takes a kind of furniture, a parametric drawing with its seats and actions, and combines it with tables of styles and finishes. That gives about 800 items, each with a name like "Teal velvet Chesterfield".

A grid of 25 pixel-art sofas: five styles in rows (Slouch, Chesterfield, Mid-century, Low Modular, Three-seat) and five finishes in columns (Mustard, Teal velvet, Charcoal, Cream boucle, Tartan).
One generator, five styles, five finishes. The tartan is a texture function, not a picture.

Buy mode has 977 things for sale, with search and filters. Build mode has 747 options: 385 floors, 331 wallpapers, 17 door styles and 14 window styles.

Buy mode at eleven in the morning. A panel on the right lists fridges and kitchen units, each with a drawn thumbnail and a price, under a search box and filter chips for each room.
Buy mode. Every thumbnail is drawn by the same code that draws the item in the house.

04Light is a separate layer

The light gets its own canvas, at half the resolution of the scene. It starts as a flat fill in the colour of the hour, deep blue at night. Every lamp, window and telly adds a pool of light on top. Then the whole layer is multiplied over the scene, so blue darkens everything and the pools let the colour through.

The living room at half past ten at night, drawn with no lighting: full daytime colours.Scene
The light layer on its own: a flat dark blue with soft, stepped pools of warm light where the lamps and windows are.Light
The two multiplied: the living room at night, dark blue except where lamps throw warm pools onto the floor.Scene × light
The same frame three ways. The light is dithered into steps, so it stays pixel art too.

At night the windows throw light onto the garden and the streetlights come on. Weather is the same idea, one layer up.

Quarter past nine, and raining. The drops, the splashes and the car's headlights are all drawn in code.

05Meet Mark

Mark is drawn in code too. He is a small rig of points for his head, arms and legs, posed per frame and drawn in four directions. He has 25 poses.

All 25. Shame is for after the bladder runs out.

His look changed twice in the first night. At 42 minutes he had hair and glasses. By half past five in the morning he was bald, with an optional baseball cap in ten colours. Six minutes later the spinning gem over his head went too. It looked like another game's icon, and the spec said no borrowed art, so a small speech bubble with a nine-pixel face shows his mood instead: a smile when his needs are fine, a red frown when one is nearly gone.

He has six needs: hunger, energy, bladder, hygiene, fun and social. Each runs down at its own rate. Left alone, Mark scores every action in the house by how urgent the need it meets is and how far he'd have to walk, picks the best with a little randomness, and finds a path there. He works at his computer from nine to five for money. If his bladder hits zero there's a puddle. If his energy does, he falls asleep on his feet.

Nine game hours on free will, from half past seven. Cereal, phone, loo, bath, work, a game on the PC, a nap, then cooking and eating. Nobody told him to.

On a first visit you choose his look before he moves in. On a phone, that screen had to fit, which took a second attempt.

The first screen on a phone: the title Mark's Place over the house, the line Mark is moving in today, and buttons for Play game and Start tutorial.First screen
The Meet Mark screen: a preview of Mark in a red cap, rows of swatches for skin, cap, top and trousers, choices for glasses and beard, and buttons for Surprise me and Move in.Meet Mark
The game on a phone at midday: the clock and money at the top, the house and garden in the middle, need meters and Live, Buy and Build buttons at the bottom.Playing
On a phone.

06108 ridiculous things

Then there are the 108 ridiculous items. Each one was drawn by hand in code and has its own action. Later the same morning a small particle engine went in, so every item in the game does something you can see while Mark uses it: a burst when he starts, more while he keeps going, a burst when he stops. The confetti cannon fires confetti. The volcano spits lava. Watering a plant throws water.

Four of them in use: the confetti cannon, the volcano, the very polite bull and the T-Rex.
Sixteen pixel-art items on a dark purple background, each labelled: Inflatable T-Rex, Backyard Volcano, Crash-landed Saucer, Scarecrow That Looks Like Mark, Fridge-sized Lava Lamp, Haunted Toaster, Solid Gold Toilet, Rowing-boat Bathtub, Telly the Size of a Wall, Goldfish Bowl for a Whale, Racing Car Bed, Six-storey Bunk Bed, Fridge That Judges You, Claw Machine Full of Spoons, Mechanical Bull (Very Polite) and Dinosaur Skeleton (Plaster, Probably).
Sixteen of the 108. The fridge judges you. The bull is very polite.

Sound is the one exception to the no-files rule. The four background songs are made in code, bar by bar, from chord tables. But synthesised footsteps sound like synthesised footsteps, so the sound effects are 68 recordings, all CC0 or public domain, each traced to its licence: footsteps that change with the floor, rain, the fridge door, the goat.

07My side projects moved in

Mark's Place is also a house for everything else I've built. Each of my other side projects is in there as something you can use, and each one links to its write-up, which has a way back.

Seven in the evening in the record room. Mark puts a record on.
ProjectIn Mark's Place
The Listening RoomA walnut record wall, twin decks and a mixer, big speakers, a neon sign, the "have a good time" rug and a listening chair
Baker's DozenThe drum machine in its donut box, and a dozen donuts
ALL CAPSA metal face mask, a rhyme notebook, a villain's breakfast and some crates
Just Bleat ItA goat feeder, and the arcade cabinet
Canopy JamThe old oak in the garden
HardopDutch practice at the desk
The BasementThe basement dig bench
Sample ExplorerA lineage wall
This is fineThe hob and oven. You can guess
The PressA two-drum riso and its posters
The HumA lamp on a chain, and a telly that shows you a few seconds late

All eleven landed in 43 minutes, because of that rule in the spec: each homage was only new entries in the lists. There are also four secret words to type. I'm not saying which.

The late telly was the one that bit back. Turn it off and on again and the game froze for good. Switching off emptied its store of old frames but kept its place in the store, so the next watch started filling it from the middle. The store looked full while holding gaps, drawing a gap threw an error, and the error skipped the line that schedules the next frame. The fix reset the store, and the main loop now books its next frame before doing anything that could fail.

The garden. A sloth in the oak and a goat at the feeder.

08Sitting down took three hours

Most of the second half was me playing it on my phone and sending Claude screenshots of whatever looked wrong. Nothing took longer than getting Mark into a chair.

WhenWhat I sawThe fix
09:40Mark vanished at desks and on the toiletDraw him straight after the desk, cut off below its back
10:07He glided into seats sideways, through tablesThree steps: turn to face out, step back to the edge, lower into the sit pose
11:15With his back to the camera, his legs showed under the seatStop his sprite at the seat surface when he faces away
11:24The garden desk's backrest jumped in front of himOnly order parts that overlap on screen
12:06The six-storey bunk bed rendered very strangelyA depth test for every pixel
12:36Buried in the bean bag, hidden by the egg chair, standing on the gold toiletNovelty seats draw the whole item behind him, at their own seat height

The backrest is the interesting one. Sorting a seat around Mark means putting every part of it in front of or behind him. Ordering every pair of parts let a chain form through pairs that never touch on screen, and the chain dragged the backrest the wrong side. Only ordering parts that actually overlap fixed it.

The bunk bed was the same problem at full size. The game sorted whole boxes from back to front, and some pairs of boxes have no right order: each is partly in front of the other. So now every pixel keeps a depth, and the nearest part wins wherever two overlap.

The six-storey bunk bed at two rotations, before and after the depth fix. Before, the brown underside of one bunk paints across the storeys in front of it. After, every storey shows properly. A third image for each marks the changed pixels in red.
Before and after the depth test, at two rotations. Red is every pixel that changed.
Six close-ups in two rows. Top row, before: Mark's head poking out of a purple bean bag, Mark hidden behind a white egg chair with only his legs showing, and Mark standing on a gold toilet. Bottom row, after: Mark sitting on top of the bean bag, sitting inside the egg chair, and sitting on the gold toilet reading.
The novelty seats, before and after. The toilet now gets used as intended.

09Where else it broke

What I sawWhat brokeThe fix
Nobody in the racing car bed during a napMark was hidden in the bed, but napping never told the bed it was occupiedA nap inside a bed marks it occupied, so the bed draws him under the covers
Back from a write-up, Mark was doing the task from before the first oneA restored action always reopened its panel, even one I'd closedThe save remembers whether the panel was open
Hear it was silent on my iPhoneThe silent switch mutes speech on an iPhone. The game's other sounds were set to ignore itHear it plays a silent clip while it speaks, which counts as media playback
The Move in button was off the bottom of my phoneThe dialog's height counted the space behind Safari's toolbarMeasure the visible screen, pin the buttons, shrink the preview

Hear it took four attempts. The first three each changed when the speech started, and none of them helped. The phone was on silent. Turn the switch off and it speaks.

10Checking every item

The bunk bed made me ask a bigger question: how many other items look wrong? So Claude checked all of them. It drew every item then in the game at all four rotations, 4,084 pictures, before and after the depth fix, and compared them. 37 kinds of item changed: the bunk bed, a swing, desks, a double sink, the bouncy castle. Every other picture came out identical to the pixel.

Then it checked Mark using everything. For each distinct kind of item and each thing Mark can do with it, it placed the item on open grass, had Mark walk over and start, and took a screenshot at every rotation: 247 combinations and 988 screenshots, reviewed in sheets of four rotations side by side. That's where the bean bag, the egg chair and the empty beds came from.

Some of what looked wrong was right. At two of the four rotations, a wardrobe's front faces away from the camera, so Mark using it stands behind it. A deckchair seen from behind looks thin because it is.

Every change also goes through six scripted checks in a real browser, with the site's real security settings: the first visit and tutorial, buying and undoing, building and undoing, the controls, item effects, and Mark doing things.

11Adding a basketball court

This evening I asked for a basketball court in the front garden. It's a fair test of the rule from the spec: a new thing should only need new entries.

Mostly it did. The court is one item: a floor with a terracotta key and white lines, drawn as a textured box top, and a pole, backboard, rim and net from the same boxes as everything else. "Shoot some hoops" is one action. Mark got a 25th pose, ball at the chest, then both arms up. The ball reuses the particle that's thrown at an item, given a point to aim at, the rim, and allowed to drop on through the net and bounce.

Then Mark walked onto the court and disappeared. The game sorts each item as one box, and the court's box is as tall as the hoop, so Mark standing on the court sorted behind it and the floor painted over him. The fix is the one change that wasn't an entry: an item can now be drawn as two parts, a floor that sorts like a rug and a tall part that sorts by its own footprint.

The first placement put the hoop by the fence. From the camera's side that meant looking at the back of the backboard, with the ball going in somewhere behind it. It now faces the house.

Half past five, the front garden. Most of them go in.
1,022things in the game
0image files
25poses for Mark
988screenshots in the check

12What's next

Mark's Place isn't open yet. A few more evenings of playing it on my phone and sending screenshots, and it will be.

The lamps are already on.

Built with Claude Code. Every sprite, light and song drawn or written in JavaScript, in one file of 10,384 lines. Sound effects from CC0 and public-domain recordings, credited in the repository. Set in Pixelify Sans and Silkscreen, both under the SIL Open Font License. The clips on this page were recorded frame by frame from the game itself.