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 fluxiem

⚛️ Inspiration

As engineering students at KCG Tech, we constantly see peers struggling with the rote memorization of complex electromagnetic field theory. We built Electro-Chaos: Quantum Odyssey to bridge the gap between theoretical Maxwell equations and practical intuition. Why memorize Coulomb’s Law when you can feel the repulsion in real-time? We wanted to gamify the struggle of an electron trying to escape an atom.

🎮 What it does

Electro-Chaos is a high-fidelity, interactive physics survival game. You play as a single electron navigating the crushing gravity of Effective Nuclear Charge.

  • True Physics Engine: Enemies don't just "hit" you; they apply forces based on Coulomb's Law: $$F = k_e \frac{q_1 q_2}{r^2}$$
  • Wave-Particle Duality: Press 'Q' to collapse your wave function and quantum-tunnel through solid phonon lattices.
  • The AI Quantum Oracle: When your wave function inevitably collapses (Game Over), the game calculates your survival telemetry and fires it to our backend. A sarcastic AI physicist analyzes your specific run and roasts your failure.
  • Live Multiplayer Kill Feed: Your score and the AI's roast are instantly broadcasted to a live Discord server via an automated webhook pipeline.

🛠️ How we built it

We engineered a custom 60FPS physics engine from scratch using HTML5 Canvas and vanilla JavaScript, bundled with Vite for production speed. We mapped our architecture early on using Miro.

To handle the AI and telemetry without tanking the game's frame rate, we built a serverless backend relay using n8n. When a player dies, the client sends a payload to an n8n webhook. n8n then orchestrates a call to the Gemini 3 Flash model to generate the physics-based roast, and subsequently pipes that formatted data into a Discord Webhook to act as our live global kill feed.

🚧 Challenges we ran into

Our biggest roadblock was the dreaded 403 Forbidden and CORS preflight errors when trying to call LLM APIs directly from the browser client. We realized that hardcoding API keys in a client-side game was a massive security flaw. We executed a hard pivot in the final two hours, moving our entire AI logic into an n8n automation workflow. This completely bypassed the browser CORS restrictions and secured our credentials.

🧠 What we learned

We learned that calculating true Effective Nuclear Charge ($Z_{eff} = Z - S$) for dozens of particles simultaneously is incredibly taxing on a browser thread. We had to heavily optimize our vector math and collision detection loops. More importantly, we learned how to successfully chain asynchronous webhooks (n8n to Gemini 3 Flash to Discord) without interrupting the core user experience.

🚀 What's next for Electro-Chaos

We plan to introduce Magnetohydrodynamics (MHD) levels featuring Lorentz forces, and implement a global database leaderboard so players worldwide can compete for the highest ionization energy!

Built With

Share this project:

Updates