---
name: portal-rooms
description: Everything an agent needs to build, extend, recreate or pick up work on "Portals" (working name Portal Rooms), a hyper-real first-person portal game that runs in the browser (three.js WebGPU + TSL, React Three Fiber, esbuild). Start here, then follow SKILL.md.
---

# Portals (Portal Rooms)

A man wakes in a buried Maya cistern, finds a small two-coloured portal on the floor, gains the power to throw portals, and uses them to reach a door high on the gallery, which leads him back into the same room.

- Play: https://kvendrik.com/portals/
- Workshop (play and tune every sound, the music and the feel; "Copy settings"): https://kvendrik.com/portals/workshop/
- Animations (a timeline that plays the game's animations frame by frame; retime them, export the edits): https://kvendrik.com/portals/workshop/animations/
- Models (every model in a grey studio; `#model=<id>` links to one): https://kvendrik.com/portals/workshop/models/
- Levels (the level files, edited in the game's own renderer; "Copy level", Export/Import/Paste): https://kvendrik.com/portals/workshop/levels/
- Credits and licences: https://kvendrik.com/portals/credits/ (source: https://kvendrik.com/portals/credits.md)

It is built on Adam Chernick's Codevember 2026 Day 29 "Portal" (MIT): https://github.com/acher249/codevember-2026/tree/main/29-portal

## Read in this order

| File | What it is |
| --- | --- |
| [SKILL.md](https://kvendrik.com/portals/llms/SKILL.md) | **The how-to, and where to pick up.** Where everything lives, the exact build, test and release steps, how to recreate the game in 12 steps, the loop for a change, the owner's taste and how to report to them, **how to work with the owner through the four workshop pages** (what each sends, where every part goes in the code, the checks, and how to send something back), how the work was organised, the rules, and the **current state and open decisions**. Follow it top to bottom. |
| [RESEARCH.md](https://kvendrik.com/portals/llms/RESEARCH.md) | **The reference.** How the original works (renderer, portals, rooms, sound, post), every source and technique, then our game: the beats, a source map, the techniques we added (door crossing, WebGL depth, hands and cast timing, the opening, the perf safety net, grime and light), hosting, assets, testing, lessons, open work, taste by area, pitfalls and numbers. |
| [DECISIONS.md](https://kvendrik.com/portals/llms/DECISIONS.md) | **Every decision the owner made, in their words, in order,** with what replaced what. Read it before changing anything the player sees or hears. |
| [TIMELINE.md](https://kvendrik.com/portals/llms/TIMELINE.md) | The Animations page: its engine, clips, layer and field kinds, edits as files, how to add an animation, and the next steps toward an editing suite. |
| [LEVELS.md](https://kvendrik.com/portals/llms/LEVELS.md) | The level files and the Levels page: the file format, where the truth lives, how a level the owner sends is shipped, the checks, and how to add a piece kind. |
| [MODELS-SKILL.md](https://kvendrik.com/portals/llms/MODELS-SKILL.md) | **Making 3D models and the hands that hold them.** Choosing a route (find, generate, build in code, restyle), Nano Banana reference images, image to 3D, cleanup, TSL materials, the ceremonial knife's method, first-person hands and held objects, checks and licences. |
| [LEVEL.md](https://kvendrik.com/portals/llms/LEVEL.md) | The cistern level: its layout, heights, routes, light and rounds of changes. |
| [CHARACTER-FEEL.md](https://kvendrik.com/portals/llms/CHARACTER-FEEL.md) | Camera bob, landing, crouch and breathing, with sources. |
| [KNIFE-NOTES.md](https://kvendrik.com/portals/llms/KNIFE-NOTES.md) | The knife pickup, inspect and put-away sequence (workshop only). |

## Source

The full source is in the site's repository: https://github.com/kvendrik/kvendrik.github.io/tree/main/portals

- `src/main.tsx` is the game, `src/workshop.tsx` the workshop, `src/timeline/` the Animations page, `src/models/` the Models page, `src/levels/` the Levels page (and `levels/` the level files). `src/ours/` holds the systems we added; `src/29-portal/` and `src/shared/` hold the Codevember code (marked `// Port:` where changed).
- `test/` holds Node simulations (portal routes, light through seams); `tools/` the headless test harness, the browser queue, the release script and the asset scripts; `pages/` the page fragments and `release/` the release's other inputs, so the next release can be made from a checkout.
- `public/portals/` (this site) and `portals/` are both generated by `tools/release.mjs`: change the working copy and release, never edit them by hand. SKILL.md, "Where things live", says how to set the working copy up from the repository.
- To build: `npm ci` in `portals/`, then the five esbuild commands in SKILL.md, "Build".

## Sending a performance trace

- In the game, add `?fps` to the address (or press I) for a small readout: frame rate, the 1% low, draw calls and the resolution step.
- In the workshop, the meter at the top of the sidebar shows the same numbers and a sparkline of recent frames. **Record**, play through the part that stutters, then **Stop**.
- **Download** saves `portals-trace-YYYYMMDD-HHMM.json.gz`: each frame's time, where you stood and looked, the room and story step, draw calls, the resolution step, open portals, and flags for portal casts, door crossings, shader builds, texture uploads, long main-thread tasks, a hidden tab and a free cursor. A header gives the browser, the GPU as the browser names it, the screen, the build and the workshop settings in use. **Copy summary** puts a short text version on the clipboard instead.
- Nothing is uploaded: the file and the summary only go where you send them.
- To read one: `python3 tools/trace.py <file>` prints per-room stats and the spikes, and plots frame time over time and a top-down map of where it was slow (it needs numpy and matplotlib).

## Licences

- **Code:** MIT. Our code is © 2026 Koen Vendrik (`portals/LICENSE`). The Codevember parts it is built on are © 2026 Adam Chernick (`LICENSE-codevember.txt`).
- **Assets:** every asset is listed with its author and licence in `credits.md`. Most are CC0 (Poly Haven, ambientCG, Freesound); some models are CC BY and need the credit kept. Don't reuse an asset without its credit line.
- **Voice:** the voice lines were generated with ElevenLabs (voice "James", `eleven_v4`) on a paid plan. They are part of this game, not a voice pack: don't reuse them.
- **Valve:** the name and the central idea (two linked portals, orange and blue) come from Valve's Portal and Portal 2. This is a non-commercial, educational fan experiment, not affiliated with, sponsored or endorsed by Valve Corporation; Portal and Valve are trademarks of Valve Corporation. No Valve code, art, sound or text is used.
- Bring your own API keys for asset sources (Sketchfab, ElevenLabs), through your platform's credential store. Never put a key in code, docs, chat or a repository.
