Inspiration
Twitch chat is at its best when the audience can shape a shared moment. We wanted to turn chat's playful chaos into a stream overlay that feels immediate for viewers but stays controllable for the streamer.
What it does
ChaosForge is an OBS Browser Source arcade arena. Viewers type !forge rules in plain English, such as !forge reverse gravity and make the floor lava. The streamer sees each proposal in a control deck and can approve or veto it, vote with !vote <number>, or turn on Auto-Pilot to approve the top-voted proposal every 30 seconds. An approved rule changes gravity, hazards, visual presets and shields in a transparent Canvas 2D overlay for a short round.
The included demo mode needs no Twitch login. It generates clearly labeled DEMO proposals, votes, cheers and a raid, and sends them through the same parser, queue and approval path as live events.
How we built it
- Stack: TypeScript, Node.js, Express, Server-Sent Events, vanilla JavaScript, Canvas 2D and Web Audio.
- Safety by design: a deterministic parser maps viewer text into a small, validated effect schema, and every value is clamped. Viewer text is never executed as code.
- Proposal queue: it strips links, normalizes repeated characters, caps text at 120 characters, enforces per-viewer cooldowns, deduplicates Twitch message IDs, limits the queue to 10, and allows one vote per viewer.
- Live mode: Twitch EventSub over WebSocket (chat messages, cheers, raids), with a localhost OAuth token capture, scope validation, reconnect handoff handling and recovery after unexpected disconnects.
- Tests: 30 automated tests cover the parser, effect validation, queue rules and EventSub logic.
How we used OpenAI Codex
We built ChaosForge with Codex in incremental slices: safe token capture, effect validation and parser tests, the canvas overlay, the queue/deck/SSE loop, EventSub reconnect tests and the documentation.
Codex Session ID: 01a19e07-675b-74b3-845e-9f358e0b2e16
Challenges
The central challenge was balancing audience freedom with streamer safety. Viewer language is reduced to clamped data, and the streamer keeps a clear approval gate. We also made the whole loop demonstrable without a live token, so demo events use the same internal pipeline instead of a separate mockup.
Accomplishments we're proud of
- A complete, login-free demo loop that a judge can watch in under a minute.
- A streamer approval step for every live arena change.
- Tested queue controls and EventSub handling.
- A transparent 1920×1080 OBS-ready overlay with procedural visuals and sound.
What's next
Durable event logging, richer arena objectives (such as hazards that affect the player), channel-point redemptions, and an optional natural-language enhancer that is schema-validated and always falls back to the deterministic parser.
Limitations
State is held in memory, so a restart clears the queue. The optional AI rule conversion is not implemented, and the deterministic parser handles every rule.
Built With
- express.js
- html5
- https://github.com/vikassharma270907-alt/chaosforge-deployment-and-compliance-check.
- javascript
- node.js
- openai-codex
- server-sent-events
- twitch
- twitch-eventsub
- typescript
- web-audio-api
- websocket