Live Links & Judge Quick-Start
- Play Live on Reddit (Public
r/RelayZeroGamePost): https://www.reddit.com/r/RelayZeroGame/comments/1yareox/relay_zero_009_20261202_bifurcation_par_5/ - Public Subreddit Community: https://www.reddit.com/r/RelayZeroGame/
- Devvit App Listing (
[email protected]): https://developers.reddit.com/apps/relay-zero - Interactive Demo & Video Showcase (GitHub Pages): https://ngominhtam1998.github.io/relay-zero/
- 1080p Broadcast Demo Video (Direct MP4): https://github.com/ngominhtam1998/relay-zero/releases/download/v1.0.0/relay_zero_demo_1080p.mp4
- Public GitHub Repository (MIT): https://github.com/ngominhtam1998/relay-zero
- Devvit SDK Feedback Notes (8 Reproducible Observations): https://github.com/ngominhtam1998/relay-zero/blob/main/DEVVIT_FEEDBACK_NOTES.md
Inspiration
The best daily games on Reddit feel like a shared ritual: everyone opens the same post over morning coffee, plays in 60 seconds without leaving their feed, and immediately drops into the comment section to compare scores without spoiling the puzzle for anyone scrolling behind them.
Most web puzzles ported into Reddit feel sluggish or bolted on—bloated JavaScript bundles, awkward scrollbars inside mobile inline feeds, trust-the-client leaderboards that break on day one, or "random" generators that occasionally emit unsolvable boards. We built RELAY ZERO from day one as a Reddit-native daily optical engineering ritual: instant 23.4 KB load inside height: "tall", tactile 60fps laser physics, mathematically proven daily optimal Par, server-side anti-cheat verification, and a 1-click spoiler-free emoji scorecard designed specifically for Reddit comment threads.
What it does
Every day at 00:00 UTC, RELAY ZERO publishes a fresh interactive optical bench (RELAY ZERO #NNN) via Devvit's automated cron scheduler (0 0 * * *):
- 10-Second Learning Curve, Deep Optimal Routing: A live amber laser fires from the Emitter (
🟧). Players tap rotatable optical components—double-sided Mirrors (/), half-silvered Cyan Crystal Splitters (◇) that bifurcate light straight + 90°, and one-sided Armored Gold/Steel Mirrors (◢) whose steel backs shield stray rays—to energize all Emerald Receiver Cores (🟢) simultaneously while avoiding Red Fuse (✕) short circuits. - Exact Mathematical Optimal Par: Every daily puzzle displays its true minimum move count (
PAR), computed exhaustively via Breadth-First Search. Locking all cores in exact Par awards⚡ PAR PERFECT ★★★. - 1-Click Spoiler-Free Comment Scorecard: Using Devvit's user-scoped Reddit API (
permissions.reddit.scope: "user"+reddit.submitComment), players post a uniform-width Unicode grid of their board topology, rank, percentile, and streak directly into the post's comment thread—never leaking any mirror or prism orientation. - Devvit Redis Leaderboard & Streaks: Composite sorted-set scoring (
moves * 1_000_000 + timeMs) ranks fewest moves first and fastest completion time second, alongside live community solve counts, Par rates, and consecutive UTC daily streaks. - Weekly Difficulty Cadence + 7-Day Archive: Difficulty escalates cleanly from Mon–Tue
CALIBRATION(5×5, 2 cores) through Wed–ThuBIFURCATION(5×5, 3 cores, 2 splitters) and Fri–SatOVERLOAD(5×5, 2 fuses, 2 armored), culminating in Sunday6×6 MASTER(4 cores, 2 fuses, 2 splitters, 2 armored). Judges and players can test all four tiers anytime via the built-in 7-Day Circuit Archive without polluting today's leaderboard.
How we built it
- Shared Deterministic Core (
src/shared/puzzle.ts,src/shared/scorecard.ts): Identical TypeScript module runs on both client and server. AnFNV-1aUTC day hash seeds aMulberry32PRNG to construct candidate benches, validated by a cycle-safe optical ray-tracer and solved exhaustively with an exact BFS state-space search (solveOptimalPar) to prove solvability and compute exactPar. - Ultra-Light 60fps Client (
src/client/): Zero frameworks and zero external network/CDN requests (100%Devvit CSP-clean). Built with pure TypeScript, a HiDPI HTML5 Canvas renderer (renderer.ts) featuring spring-eased rotations (easeOutBack), pulsing laser beams, and victory particle sparks, plus a pure Web Audio API synthesizer (audio.ts) generating tactile clicks, harmonic core chimes, and victory chords with zero audio files. Total production client bundle:23.37 KBgzipped (HTML + CSS + JS). - Server-Authoritative Devvit Backend (
src/server/app.ts,src/server/index.ts): Built on Hono running on@devvit/[email protected]with Devvit Redis and Reddit integrations:GET /api/init&GET /api/puzzle: serves today's puzzle (withsolutionRotsstripped!), live leaderboard, community stats, streak, and 7-day archive.POST /api/submit: server-side anti-cheat reconstructs today's deterministic board on the server, re-traces the submitted rotation array, rejects unsolved or fuse-overloaded states, rejects impossible move counts< par, and locks each Redditor's first official completion per day.POST /api/share-comment: posts the deduplicated spoiler-free scorecard comment as the signed-in user./internal/scheduler/daily-post,/internal/triggers/on-app-install,/internal/menu/post-create: idempotent automated daily posting at00:00 UTC, automatic initial post on subreddit install, and moderator quick-create menu item.
Challenges we ran into
- Zero-Scroll Dual-Surface Fit: Reddit's inline post height (
height: "tall") behaves very differently on a390×520mobile portrait screen versus a700×520desktop feed card. We engineered a responsive Swiss-arcade shell that adapts dynamically—showing a compact HUD + full-width touch board on mobile and a dual-column optical bench + telemetry/key/top-operators rail on desktop—with zero scrollbars on both surfaces and 1-taprequestExpandedMode. - Splitting Client & Server TypeScript Configs on
@devvit/[email protected]:@devvit/webuses conditional"browser"package exports (clientImportInServerCodePanic/serverImportInClientCodePanic), requiring clean splittsconfig.client.json(customConditions: ["browser"]) andtsconfig.server.jsonbuilds plus verifieddevvit.jsonv1 schema compliance. - Guaranteeing Zero Unsolvable Days: Naive random optical boards often start already solved, overload a fuse unavoidably, or require trivial 1-click solves. Combining constrained layout generation with an exact BFS solver over the rotatable state space eliminated bad seeds completely.
Accomplishments that we're proud of
- 365/365 Mathematical Solvability Proof: Our automated Node test suite (
npm test) deterministically generates and exhaustively BFS-verifies 365 consecutive daily boards (2026-12-01through2027-11-30, including all 52 Sunday6×6 MASTERboards) in 914 ms (avgPar = 6.49, range[4..10],0unsolvable boards,4/4test suites passing). 23.37 KBGzipped Total Client: Instantaneous in-feed loading with zero external fonts, sprites, audio downloads, or third-party CDNs.- Zero-Trust Server Validation: Impossible to spoof a leaderboard time or sub-Par move count from DevTools—every submission is ray-traced and verified server-side in Hono before touching Redis.
- Full Keyboard & Touch Accessibility: Complete Arrow-key cell navigation, Space/Enter tile rotation,
Zundo,Rreset, andMmute alongside responsive touch targets.
What we learned
- Shipping directly on
@devvit/[email protected]revealed concrete SDK ergonomics gaps—from conditional export diagnostics and JSDoc/TypeScript mismatches (requestExpandedMode,@devvit/rediscamelCase vs lowercase examples) to protobuf server bundle bloat (@devvit/protos). We documented all 8 reproducible engineering observations with exact file paths, line numbers, and concrete fixes inDEVVIT_FEEDBACK_NOTES.md.
What's next for RELAY ZERO
- Community Circuit Designer: Allow verified solvers to craft custom
6×6optical benches and submit them as subreddit weekend challenges validated automatically by our exact BFS Par prover. - Subreddit vs. Subreddit Weekly Optics Cup: Aggregate subreddit average Par rates across communities running RELAY ZERO.
- Colorblind Pattern Modes & High-Contrast Optics: Distinct geometric beam dash patterns and shape-coded receivers so every player can read multi-beam bifurcations effortlessly.
Built With
- devvit
- hono
- html5
- node.js
- redis
- typescript
- vite
- web-audio-api