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 RaidForge Codex Arena: Live Twitch Chat & Codex Boss Raid
Inspiration
Live streams thrive on audience participation, yet most Twitch games only allow shallow binary polls. We wanted to let Twitch chat viewers actively rewrite the game physics and boss AI of a live stream in real time—safely powered by OpenAI Codex.
What It Does
RaidForge Codex Arena is an interactive Twitch stream overlay and 60fps Cyber-Hydra Boss Raid companion where Twitch Chat & EventSub events trigger real-time OpenAI Codex code mutations:
- Live Twitch Chat & EventSub Triggers (
!mutate low_gravity,!mutate boss_rage,!cheer 500):- Viewers in Twitch Chat (
channel.chat.messageandchannel.cheerEventSub webhooks) trigger live arena rule mutations and Bits Meteor Strikes.
- Viewers in Twitch Chat (
- OpenAI Codex Live Physics & Boss-AI Mutator (
backend/codex_arena_engine.py):- Translates crowd commands into deterministic game-loop patches (
gravity_scale,projectile_speed,boss_hp,streamer_shield,hype_combo) using OpenAI Codex (codex-mini-latest/gpt-5-codex).
- Translates crowd commands into deterministic game-loop patches (
- Deterministic Python AST Safety Gate (
validate_mutation_ast):- Parses every Codex-generated patch into an Abstract Syntax Tree (
ast.parse) and blocks anyimport,exec,eval, or file/system calls before hot-reloading the 60fps Twitch Canvas overlay.
- Parses every Codex-generated patch into an Abstract Syntax Tree (
How We Used OpenAI Codex (Session ID: sess_codex_019a1b8e-7c42-7f90-b3d1-98e4c210a6f4)
- OpenAI Codex Session ID (
/status):sess_codex_019a1b8e-7c42-7f90-b3d1-98e4c210a6f4 - We used OpenAI Codex CLI (
codex --model codex-mini-latest) across the entire engineering lifecycle:- Scaffolded the Twitch EventSub & IRC Mutator Engine (
backend/codex_arena_engine.py) withArenaStateandCodexMutationPatchdataclasses. - Engineered the Deterministic AST Security Gate (
validate_mutation_ast) and verified it with automatedpytestunit tests (tests/test_codex_arena.py—2 passed in 0.02s). - Built the Split Broadcast Studio UI (
public/index.html,public/app.js) combining the 60fps HTML5 Boss Raid Canvas, Twitch Chat simulator, and OpenAI Codex CLI terminal inspector.
- Scaffolded the Twitch EventSub & IRC Mutator Engine (
Links & Verification
- Live Interactive Twitch Overlay & Codex Broadcast Studio: https://kevin9327.github.io/TwitchConCodexArena/
- Public GitHub Repository (MIT License): https://github.com/kevin9327/TwitchConCodexArena
Built With
- codex
- game-development
- html5
- javascript
- openai
- python
- twitch