William Kamfar

Lab / notes

How a shared world would run for real

The database, the one-memory rule, moderation, and how the island could keep growing as people arrive.

Both demos run entirely in the browser. The only thing that needs a server is the part that makes One Memory shared: storing each memory and handing the album to the next visitor. Here is how that works on williamkamfar.com, what is already built, and what I'd add as more people arrive.

What's built

 visitor's browser                          Cloudflare
+-------------------------+   HTTPS   +--------------------------------------------+
| one-memory.html         | --------> | static assets: the site in dist/           |
|  island, renderer, UI   |           +--------------------------------------------+
|  all run client side    |  GET/POST | Worker /api/memories                       |
|  localStorage: a random | --------> |  checks the pose, walk and caption;        |
|  token for this browser |           |  one memory per token, 3 per network a day |
+-------------------------+           +----------------------+---------------------+
                                                             |
                                      +----------------------v---------------------+
                                      | D1 (SQLite): the memories table            |
                                      |  pose, walk, caption, place, time          |
                                      +--------------------------------------------+
 in the browser, from the album:
   poses --> photos + depth rendered --> splats placed in 3D --> fit colour and opacity --> compare
                                        next: R2 for photos, a baked splat file,
                                        Turnstile on POST, live presence

Forgetting, seasons and the rebuilt island

The rules, and how they're enforced

What would change as it grows

StepWhatWhy
1. LaunchThe code in this repo: one Worker with static assets, one D1 databaseFree tier; a memory is a few kilobytes, so D1's free 500 MB holds well over 50,000
2. Photos from posesDone: memories store where the camera stood, and browsers render the photosStoring pixels cost about 90 KB a memory and let a script upload any picture it liked
3. Bake the reconstructionA scheduled job fits the splats on the server, with positions, sizes and anisotropic shapes optimised too, and publishes one compressed splat file with levels of detailEvery visitor currently rebuilds from scratch, and the browser fit is capped at 160,000 splats
4. AbuseCloudflare Turnstile on the save, a report button, a short review queueThe token and network cap stop casual repeats, not a determined person
5. A growing worldKeep the remembered area as a small grid on the server; open new places while the island is more than 25%, 50% and 75% remembered, and close them again if it fadesThe world should change because people came, not because I shipped an update
6. Live presenceA Durable Object per island: people walking right now appear as faint lightsGhosts are the past; this adds the present without chat
7. DoorsUse the Loop Trail's portals so a memory's photo becomes a door into that exact viewJoins the two experiments: the island grows inward as well as outward

Privacy

No accounts, names or emails. The only identifiers are a random token the browser made up and a salted IP hash used for the daily cap; an hourly job deletes the hashes after about a day. Captions are public, and the page says so before you leave one.

More from the archives