Inspiration
Infinite Odyssey is inspired by the convergence of classic, structured tabletop role-playing games (like Dungeons & Dragons) and the boundless, emergent narratives of modern AI storytellers. We were also heavily influenced by the "System" (stats, skills, leveling) tropes common in Isekai (Japanese "other world") fiction.
Our core idea was to bridge the gap between two types of games:
Traditional RPGs: Which have great mechanics (stats, loot, skills) but are limited by pre-written, finite storylines.
AI Storytellers (like AI Dungeon): Which offer infinite narrative freedom but often lack the structured mechanics, goals, and sense of progression that make a "game" compelling.
We wanted to create a "best of both worlds" experience: a game with the soul of a D&D Dungeon Master and the deep, personal progression of a classic cRPG, all brought to life with a unique, personalized visual identity.
What it does
Infinite Odyssey is a single-player, generative AI-powered role-playing game.
Personalized Character Creation: Players create a unique adventurer by choosing a name, gender, race (Human, Elf, Demonkin, etc.), and class (Warrior, Mage, etc.). Crucially, they can upload their own photo, which is used by the AI to blend their likeness onto the main character in every scene.
AI Dungeon Master: The entire game is run by an AI Dungeon Master (powered by Gemini). This AI generates dynamic, branching storylines, describes locations, narrates events, manages NPCs, and determines the outcome of player actions based on their character's stats and skills.
Generative Visuals: Every scene description provided by the AI is paired with a unique, high-definition image generated by Imagen 3. If the player uploaded a photo, the gemini-2.5-flash-image-preview model edits this image to include the player's face, creating a personalized "movie still" of their adventure.
Classic RPG Systems: The game features robust, traditional RPG mechanics, including 6 core attributes (STR, AGI, VIT, INT, WIS, LUK), skills, a leveling system (with attribute/skill points), HP/MP, an inventory, a wallet, a world map, and a quest journal.
The Destiny System: This is a unique meta-mechanic. Players earn "Destiny Points" by playing. They can spend these points to perform two "reality-bending" actions:
Destiny Interference: Choose from a pre-set list of powerful, positive events.
Reality Twisting: Write their own desired outcome (e.g., "I find a hidden treasure chest"), which the AI DM is rules-bound to fulfill, at a high cost.
Local Persistence: The game uses IndexedDB to save all character progress, inventory, and world state, allowing players to create multiple characters and continue their adventures at any time.
How we built it
Frontend: The entire application is a single-file React app (.jsx). We used React Hooks (useState, useEffect, useRef, useCallback) for all state management and logic.
UI & Animation: The UI is built with Tailwind CSS for a responsive, modern, and dark-themed dashboard. Framer Motion is used for all modal animations and UI transitions, giving the app a polished feel.
Narrative Engine (AI DM): We use the Gemini 2.5 Flash model. The key is our highly detailed systemPrompt that instructs the AI on how to be a "Dungeon Master," respect game rules (like stats and LUK), and manage the game state.
Structured AI Responses: To prevent the AI from "going rogue," we enforce a rigid JSON Schema for the callGeminiApiForStory function. The AI must return a valid JSON object containing fields like sceneDescription, hpChange, xpGain, newItems, and isDead. This makes the AI response parsable and state-safe.
Image Generation:
Base Scene: We use Imagen 3 (imagen-3.0-generate-002) for high-quality, 16:9 cinematic background images.
Face-Blending: This is a key innovation. We use Gemini 2.5 Flash Image Preview (gemini-2.5-flash-image-preview) as an image-editing API. We provide it the base image and the user's uploaded photo, with a prompt to "blend the face from the photo onto the character in the scene." We also have a fallback to just Imagen 3 if the user skips the photo upload.
World Generation: During character creation, we make a one-time call to Gemini 2.5 Flash (callGeminiForWorldGen) to procedurally generate the world's lore, map locations (with x/y coordinates), and the Destiny System rules for that specific playthrough.
Local Storage: We created a GameDB helper class that wraps the browser's IndexedDB API, providing simple async methods (saveData, getAllData, deleteData) for persisting all character and game metadata.
Challenges we ran into
AI Prompt Engineering & Reliability: The biggest challenge was forcing a creative, generative AI to consistently follow rigid game rules. Early versions of the AI DM would forget inventory items, ignore player stats (especially LUK), or fail to return a valid JSON object. This required months of refining the systemPrompt and the responseSchema to be failure-proof.
The "Upload Face" Pipeline: Getting the face-blending to work reliably was incredibly difficult. gemini-2.5-flash-image-preview is powerful, but balancing the scene description, the character description, and the face-blending in a single prompt often led to "melted" or inconsistent results. We also had to build a fallback for when the API fails or the user doesn't upload a face.
API Latency & User Experience: A single player action can trigger three separate API calls (Gemini for text, Imagen for the scene, and Gemini-Image-Edit for the face). This creates significant latency. We had to build a robust LoadingOverlay and a fetchWithRetry function to manage this and keep the user informed.
State Management: In a single-file React app, managing a complex, deeply-nested game state object (activeCharacterState) and passing update functions (setActiveCharacterState) to all the different modals (Backpack, Character, Map) without prop-drilling was a major structural challenge.
Accomplishments that we're proud of
The Hybrid AI System: We successfully created a "triple-threat" AI system where a text AI (Gemini) and two different image AIs (Imagen 3 + Gemini-Image-Edit) work together in a single loop to create a cohesive, multi-sensory, and personalized experience.
The "Upload Face" Feature: It's our standout feature. When it works, the "wow" moment a player gets from seeing their own face in a dynamically generated fantasy scene is incredibly powerful and something few (if any) other games offer.
The Destiny System: We're proud of this as a solution to AI "stubbornness." Instead of fighting the AI, we gave the player a "meta-power" to control it. It turns a potential frustration into an empowering game mechanic.
Local-First Persistence: Using IndexedDB, the game is fast, works offline (once loaded), and respects user privacy by keeping all data, including uploaded photos, entirely on the client-side. The GameDB wrapper makes it all manageable.
What we learned
System Prompts are the new "Code": For AI-powered apps, the systemPrompt is just as important as the React code. The level of detail and the "rules-lawyering" we had to put into our prompts taught us that prompt engineering is the key to building reliable AI applications.
JSON Schemas are Non-Negotiable: If you are building an app on top of an LLM, do not rely on text parsing. Using the generationConfig with responseMimeType: "application/json" and a responseSchema is the only way to guarantee app stability.
Fallbacks are Everything: When dealing with generative AI, you must assume it will fail. Our fallback from the complex face-blending API to the simpler Imagen 3 API ensures the game never "breaks" visually and can always proceed.
Image-to-Image is the Future (and it's hard): gemini-2.5-flash-image-preview showed us the incredible potential of generative image editing. We learned that this is where the real personalization will come from in future applications, but it's still an emerging and difficult technology to master.
What's next for Infinite Odyssey
AI-Powered Party Members: The party system is in the code, but it's static. The next major step is to allow players to recruit AI-controlled companions. The AI DM would generate their dialogue, manage their actions in combat, and have them dynamically react to the player's choices.
Dynamic AI-Generated Quests: Right now, the quest log is empty. We plan to have the AI DM generate new, multi-step quests (e.g., "Find the 3 Glinth-moss flowers") and programmatically add them to the player's quest journal (activeCharacterState.quests).
A Deeper Combat System: We want to move from a purely narrative combat system to a more structured, turn-based one. The AI would still narrate, but the player would be presented with a clear "Combat Menu" (Attack, Skill, Magic, Item), and their choices would be directly resolved using their stats and the AI's logic.
AI-Generated Audio: We plan to integrate a text-to-speech API (like gemini-2.5-flash-preview-tts) to have the sceneDescription read aloud, turning Infinite Odyssey into a fully-narrated audiobook-game.
Cloud Saves with Firebase: To allow players to access their characters from any device, the next logical step is to replace the local IndexedDB system with Firestore, moving the game saves to the cloud.
Log in or sign up for Devpost to join the conversation.