💡 Inspiration

The moment science made sense to me wasn't a textbook — it was an interactive sim where I could grab a planet and fling it. But those classic sim sites cover a fixed menu of topics, and they look their age. I wondered: what if you could just type any concept — "why do leopards have spots?", "charge a capacitor" — and a real, playable experiment appeared in seconds? That's Lumina.

🔬 What it does

  • Type anything in STEM → Lumina builds a live, interactive simulation with real physics running at 60fps in your browser. No sign-up, works offline.
  • 9 hand-built simulation engines: gravity & orbits, double pendulum chaos, projectile motion, ideal gas (kinetic theory), electric fields, double-slit wave interference, Gray–Scott Turing patterns, an RC circuit with a live oscilloscope, and Conway's Game of Life.
  • Everything is touchable: drag planets into new orbits, paint reaction-diffusion chemicals with your pointer, flip the capacitor switch — with live parameter sliders, stats readouts and speed controls.
  • AI tutor explains what's on screen, suggests "try this" experiments, and drops fun facts tied to the running sim.
  • Full lesson mode: one click sends the topic to a Render Workflow that plans an outline, builds several related simulations in parallel, writes a quiz, and streams the whole lesson back. Clicking a section hot-swaps the live sim; the quiz scores itself with explanations.
  • Never breaks: works with zero API keys via an offline generator; bring your own Gemini/Groq/OpenAI/Anthropic key for free-form topics; optional Tavily research grounds lessons in real facts.

🛠️ How we built it

  • Frontend: React 18 + TypeScript + Vite, Tailwind CSS, Framer Motion, Zustand — and a custom Canvas-2D physics engine written from scratch (RK4 integration for the double pendulum, Verlet-style orbital dynamics, a finite-difference Gray–Scott PDE solver, an exponential RC solver driving a virtual oscilloscope). The whole app ships in ~120 KB gzipped.
  • The key design idea is a tiny JSON contract called a SceneSpec. Whether it comes from the offline keyword engine, an LLM, or the Render Workflow, every spec is sanitized and clamped before it touches the engine — so bad AI output can never crash a simulation.
  • Backend: a FastAPI gateway plus a Render Workflow (render_sdk): generate_lesson fans out plan → N parallel build_section tasks → quiz → assemble, and the gateway streams task progress to the UI. Three-tier graceful degradation: Render Workflow → local gateway → pure in-browser. The demo can never die on stage.
  • Deployed the site publicly (Railway) with a render.yaml blueprint for the static site + gateway, all from one repo.

The sims solve the real equations — the double pendulum integrates the full Lagrangian equations of motion, orbits obey the inverse-square law ( F \propto 1/r^2 ) (Kepler's third law emerges on its own), and the circuit follows ( V(t) = V_0(1 - e^{-t/\tau}) ) with ( \tau = RC ).

🧗 Challenges

  1. Gray–Scott nearly beat us. Reaction-diffusion is brutally sensitive: our first "spots" preset (F=0.035, k=0.065) sits in a regime where patterns starve and die — the canvas slowly went black. We learned to read the Gray–Scott phase diagram and re-tuned every preset into self-sustaining regimes (mitosis F=0.037/k=0.06, solitons F=0.030/k=0.062) — catching the last bad preset by screenshotting the live site hours before this deadline.
  2. Numerical stability on any device: fixed-timestep integrators with clamped parameters so phones don't explode the math.
  3. Making AI demo-proof: strict JSON schema, sanitizer, and fallbacks at every layer — the app must work with no keys, no network, no backend.
  4. Three days, solo. Ruthless prioritization: reliability > features.

🏆 Accomplishments

  • 9 real physics engines, no physics libraries, 100% client-side.
  • A complete AI → simulation → lesson → quiz pipeline with parallel fan-out on Render.
  • Publicly deployed, offline-capable, zero-crash across every sim we shipped.

📚 What we learned

PDE parameter regimes and chaos theory (the hard way), designing for graceful degradation, Render Workflows' task fan-out model, and that "test it visually over time" is a real QA discipline for simulations.

🚀 What's next

An optics bench and N-body galaxy sims, sound, shareable lesson links for teachers, and classroom dashboards.

🎯 Tracks

  • Best Use of Render — lesson generation runs as a Render Workflow (plan → parallel build_section → quiz → assemble) behind a FastAPI gateway, with a render.yaml blueprint in the repo.
  • Best AI Hack — AI is the interface: natural language → live experiment, an in-context tutor, and AI-authored lessons with quizzes, with BYOK support and honest offline fallback.
  • Best Simulated Use of Circuit — a full RC circuit simulation: animated electron flow, charging/discharging capacitor, LED, and a live oscilloscope tracing ( V_c ) and ( I ) so you can read ( \tau = RC ) right off the screen.

Built With

Share this project:

Updates