Inspiration
When a streamer asks an open-ended question like "What should we build today?" or "How do we survive this run?", great suggestions flash past in Twitch chat and vanish within seconds. Standard channel polls only offer three or four predetermined buttons. They cannot capture nuance, unusual ideas, or collective strategy.
We built ChatAtlas Foundry to give stream communities real creative agency. Viewers type raw ideas into chat, watch them group into thematic constellations with exact source credit, and collaborate with the broadcaster to approve a blueprint. During the live storm, the community coordinates in real time to steer power, shields, and vents. If the city falls, the host reopens the design with the same seed so everyone can see the direct consequence of their changes.
What it does
ChatAtlas Foundry turns Twitch chat into an interactive co-creation studio:
- Intelligent Idea Ingestion: Ingests
!idea <thought>contributions in real time through Twitch EventSub. It deduplicates spam, normalizes text, and caps input at 5 ideas per viewer. Names remain anonymous by default unless a viewer opts in with!credit on. - Dynamic Constellation Mapping: Groups suggestions into six strategic themes (Harvest the storm, Save the surplus, Protect the city, Let energy escape, Grow resilience, and Unexpected possibilities). Broadcasters can rename or merge clusters on the fly without losing attribution.
- Source-Linked Blueprints: Maps community themes to a 12-point construction budget across functional modules (Sun sails, Storm collectors, Storage cells, Cloud shields, Discharge routes, and Sky gardens). Every module explicitly cites the exact viewer messages that inspired it.
- Deterministic Multi-Scenario Simulation:
- The Great Tempest: A violent lightning storm where high energy collector intake without grounding vents causes electrical overload and hull rupture.
- The Frost Descent: A sub-zero cryo hazard where thermal heat retention and venting prevent structural freezing.
- Real-Time Co-Op Chat Commands: Viewers coordinate live actions during the 18-beat storm using
!act store,!act shield, or!act ventto balance energy reserves and stave off overload. - Iterative Revision: If the city ruptures, the host restarts with the same storm seed. The audience sees the exact mathematical difference between V1 and V2 instead of feeling punished by random chance.
- Production-Ready OBS Stage: A clean broadcast overlay (
/overlay) designed for stream readability at 1080p and 720p, hiding host controls while keeping live city visuals, theme nodes, and telemetry front and center.
How we built it
We designed ChatAtlas Foundry with high reliability as the baseline:
- Zero-Dependency Core: Built purely on native Node.js (22 LTS and 24) using built-in modules (
node:http,node:crypto,node:events,node:fs). There are zero bloated third-party runtime packages to break on stream day. - Twitch Integration: A native WebSocket client connected directly to Twitch EventSub (
channel.chat.message). It handles OAuth authorization, automatic token refresh, socket reconnects, and safety pauses if the stream connection drops. - Deterministic Engine: Mathematical state transitions where seed values and player actions yield identical results every time: $$\text{Integrity}_{t+1} = \text{Integrity}_t - \max(0, \text{Hazard}_t - \text{Shield}_t) - \lfloor \text{Overload}_t \times 0.25 \rfloor$$
- Living Canvas Graphics: Custom HTML5 Canvas rendering engine drawing orbital constellation nodes, modular island hulls, auroral shield barriers, and environmental weather particles with reduced-motion support.
- Bespoke Visual Language: A tactile botanical sage (
#8B9A6E), warm cream parchment (#F7F2EB), and linen (#EAE2D6) palette paired with Fraunces editorial display typography and JetBrains Mono telemetry.
Challenges we ran into
A major technical hurdle was live state synchronization during broadcaster editing. Because ChatAtlas Foundry pushes sub-second Server-Sent Events (SSE) updates to keep the stream synchronized, initial builds re-rendered the blueprint editor whenever a new viewer chatted. This stole focus and wiped cursor position while the broadcaster was typing a custom blueprint title. We solved this by implementing state signature hashing and cursor selection range preservation.
Another challenge was privacy and moderation compliance. We built strict GDPR-style forgetting: if a viewer types !forget, the system immediately purges their ideas, removes their name from past and present blueprints, deletes their voting weight, and scrubs cached records while preserving the overall game simulation integrity.
Accomplishments that we're proud of
- 31 Passing Automated Tests: Full test suite covering deduplication, deterministic seed parity, budget enforcement, Twitch reconnect recovery, and injection security with zero failures.
- Complete Offline Demo Mode: Anyone can clone the repository and run the entire experience locally with simulated chat and seeded storms without needing an active Twitch API key or AI credentials.
- Genuine Per-Module Attribution: Audience members do not just get a generic thanks at the end of the stream. They see their specific username cited directly under the module their idea unlocked.
What we learned
We learned that audience interaction is vastly more engaging when the feedback loop is transparent. When viewers understand why their city failed (for example, generating 24 energy with only 12 capacity and no discharge vent), they immediately rally around the solution in chat for the next attempt. Co-creation feels earned rather than scripted.
What's next for ChatAtlas Foundry
- Twitch Extension Panel: An on-video overlay panel for mobile and desktop viewers to vote and trigger actions with one tap.
- Dual-Broadcaster Co-Op: Linking two separate Twitch channels together so two streamer communities can build neighboring cities and trade energy during shared weather hazards.
- Community Blueprint Library: Exportable JSON world cards that viewers can share across Discord and Reddit to challenge other channels to beat their survival score.
Built With
- automated-testing
- canvas-api
- crypto
- css3
- devtools
- html5
- javascript
- node.js
- obs-studio
- openai-codex
- server-sent-events
- twitch
- twitch-eventsub
- websockets