Inspiration
The gap between watching a streamer and playing alongside their community is still large. I wanted a streamer to turn a failed attempt into a quick, shared challenge that viewers can open immediately in their browser and join!
I also think small games deserve a bigger place on Twitch. AI is making games far easier to build, so more indie developers are rising. Twitch should not be limited to big AAA titles. Integrating something like this would let smaller game developers build a community around small, quick games, which are always fun to play together.
I believe this would be revolutionary for indie-game developers to build small engaged communities.
What it does
Every streamer hears it: you crash, and chat says they would have made it. Beat This Moment lets them prove it.
A streamer signs in with Twitch, plays our browser game, Neon Freight, and publishes a saved moment from just before a crash. The challenge is posted in Twitch chat right away. Viewers follow the link and retry from the same position, speed, and energy. Their results appear on a shared live leaderboard and an OBS overlay. The best finished run becomes a ghost to race or replay, and chat hears about each new leader.
Twitch chat connects the experience:
!challengereturns the current playable link.!joincreates a temporary entry link for the chatter. Twitch tells us who typed the command, so that run carries their Twitch name on the board.
Guests can also play without a Twitch account, and are labeled as guests. Streamers can remove anyone from the board, and guest names pass a basic filter before they can reach the stream.
How we built it
We built the dependency-free Node.js server, the Canvas game, the interface, and the Twitch integration with OpenAI Codex. One fixed-timestep game engine runs in both the browser and the server. Each attempt records its inputs, and the server replays those inputs from the saved snapshot to work out the score itself. That is why a replay comes out exactly the same, and why a made-up time does not count.
The Twitch integration uses Twitch OAuth for broadcaster sign-in, with the token and owner account validated against Twitch, plus EventSub WebSockets and the Send Chat Message API. The prototype runs on a small GCP VM with a persistent disk and HTTPS, with an OBS scene for streaming and a separate transparent leaderboard overlay.
Challenges we ran into
The live board worked locally but lagged on the hosted game. The web server was compressing the live event stream and holding it back, so a browser showed new runs only after its own run or a reload. We turned compression off for that stream and checked the fix in a real browser.
What we verified
- 59 automated tests cover deterministic replay, snapshot restoration, ranking, host authorization, rate limits, persistence, OAuth protections, moderation, and mocked chat behavior.
- Separate-browser testing verified publishing, viewer entry, score submission, live leaderboard updates, and replay.
!challenge,!join, the new challenge post, and the new leader post all worked in real Twitch chat against the hosted game.- A public stream to
0xtigerclawplayed correctly in a separate signed-out Twitch viewer. - The hosted game refused two fake runs: a made-up result, and a finished run sent faster than real time.
Scope and current limitations
This prototype supports one purpose-built browser game. It does not derive playable game state from arbitrary Twitch video. Server replay checks scores but does not prevent bots or tool-assisted inputs.
What's next
Add independently authenticated viewer identities and integrations with games that can expose restorable state.
Built With
- caddy
- eventsub
- google-cloud
- html5
- javascript
- node.js
- oauth
- obs
- openai-codex
- twitch