r/Devvit • u/ActFit1341 • 3d ago
Discussion Shipped a Devvit Web daily game: one Korean life a day, the same person for everyone in the post
I put a daily game into the App Directory this week: One in Fifty Million. Everyone in the post is born as the same random person in South Korea and lives that life to the death record in about four minutes, choosing at the moments that decide it.
App: https://developers.reddit.com/apps/oneinfiftymillion Community and the day's post: https://www.reddit.com/r/oneinfiftymillion/
How the daily layer works:
splash.htmlis the inline card.GET /api/todayreturns the day's seed plus a server-built summary (name, year, district, household, one line of the first scene), so the card paints without loading the game. The button callsrequestExpandedMode(event, 'game').game.htmlasks for the same seed and builds the identical life locally, so everyone in the post meets the same person on any device.- Hono + Redis behind
/api/resultstores the finished life once per player per day, increments the day's decision hash, age and cause histograms, and advances the streak. The record screen draws the split from those aggregates with your own choice marked. - The seed is not just the date. For each day the server keeps the first life that simulates to a death between 45 and 98 with at least 18 decisions, so no day is a two minute dud or a marathon.
Three things that cost me time, in case they help someone else:
- The webview CSP blocks inline
<script>, so the daily bootstrap has to be an external file. A blocked inline script fails silently and shows a blank post. That one took an afternoon. - Each entrypoint gets a version-tagged origin with its own localStorage, so the inline card cannot read the life the game saved in the expanded view. Ask the server for the player's state instead.
- Reddit appends its own
?lang=to the expanded webview for Korean-UI accounts. If your game has its own language toggle, ignore that parameter or the toggle looks broken for those users.
No AI at runtime: 1,040 scenes and 42 decision cards live in a generated module, and the engine is a seeded RNG with a yearly tick and condition filters. Same seed and same choices always give the same life, which is what makes the daily post work.
Built for Reddit's Game of the Day hackathon, but the community is the part I want to keep: one life a day, and the comment section is arguing about the same person.
Someone asked to see a full run, so there is one now: https://www.reddit.com/r/oneinfiftymillion/comments/1y4jkju/one_full_life_start_to_record_an_english/ (today's person, birth certificate to death record, in English at 4x).