Inspiration

We were inspired by the classic tension of The Oregon Trail—a game where every resource counts and every disaster feels personal. However, static event decks eventually become predictable. We wanted to see if we could use Gemini 3 to create a "Living Trail" where every crisis is authored live, specifically tailored to the player's current state. Our goal was to prove that LLM-driven narratives don't have to be "loose" or "hallucinatory"; they can exist within a strict, deterministic game engine to provide a reliable yet infinitely varied player experience.

What it does

  • Travel 2,000 miles while managing food, water, ammo, wagon health, and party morale.
  • Dynamic Events: Gemini 3 (gemini-3-flash-preview) drafts events; resolutions are requested only when you pick a choice.
  • Deterministic Core: Strict JSON schemas, item catalog checks, and invariant enforcement gate every model output.
  • Resilient UX: Async prefetch + cancellation + timeout logic ensures a non-blocking UI and instant fallback.
  • Debug View: Logs event IDs, latency, and token counts for full judge transparency.

How we built it

  • Engine: Python 3.12 with Pygame CE for 60 FPS rendering; background thread for Gemini calls.
  • AI Stack: google-genai SDK + pydantic v2 schemas to validate EventDraft and EventResolution.
  • Reliability: FallbackDeck guarantees offline play; a robust state machine enforces determinism.
  • Tooling: uv for environment management and pytest for validation paths.

Challenges we ran into

  • Predictable Latency: Solved with prefetch logic, a 5s timeout, and an ESC-to-fallback feature to ensure the game never stalls.
  • Safety and Continuity: Schema constraints and local catalog checks reject unsafe or anachronistic outputs.

Accomplishments that we're proud of

  • Exclusive Gemini 3 integration verified in both the code and documentation.
  • Fully implemented Requirement 10 latency resilience strategy.
  • Playable demo even with no API key; deterministic tests remain green.

What we learned

  • Schema-first prompts plus local validation make LLM gameplay reliable and trustworthy.
  • Prefetch + cancellation is the most effective way to hide LLM latency in a real-time loop.

What's next

  1. Chapter events on gemini-3-pro-preview for deeper narrative arcs.
  2. Prefetching choice resolutions to erase remaining wait times.

Built With

  • dotenv
  • gemini-3-api
  • google-genai
  • pydantic
  • pygame-ce
  • pytest
  • python
  • rdflib
  • uv
Share this project:

Updates