Skip to content

Vekkul/Infinite-RPG

Repository files navigation

Infinite RPG

Embark on a never-ending adventure in a world crafted by AI. Explore, battle, and become a legend in an RPG that's different every time you play. Powered by Google's Gemini, this project showcases a unique, procedurally generated gaming experience right in your browser.

✨ Features

  • Procedurally Generated World: Explore a unique world map in every playthrough, complete with distinct locations, biomes, and connecting paths, all generated by the Gemini API.
  • Context-Aware Narrative: A sophisticated Journal System tracks your quests and hidden narrative "flags". The AI remembers your actions—whether you stole an apple or saved a king—ensuring that your choices have long-term consequences on future events.
  • Immersive Audio: Listen to the story unfold with AI Text-to-Speech narration powered by Gemini, bringing a dungeon master's voice to your adventure.
  • Endless Exploration & Story: Every location you visit has a unique, AI-generated description and set of actions. Uncover new scenarios, find hidden items, and stumble upon unexpected events. No two adventures are the same!
  • AI-Powered Character Creation: Bring your hero to life! Describe your character's appearance, define a class, and the AI will generate a unique 16-bit pixel art portrait.
  • Deep, Tactical RPG Combat: Engage in classic turn-based battles against a bestiary of AI-generated monsters.
    • Customizable Abilities: Mix and match your loadout! Unleash an Earthen Strike, cast Fireball or Ice Shard, perform a Lightning Strike, or attempt to Befriend your foes.
    • Social Combat: Use the Befriend ability to attempt to resolve conflicts peacefully with non-humanoid entities, relying on your Charisma and Luck.
    • Advanced Enemy AI: Face foes with unique abilities (Heal, Shield, Drain Life) and distinct combat personalities (Aggressive, Defensive, Strategic, Wild).
    • Status Effects: Manage tactical conditions like Burn, Chill, Shock, and Grounded.
  • Dynamic Social Encounters: Not every problem is solved with a sword. Navigate AI-generated social scenarios, make choices, and face the consequences, earning unique rewards (XP, Items, or Quests) along the way.
  • Robust Character Progression:
    • Class Identity: Define your own class name and roleplay your way.
    • Attributes: Customize your Strength, Intelligence, Agility, and Charisma.
    • Luck: A derived stat that influences critical hits and social success.
    • Crafting: Gather materials and craft powerful potions, weapons, and armor.
  • Optimized Save System: Your epic journey and all generated assets are saved locally using IndexedDB, ensuring fast load times and no data loss.
  • Retro Aesthetics: Toggle a CRT scanline effect in the settings for that authentic 90s RPG feel.

🎮 How to Play

The game is controlled through simple button clicks.

  1. Start Your Journey:

    • Click Start Your Journey to begin a new game.
    • If you have a previous save file, you can Load Game to continue your adventure.
  2. Create Your Hero:

    • Enter a name for your character.
    • Define your Class: Type in any class name you want (e.g., "Cyber-Paladin", "Hedge Wizard", "Potato Merchant").
    • Allocate Attributes: Distribute points into Strength, Intelligence, Agility, and Charisma to shape your playstyle.
    • Select Abilities: Choose 2 starting skills from a list of martial and magical abilities.
    • Write a short description of your character's appearance (e.g., "A grizzled old warrior with a long white beard and a scar over his left eye").
    • Click Generate Portrait and watch the AI create a unique pixel art image for you.
    • Once you're happy, click Start Adventure!
  3. Exploring the World:

    • Navigate the world using the Map. Move from one discovered location to another.
    • Travel between locations might trigger a random combat encounter!
    • When you arrive at a location, read the AI-generated description of the area.
    • Choose from the available actions, which can include moving to a new location or performing a local action like "Search the abandoned shack" or "Listen to the wind".
    • Improvise: Type your own custom action into the text box to try anything you can imagine!
    • Check your Journal: Click the Book icon to view active quests, completed archives, and detailed logs of your journey.
  4. Engaging in Combat:

    • When you encounter enemies, you will enter a turn-based combat screen.
    • On your turn, choose an action:
      • Attack: Select a target and deal damage.
      • Ability: Use your class-specific skill or try to Befriend a creature.
      • Defend: Reduce the damage you take from the next enemy attack.
      • Inventory: Open your bag to use items, like a healing potion.
      • Flee: Attempt to escape the battle. Be careful, it might not always work!
    • Defeat all enemies to win the battle, earn XP, and potentially find loot!
  5. Inventory & Crafting:

    • Open your inventory to manage items and equipment.
    • Visit the Crafting tab to combine materials into useful gear and potions.
    • Check the Stats tab to see your current attributes and equipment bonuses.

🛠️ Tech Stack

  • Frontend: React, TypeScript, Tailwind CSS
  • State Management: React useReducer + Custom Hooks (Game Engine Pattern)
  • Storage: IndexedDB (via native API) for binary assets and game state
  • AI/Content Generation: Google Gemini API
    • gemini-3-flash-preview for game logic, descriptions, enemy generation, world-building, and maintaining narrative continuity.
    • gemini-2.5-flash-image for generating character portraits and the world map.
    • gemini-2.5-flash-preview-tts for dynamic voice narration.

This project serves as a demonstration of how to leverage a powerful Large Language Model (LLM) to create dynamic, procedural, and infinitely variable game content.