Inspiration

What if you could change the laws of physics instead of controlling objects?

We wanted to build a puzzle game where players solve problems by changing the rules of the world. But changing a rule is only half the idea: when you change it matters just as much as what you change. Turning gravity off preserves momentum; a leftward pull first slows a rightward-moving ball before turning it back. Those small surprises became the heart of Optional Reality.

What it does

Optional Reality is an AI-powered 2D physics puzzle game where players write natural-language rules, prepare them in a queue, and choose the moment to press Send now.

The current game has 21 playable levels across 3 chapters and 63 collectible stars:

  • Motion: 8 puzzles about acceleration, momentum, braking, reversing direction, and steering around obstacles.
  • Collisions: 10 puzzles about rebounds, angled banks, friction, soft landings, and crossing gaps.
  • Devices: 3 bakery puzzles combining a conveyor, a charging toaster, an updraft, and a bell-triggered shutter.

Reaching the exit passes a level; collecting all three stars earns full score. Players can retry different rules and timings, and their best scores are saved on their device. The game runs in a desktop browser; a separate mobile-friendly introduction lets visitors explore and share the project.

How we built it

We built the game during SBUHacks with React, TypeScript, Vite, Matter.js, Canvas 2D, Node.js, Express, and Zod.

Google Gemini is the primary in-game language interpreter. It turns conversational requests, such as “Give the fan a gentle upward draft,” into structured operations using the current level's objects, rule state, and editing permissions. A local parser handles supported explicit commands without an API call, and DeepSeek provides a separately configured fallback if Gemini fails.

Both the server and client validate operations before execution. Matter.js and our game runtime calculate motion, collisions, timing, and scoring; the model does not move the ball directly or run arbitrary generated code. This keeps language flexible while preserving a consistent physical world. API credentials remain on the backend.

Challenges we ran into

Natural-language interpretation, AI latency, and mid-simulation rule changes were our biggest challenges. We separated interpretation from execution, paused simulation during model waits, and made prepared messages reviewable before they take effect. We also had to prevent delayed responses or repeated clicks from applying a rule twice.

Level design required repeated physics playthroughs: a puzzle should reward observation without depending on a single frame-perfect click. We tested different sending positions and material strengths, and verified reproducible three-star routes.

Accomplishments and what we learned

We built a complete playable experience with 21 levels, contextual tutorials, a command queue, retries, saved progress, original interface work, and a publicly hosted demo. Automated physics and UI tests complement real browser playthroughs and separate live-model checks.

We learned that AI does not need to control everything to create a new gameplay experience. Gemini makes a player's wording usable; the player still chooses the rule and the moment, and the physics engine provides the consequences.

AI-assisted development and artwork

We used GPT-6.1 Sol through Codex and GPT-6 through ChatGPT to assist with coding, debugging, tests, and development. Human contributors provided the project direction, initial visual prototypes, and gameplay feedback. The title illustration and layered title artwork use ImageGen; playable geometry and tutorial diagrams are implemented in code, and the bakery work is credited to our teammate in the repository.

AI usage, artwork credits, and implementation notes

What's next

We want to add more physical mechanisms, new puzzle routes, and an open-ended sandbox for experimenting with the same rule system.

Reality is optional. Change the rules. Choose the moment.

Built With

Share this project:

Updates

Submission history