Most "gamified" learning apps are quizzes with a timer, and our first version of SideQuest was no better: template games with AI-written labels. So we flipped it and made the concept the physics of the world. A student enters what they're learning and what they're into, and SideQuest designs an original game where understanding the idea is how you win. For derivatives, you plan a race car's velocity so its position matches a ghost car's graph. Since $v(t) = \frac{dx}{dt}$, a steep graph means floor it and a flat one means stop, so a player who confuses height with speed visibly loses. We built it with Next.js, React and TypeScript. One model writes a game spec, a validator rejects any spec that doesn't name a concrete causal rule, and a stronger model writes real Game.tsx, mechanics.ts and styles.css files. The game then runs in a locked-down sandboxed iframe, where we compile it, press keys, collect errors and send them back to the model for up to two automatic repairs. Topics with verified reference facts are marked verified, and everything else is labeled experimental.
The hardest parts were reliability and speed. Asking for code inside JSON broke the escaping, so we switched to file tags. Repairs that rewrote whole files broke code that was already working, so repairs and remixes now use SEARCH/REPLACE edits. One model reasoned for over five minutes before writing any code, so we capped its reasoning effort, streamed the output live and added a progress bar. We also dealt with constant rate limits (fixed with fallback model lists) and a sandbox bug where our own wrapper shadowed React and broke every game. Three lessons stood out: validate everything the model outputs, feed real error messages back to it, and one complete example game teaches a model more than pages of rules.