Inspiration
What it does
How we built it
Challenges we ran into
Accomplishments that we're proud of
What we learned
What's next for Beamline
Inspiration
The daily games people stick with share three things: one small board everyone gets on the same day, a result you can compare in a sentence, and a reason to come back tomorrow. I wanted one built around a single satisfying physical idea rather than words or trivia: a beam of light and a few mirrors. You can read the whole board at a glance, the first tap already does something, and "I did it in four mirrors" is a result people argue about in comments.
What it does
- One puzzle a day. At midnight UTC the app posts the day's board. A beam enters from the edge; tap a square to drop a mirror, tap again to flip it, once more to remove it. Light every crystal.
- A difficulty curve through the week. Monday is a 6×6 board that needs two mirrors. Sunday is 8×8 with walls, fixed mirrors you cannot move, and five mirrors to find. Seven levels, generated and verified on the server.
- Par, stars and "Go for par". Every board has a true par: the fewest mirrors that solve it, proven by a solver. Par earns three stars. Solved it with one mirror too many? The result card offers "Go for par" and keeps your board so you can tighten the line.
- A result card that is about the community. How many players you finished ahead of, your place today, the star spread for the day, the fastest lines, your streak, and a countdown to the next puzzle. One tap copies a spoiler-free result line for the comments.
- Streaks and flair. Solve the daily on the day and your streak grows. At 3, 7, 14 and 30 days the app sets streak flair on the player in the community.
- Build your own puzzle. Players place crystals, walls and fixed mirrors, move the emitter, then have to solve their own puzzle before they can publish it. The server works out the real par, and the puzzle becomes its own post, credited to its author, with its own leaderboard. The feed fills up with puzzles made by the community, not only by the app.
- The post itself is the invitation. In the feed the post shows the real board with the beam already running, how many players solved it, and your stars if you are done.
- Works logged out. Visitors can play immediately; logging in saves results, streaks and leaderboard places.
How I built it
- Devvit Web: React and SVG on the client (no game engine, the whole client is about 80 kB gzipped), Hono on the server, Redis for state, the scheduler for the daily post,
onAppInstallfor the first one, user flair for streaks, and an HTML launch screen with a separate expanded entry point. - One shared engine (
src/shared/engine.ts): beam tracing, a seeded generator and a solver, used by both sides. The client traces the beam live on every tap; the server replays every submitted layout before it touches the leaderboard, so results cannot be faked. - Generation. A solution is grown along the beam, crystals are placed on its path (always one on the final leg, so every mirror matters), walls go off the path, and some solution mirrors stay on the board as fixed pieces. A depth-first solver that only branches on squares the beam actually crosses then proves the par and rejects boards that turn out easier than intended. A puzzle takes a few milliseconds to generate.
- Leaderboards are Redis sorted sets with a score that orders by mirrors over par first and time second; the star spread is a hash; streaks are per-user hashes and only count solves made on the day.
- Devvit Journeys are instrumented: app ready, journey start on the first placed mirror, progress as crystals light up, end with the star count. Events only fire on committed player actions.
- Tests. The engine has unit tests (reflection, tracing, solver minimum, 175 generated boards checked for determinism and a tight par). The whole game was also played end to end by a script, both in a local preview and inside the real post on Reddit.
Challenges
- Par has to be true. If a player finds a line shorter than par, the game loses its authority. The generator's own solution is not enough, so every board is solved independently and the proven minimum becomes par.
- Same puzzle everywhere. An early version shuffled with a random sort comparator, which gave different boards in different JavaScript engines. Generation is now fully deterministic and happens once, on the server.
- Fitting the viewport. The board, clock, mirror tray and hint line all have to fit a short mobile web view without scrolling; the board is a single SVG that takes whatever space is left.
- Keeping the first ten seconds free of instructions. There is no tutorial screen: the beam is already drawn, the first tap places a mirror, and one line of text under the board changes as the player learns the three states of a square.
What I'm proud of
A complete loop in a small package: open the post, understand it without reading, solve in a minute or two, see where you stand, and optionally leave a puzzle behind for the next person.
What's next
- Weekly and all-time streak boards in the community.
- A weekly "community pick": the most-solved player-built puzzle becomes Sunday's daily, with credit.
- New pieces on harder days (splitters and coloured beams).
- Posting the result line as a comment on the player's behalf once the app is approved for user actions.
Built With
- devvit
- hono
- react
- redis
- svg
- typescript
- vite