Skip to content

mrbrightsides/dungeonmaster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

57 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ AI Dungeon Master - Infinite RPG Adventure

An AI-powered, voice-enabled dungeon crawler with dynamic storytelling, strategic combat, and procedural quest generation powered by Google's Gemini 2.0 Flash Experimental

Built for the Google DeepMind Gemini 3 Global Hackathon 2026

Live Demo GitHub Earlier Version


๐ŸŒŸ Overview

AI Dungeon Master is a next-generation infinite 2D dungeon crawler where every decision matters and every story is unique. Powered by Google's Gemini 2.0 Flash Experimental model, the game generates dynamic narratives, adaptive encounters, strategic combat, and procedural quests based on player choices.

Unlike traditional RPGs with pre-written content, this game creates a truly infinite experience where the AI narrates your journey, generates enemies, designs quests, manages loot systems, and responds to your actions in real-time.

๐ŸŽฎ Play Now


โœจ Key Features

๐ŸŽญ Dynamic AI Storytelling

  • Real-time narrative generation using Gemini 2.0 Flash Experimental
  • Context-aware responses that remember your journey
  • Adaptive difficulty based on player level and performance
  • Unique encounters - no two playthroughs are the same
  • Narrative Branching - Player choices directly affect the environment
    • Example: "I light the torch on the wall" โ†’ Gemini updates game state AND narrates "The room is now brightly lit, revealing hidden passages..."
    • AI doesn't just write text - it actively modifies the world based on your actions
    • Environmental storytelling where your decisions have lasting consequences
  • Story Persistence via SIWE - Your legendary chronicles are permanently tied to your Ethereum address
    • Each wallet address represents a unique adventurer's legacy
    • Cross-device story continuity - your saga follows you everywhere
    • Future potential: Mint your greatest adventures as on-chain "Legendary Chronicles"

โš”๏ธ Advanced Combat System

  • 10 Unique Enemy Types: Goblin, Skeleton, Orc, Spider, Ghost, Dragon, Mimic, Golem, Vampire, Demon
    • Each enemy has unique stats, resistances, and weaknesses
    • Biome-specific enemy spawning for thematic encounters
    • Level scaling ensures balanced challenge throughout the game
  • Strategic Combat Mechanics:
    • Critical Hits with class-specific chances (Rogue 25%, Warrior 15%, Mage 10%)
    • 6 Status Effects: Burning ๐Ÿ”ฅ, Frozen โ„๏ธ, Poison ๐Ÿงช, Stunned โšก, Blessed โœจ, Cursed ๐Ÿ’€
    • 4 Damage Types: Physical, Magical, Fire, Ice, Poison, Holy
    • Resistance & Weakness System for tactical depth
    • Combat Log with detailed damage breakdown
  • Turn-based tactical gameplay where strategy matters
  • Visual feedback with particle effects and damage numbers
  • Boss encounters with unique mechanics

๐ŸŽฏ Quest System

  • 5 Quest Types: Kill, Explore, Collect, Survive, Boss
  • 4 Difficulty Tiers: Easy, Medium, Hard, Legendary
  • Dynamic Quest Generation based on player level and current biome
  • Progress Tracking with real-time updates
  • Meaningful Rewards: XP, Gold, and Rare Items
  • Max 3 Active Quests to prevent overwhelming players
  • Visual Quest Tracker with progress bars and difficulty badges

๐ŸŽ’ Advanced Loot & Inventory

  • 5 Rarity Tiers: Common (gray), Uncommon (green), Rare (blue), Epic (purple), Legendary (gold)
  • 4 Item Types: Weapon, Armor, Consumable, Treasure
  • Item Stats: Damage bonus, Defense bonus, Health restore
  • Stackable Items for consumables
  • Rarity-Based Visual Effects: Glowing borders and color coding
  • Usable Consumables: Health potions, mana elixirs, buff items
  • Gold Economy: Earn gold from quests and combat
  • Total Inventory Value Tracking

๐ŸŽ™๏ธ Professional Voice Narration (ElevenLabs Integration)

  • Deep, emotive Dungeon Master voice powered by ElevenLabs Turbo v2.5
  • Real-time text-to-speech - AI narrative instantly spoken
  • Adam voice model - Professional DM-quality narration
  • Smart audio queueing - Multiple narratives play smoothly without overlap
  • Toggle control - Enable/disable in settings dialog
  • Premium quality - Studio-grade voice synthesis
    • Stability: 0.5 (balanced consistency)
    • Similarity: 0.75 (high voice match)
    • Style: 0.5 (expressive delivery)
    • Speaker Boost: Enabled (enhanced clarity)
  • Server-side processing - Secure API key management
  • Seamless integration - Works with all game features (combat, exploration, achievements)

๐Ÿ”— Web3 Integration (SIWE)

  • Sign-In With Ethereum (SIWE) - Optional wallet-based identity
  • Cross-device progress sync - Save data tied to wallet address
  • Simple, lightweight implementation - No heavy wallet libraries
  • MetaMask/Web3 wallet support - Works with any Ethereum wallet
  • Non-blocking design - Game works perfectly without wallet
  • Graceful fallback - LocalStorage for non-Web3 users
  • One-click connect - Seamless wallet authentication

Technical Details:

  • Ethers.js 6.x for Ethereum interactions
  • SIWE (v3.0) message signing & verification
  • Server-side signature verification (security first)
  • Wallet address as unique user identifier for cross-device sync
  • Sepolia testnet support
  • Infura RPC for reliable blockchain access
  • Optional feature - toggle in Settings dialog
  • Dual save strategy:
    • Connected: dungeon_master_save_{wallet_address}
    • Disconnected: dungeon_master_save (local only)

๐ŸŽจ Visual Polish & Effects

  • Enhanced Particle Effects System:
    • Critical hit explosions with shockwave rings
    • Status effect auras (fire, ice, poison, holy)
    • Gold sparkle effects for loot drops
    • Enemy spawn portals
    • Epic quest completion animations
  • Floating damage/heal numbers for instant feedback
  • Screen shake on critical moments
  • Smooth transitions between rooms and biomes
  • Animated UI elements with modern design
  • Dynamic biome theming (11 unique environments)

๐Ÿ† Comprehensive Achievement System

  • 25+ achievements to unlock across multiple categories:
    • Exploration: First room, 10 rooms, 25 rooms, 50 rooms explored
    • Combat: First kill, 10 kills, 25 kills, 50 kills
    • Treasure: First item, collect 10 items
    • Survival: Near-death experience (survive with โ‰ค10 HP)
    • Progression: Reach level 5, reach level 10
    • Economy: Accumulate 500 gold, 1000 gold
    • Class-specific achievements
  • Persistent progress saved in localStorage/wallet
  • Animated pop-ups celebrating your milestones

๐Ÿ—บ๏ธ Mini-Map

  • Real-time dungeon tracking
  • See all rooms you've explored
  • Pulsing indicator for current location
  • Visual representation of your journey

๐Ÿง™ Character Classes

  • Warrior - High HP, melee combat specialist, bonus defense
  • Mage - Powerful spells, ranged attacks, bonus magic damage
  • Rogue - High dodge, critical strike expert (25% crit chance!)
  • Cleric - Healing abilities, balanced stats

Each class has unique stat distributions and playstyles.

๐Ÿ’พ Save/Load System

  • Auto-save after every action
  • Wallet-based saves - Cross-device sync when wallet connected
  • Local fallback - Works without wallet (localStorage)
  • Complete state preservation (inventory, stats, progress, achievements, quests)
  • Dual storage strategy:
    • With wallet: dungeon_master_save_{address}
    • Without wallet: dungeon_master_save

๐Ÿ“ฑ Mobile-First Design

  • Touch-optimized controls
  • Responsive three-panel layout
  • Collapsible panels for small screens
  • Works seamlessly on phones, tablets, and desktop

๐Ÿ› ๏ธ Tech Stack

Core Technologies

  • Next.js 15 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Phaser 3 - 2D game engine (visualization layer)

AI & APIs

  • Google Gemini 2.0 Flash Experimental - Advanced reasoning and narrative generation
  • Gemini API - Real-time AI responses with streaming support
  • ElevenLabs API - Professional-grade text-to-speech with emotive voices

Web3 Stack

  • Ethers.js 6.x - Lightweight Ethereum library
  • SIWE v3.0 - Sign-In With Ethereum authentication
  • MetaMask/Web3 Wallet - Browser wallet integration
  • Sepolia Testnet - EVM-compatible test chain
  • Infura RPC - Reliable blockchain access

State Management

  • React Hooks - useState, useEffect, useCallback
  • localStorage - Client-side persistence
  • Context API - Global game state

UI Components

  • Custom React components - Game panels, inventory, character sheet
  • Lucide Icons - Modern icon library
  • Framer Motion - Smooth animations and transitions
  • Custom particle system - WebGL-based effects

๐ŸŽฎ How to Play

Starting Your Adventure

  1. Visit the landing page at dungeonmaster.elpeef.com
  2. Click "Start Adventure" to begin
  3. Choose your character class
    • Warrior, Mage, Rogue, or Cleric
    • Each class has unique strengths
  4. Enter your name to personalize your hero
  5. Start your journey - The AI generates your first room

Gameplay Loop

  1. Read the narrative (or listen with auto-narration)
  2. Choose your action:
    • EXPLORE - Discover new rooms (costs 3 stamina)
    • SEARCH - Look for treasure (costs 2 stamina)
    • REST - Recover 5 HP and 10 stamina
  3. Experience the outcome:
    • Find treasures with varying rarities
    • Encounter 10 unique enemy types
    • Discover secrets and hidden paths
    • Complete dynamic quests
  4. Combat (when encountered):
    • Attack, Defend, or use Special abilities
    • Watch for critical hits and status effects
    • Tactical decisions matter with resistances/weaknesses
  5. Progress and level up:
    • Gain XP from victories and quest completion
    • Unlock 25+ achievements
    • Find legendary loot with powerful bonuses
    • Complete quests for massive rewards

Game Panels

Left Panel - Character Status

  • Real-time stats (HP, Stamina, XP)
  • Combat bonuses (Damage & Defense)
  • Enemies defeated counter
  • Gold counter
  • Character sheet with full attributes
  • Achievement progress tracker
  • Mini-map of explored rooms

Center Panel - Story & Actions

  • AI-generated narrative with streaming text
  • Action buttons (Explore, Search, Rest)
  • Combat interface with detailed combat log
  • Quest tracker showing active quests
  • Visual feedback and particle effects
  • Status effects display

Right Panel - Inventory

  • All collected items with rarity colors
  • Usable consumables (click to use)
  • Stat bonuses displayed per item
  • Gold balance
  • Total inventory value

๐Ÿ—๏ธ Architecture

File Structure

src/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ page.tsx                 # Landing page with feature showcase
โ”‚   โ”œโ”€โ”€ game/page.tsx            # Main game component
โ”‚   โ”œโ”€โ”€ layout.tsx               # App layout with providers
โ”‚   โ””โ”€โ”€ api/
โ”‚       โ”œโ”€โ”€ gemini/route.ts      # Gemini API proxy endpoint
โ”‚       โ”œโ”€โ”€ elevenlabs/route.ts  # ElevenLabs TTS endpoint
โ”‚       โ”œโ”€โ”€ siwe/route.ts        # SIWE message verification
โ”‚       โ””โ”€โ”€ proxy/route.ts       # System proxy (reserved)
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ CharacterSheet.tsx       # Full character stats display
โ”‚   โ”œโ”€โ”€ GameLog.tsx              # Narrative history
โ”‚   โ”œโ”€โ”€ GameStats.tsx            # Enhanced stats with combat bonuses
โ”‚   โ”œโ”€โ”€ Inventory.tsx            # Basic inventory display
โ”‚   โ”œโ”€โ”€ EnhancedInventory.tsx    # Advanced inventory with rarities
โ”‚   โ”œโ”€โ”€ QuestTracker.tsx         # Active quests display
โ”‚   โ”œโ”€โ”€ StatusEffectsDisplay.tsx # Combat status effects
โ”‚   โ”œโ”€โ”€ MiniMap.tsx              # Dungeon exploration tracker
โ”‚   โ”œโ”€โ”€ ParticleSystem.tsx       # Visual effects engine
โ”‚   โ”œโ”€โ”€ AchievementPopup.tsx     # Achievement notifications
โ”‚   โ”œโ”€โ”€ LandingFooter.tsx        # Landing page footer with credits
โ”‚   โ””โ”€โ”€ ui/                      # shadcn/ui components
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ enemySystem.ts           # 10 enemy types with unique stats
โ”‚   โ”œโ”€โ”€ combatSystem.ts          # Advanced combat with crits & status effects
โ”‚   โ”œโ”€โ”€ questSystem.ts           # Dynamic quest generation & tracking
โ”‚   โ”œโ”€โ”€ itemSystem.ts            # Item generation with rarities
โ”‚   โ”œโ”€โ”€ particleEffects.ts       # Enhanced particle effect generators
โ”‚   โ”œโ”€โ”€ achievementSystem.ts     # Achievement logic & tracking (25+ achievements)
โ”‚   โ”œโ”€โ”€ gameLogic.ts             # Core game mechanics
โ”‚   โ”œโ”€โ”€ constants.ts             # Game constants & configuration
โ”‚   โ”œโ”€โ”€ audioManager.ts          # Procedural sound effects
โ”‚   โ”œโ”€โ”€ voiceManager.ts          # ElevenLabs voice narration system
โ”‚   โ”œโ”€โ”€ gemini.ts                # Gemini API client
โ”‚   โ””โ”€โ”€ saveSystem.ts            # Wallet-aware save/load system
โ”œโ”€โ”€ types/
โ”‚   โ”œโ”€โ”€ game.ts                  # Core game type definitions
โ”‚   โ””โ”€โ”€ achievements.ts          # Achievement system types
โ””โ”€โ”€ hooks/
    โ””โ”€โ”€ useWalletAuth.ts         # SIWE authentication hook

public/
โ””โ”€โ”€ .well-known/
    โ””โ”€โ”€ farcaster.json           # Farcaster mini-app config

Data Flow

  1. Player Action โ†’ React component
  2. State Update โ†’ Game state management
  3. AI Request โ†’ Gemini API via proxy
  4. Response Processing โ†’ Parse JSON, update state, generate quests/enemies/loot
  5. Visual Feedback โ†’ Particles, animations, narration, quest updates
  6. Persistence โ†’ Auto-save to localStorage/wallet

AI Integration

The game uses Gemini's Function Calling API for structured output:

// Function Declaration sent to Gemini:
const GAME_FUNCTIONS = [
  {
    name: 'update_game_state',
    description: 'Updates game state with structured data',
    parameters: {
      type: 'object',
      properties: {
        narrative: { type: 'string' },
        itemsFound: { type: 'array', items: { type: 'string' } },
        healthChange: { type: 'integer' },
        newRoom: { type: 'string' },
        xpGained: { type: 'integer' },
        biome: { 
          type: 'string', 
          enum: ['default', 'dark', 'lava', 'ice', ...] 
        },
        atmosphereDescription: { type: 'string' }
      }
    }
  }
];

// Gemini returns structured function call:
{
  functionCall: {
    name: 'update_game_state',
    args: {
      narrative: "You step into a frozen cavern...",
      healthChange: -5,
      newRoom: "Frost Cavern",
      biome: "ice",
      xpGained: 25
    }
  }
}

Token Efficiency Strategy:

// Context Optimization:
1. Send only essential game state (~200 tokens)
2. Summarize old narrative every 10 turns (saves 70% tokens)
3. Use biome-specific system prompts (reduces repetition)
4. Structured function calls (vs verbose JSON parsing)

// Result: Average 400-600 tokens/turn
// vs. naive implementation: 1000-1500 tokens/turn
// = 60% token savings over gameplay session

Safety Implementation:

// Gemini API Configuration:
generationConfig: {
  temperature: 0.9,        // Creative but controlled
  topK: 40,               // Diverse vocabulary
  topP: 0.95,             // Quality threshold
  maxOutputTokens: 800,   // Concise responses
}

// Safety Settings:
safetySettings: [
  {
    category: 'HARM_CATEGORY_HATE_SPEECH',
    threshold: 'BLOCK_MEDIUM_AND_ABOVE'
  },
  // Maintains fantasy violence while blocking harmful content
]

This approach ensures:

  • โœ… Reliable parsing via function calling
  • โœ… Type-safe integration with TypeScript
  • โœ… Token efficiency through smart context management
  • โœ… Responsible AI with safety guardrails
  • โœ… Predictable outcomes with structured schema

๐Ÿ”‘ Setup & Configuration

Prerequisites

  • Node.js 18+
  • npm/pnpm/yarn
  • Google AI Studio API key
  • ElevenLabs API key (for voice narration)

Environment Variables

Create a .env.local file:

GEMINI_API_KEY=your_gemini_api_key_here
ELEVENLABS_API_KEY=your_elevenlabs_api_key_here

Get Your API Keys

Gemini API Key:

  1. Go to Google AI Studio
  2. Sign in with your Google account
  3. Click "Get API Key"
  4. Copy your key

ElevenLabs API Key:

  1. Go to ElevenLabs
  2. Sign up for an account
  3. Navigate to your profile settings
  4. Copy your API key

Installation

# Clone the repository
git clone https://github.com/mrbrightsides/dungeonmaster.git
cd dungeonmaster

# Install dependencies
npm install

# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

API Endpoints

The app uses custom API routes:

// Gemini Endpoint: POST /api/gemini
// Body: { prompt: string, context: GameState }
// Response: { narrative, encounter, items, etc. }

// ElevenLabs Endpoint: POST /api/elevenlabs
// Body: { text: string }
// Response: Audio blob (MP3)

๐ŸŽฏ Hackathon Highlights

Why This Project Stands Out

  1. Novel Use of Gemini 2.0 Flash Experimental

    • Function Calling Integration: Uses Gemini's native function calling API for structured game state updates
    • Streaming Response: Narrative text streams word-by-word for dramatic storytelling effect
    • Dynamic System Instructions: AI behavior adapts based on current biome/environment
    • Not just a chatbot - fully integrated game engine with real-time AI Dungeon Master
    • Context-aware storytelling with persistent memory across turns
    • Procedural Content Generation: AI creates enemies, quests, and loot on-the-fly
  2. Infinite Replayability

    • Every playthrough is unique
    • AI adapts to player choices
    • Emergent storytelling
    • 10 unique enemy types with strategic combat
    • Dynamic quest generation
  3. Technical Excellence

    • Type-safe TypeScript throughout
    • Optimized for mobile and desktop
    • Production-ready architecture
    • Visual polish with enhanced particle effects
    • Complex Systems Integration: Enemy spawning, combat, quests, loot all work together seamlessly
    • 60% token efficiency through intelligent context management
  4. User Experience

    • Professional voice narration for accessibility
    • 25+ achievements for engagement
    • Quest system provides clear goals
    • Intuitive three-panel layout
    • Immediate visual feedback with particles and status effects
    • Beautiful landing page showcasing all features
  5. Technical Innovation

    • Advanced Combat System: Critical hits, status effects, damage types, resistances
    • Quest System: 5 quest types with 4 difficulty tiers
    • Loot System: 5 rarity tiers with meaningful stat bonuses
    • Enemy AI: 10 unique enemy types with biome-specific spawning
    • Biome System: 11 dynamic environments with unique mechanics
    • Ambient Soundscapes: Procedural audio generation per biome
    • Real-time Streaming: SSE-based narrative delivery
    • Web3 Integration: Optional SIWE authentication for cross-device sync
  6. Potential for Growth

    • Ready for multiplayer (SpacetimeDB integration planned)
    • Social sharing capabilities
    • Leaderboard potential
    • Voice input ready
    • NFT minting potential for legendary achievements

๐Ÿš€ Future Enhancements

Planned Features

  • Voice Input - Speak your commands
  • Multiplayer Co-op - Real-time party system with SpacetimeDB
  • Global Leaderboard - Compete with other players
  • Social Sharing - Post achievements to Farcaster/Twitter
  • AI-Generated Visuals - Unique item art and room illustrations
  • Advanced Quest Chains - Multi-step story arcs
  • Guild System - Player communities
  • Boss Battles - Epic multi-phase encounters
  • Crafting System - Combine items for powerful gear
  • Pet/Companion System - AI-controlled allies

๐Ÿ”ฎ Multimodal Potential (Future Vision)

Gemini's Vision Capabilities + Game State:

  • Spatial Awareness: Gemini could "see" the 2D dungeon layout and describe enemy positions based on actual grid coordinates
    • Example: "The goblin stands at position (12, 8), blocking the eastern corridor while the archer lurks behind at (14, 9)"
    • Real-time tactical narration based on visual game state
  • Dynamic Scene Description: AI generates contextual narrative based on what's visually happening in the game canvas
    • Player's exact position relative to enemies, treasures, and environmental hazards
    • Adaptive storytelling that references actual visual elements
  • Image-to-Narrative: Future feature where players could upload hand-drawn maps or inspiration images
    • Gemini converts sketches into playable dungeon rooms
    • "Turn your doodles into adventures" - democratizing game design
    • Example: Draw a circular arena โ†’ Gemini generates "The Colosseum of Shadows" with matching layout

๐Ÿ“Š Game Statistics

Current Implementation Stats

  • Lines of Code: ~5,000+
  • Components: 20+
  • Game States: 15+
  • Achievements: 25+
  • Item Types: Infinite (AI-generated with 5 rarity tiers)
  • Enemy Types: 10 unique enemies
  • Quest Types: 5 with 4 difficulty tiers
  • Biomes: 11 dynamic environments
  • Status Effects: 6 combat effects
  • Damage Types: 4 elemental types
  • Possible Playthroughs: Infinite โ™พ๏ธ

๐ŸŽจ Design Philosophy

Core Principles

  1. AI-First Design

    • Let Gemini handle creativity and variation
    • Focus on structure and reliable integration
    • Player agency drives the story
  2. Mobile-First, Always

    • Touch-optimized from day one
    • Responsive three-panel system
    • Works on any device
  3. Immediate Feedback

    • Every action has visual response
    • Particles, animations, sounds
    • Players feel their impact
  4. Respect Player Time

    • Auto-save constantly
    • Clear quest objectives
    • No forced grinding
    • Skip narration option
    • Quick gameplay loop
  5. Infinite Replayability

    • No two games are the same
    • AI adapts to playstyle
    • Multiple victory paths
    • Procedural content generation
  6. Strategic Depth

    • Combat requires tactical thinking
    • Status effects add complexity
    • Resistances and weaknesses matter
    • Class choice impacts playstyle

๐Ÿ› Known Issues & Limitations

Current Limitations

  • AI Response Time: Depends on Gemini API latency (typically 1-3 seconds)
  • Offline Play: Requires internet connection for AI
  • Browser Support: Best on Chrome/Edge (Web Speech API)

Troubleshooting

Game won't load?

  • Check browser console for errors
  • Verify Gemini API key is set
  • Try clearing localStorage

Voice narration not working?

  • Check your internet connection (ElevenLabs requires API access)
  • Ensure volume is up
  • Toggle voice narration off and on in settings
  • Try refreshing the page
  • Voice errors are non-critical - the game continues with text narrative

Combat feels unbalanced?

  • AI difficulty adapts over time
  • Try different character classes
  • Use defensive strategies
  • Watch for enemy resistances/weaknesses

Quests not tracking?

  • Quests auto-save with game progress
  • Check the quest tracker panel
  • Some quests require specific biomes or enemy types

โœ… Production Readiness Checklist

Pre-Publish Verification

Code Quality:

  • โœ… TypeScript strict mode enabled
  • โœ… All types explicitly defined
  • โœ… Zero build errors
  • โœ… No console errors in browser
  • โœ… Clean, maintainable code structure

Functionality:

  • โœ… All game mechanics working (explore, search, rest, combat)
  • โœ… Enemy system spawning correctly
  • โœ… Quest system generating and tracking quests
  • โœ… Loot system with proper rarities
  • โœ… Combat system with crits and status effects
  • โœ… Save/load system functional
  • โœ… Achievement system triggering correctly
  • โœ… Particle effects rendering
  • โœ… Voice narration playing (when enabled)
  • โœ… Biome transitions smooth
  • โœ… Mini-map tracking accurate
  • โœ… Enhanced inventory displaying items correctly

API Integration:

  • โœ… Gemini API responding correctly
  • โœ… Streaming response working
  • โœ… Function calling structured properly
  • โœ… ElevenLabs TTS generating audio
  • โœ… Comprehensive error handling with graceful degradation
  • โœ… Automatic retry functionality for failed requests
  • โœ… Timeout protection (15 seconds) prevents hanging
  • โœ… Voice errors don't break gameplay

Performance:

  • โœ… Initial load time under 3 seconds
  • โœ… AI response time 1-3 seconds
  • โœ… Smooth animations (60fps target)
  • โœ… No memory leaks in long sessions
  • โœ… Bundle size optimized (899 KB main game route)

Mobile Experience:

  • โœ… Touch controls responsive
  • โœ… Layout adapts to small screens
  • โœ… Text readable on mobile
  • โœ… No horizontal scroll
  • โœ… Voice works on mobile browsers

Content & Safety:

  • โœ… Safety settings configured
  • โœ… Age-appropriate content
  • โœ… No harmful outputs from AI
  • โœ… Privacy considerations (no PII stored)

Documentation:

  • โœ… README comprehensive
  • โœ… API setup instructions clear
  • โœ… Troubleshooting guide included
  • โœ… Hackathon highlights documented

Deployment:

  • โœ… Live at dungeonmaster.elpeef.com
  • โœ… Landing page showcasing all features
  • โœ… GitHub repository clean
  • โœ… Zero build warnings

๐Ÿ† Hackathon Submission Tips

Judging Criteria Alignment

Innovation (How this project scores high):

  • โœ… Novel use of Gemini's Function Calling API
  • โœ… Streaming narrative for dramatic effect
  • โœ… Dynamic biome system with AI adaptation
  • โœ… Token-efficient context management (60% savings)
  • โœ… Advanced systems integration: Combat, quests, loot, enemies all AI-driven
  • โœ… Procedural content generation: Infinite unique experiences

Technical Implementation (Production-ready):

  • โœ… Type-safe TypeScript architecture
  • โœ… Proper error handling throughout
  • โœ… Scalable component structure
  • โœ… Performance optimizations applied
  • โœ… Complex systems working together seamlessly

User Experience (Polished & Engaging):

  • โœ… Professional voice narration
  • โœ… Enhanced particle effects and visual feedback
  • โœ… 25+ achievements for engagement
  • โœ… Quest system provides clear goals
  • โœ… Mobile-first responsive design
  • โœ… Beautiful landing page showcasing features

Impact & Usefulness (Real-world potential):

  • โœ… Infinite replayability = high retention
  • โœ… Accessibility via voice narration
  • โœ… Educational (creative writing, decision-making, tactical thinking)
  • โœ… Entertainment value proven
  • โœ… Web3 integration for future growth

Code Quality (Clean & Maintainable):

  • โœ… Consistent naming conventions
  • โœ… Modular component structure
  • โœ… Clear separation of concerns
  • โœ… Well-documented functions
  • โœ… 5,000+ lines of production-ready code

Presentation Recommendations

What to Emphasize:

  1. "This isn't a chatbot - it's a fully integrated game engine"
    • Show how Gemini drives gameplay, not just dialogue
  2. "Watch the narrative stream word-by-word"
    • Demonstrate the dramatic storytelling effect
  3. "10 unique enemies with strategic combat"
    • Show critical hits, status effects, and tactical combat
  4. "Dynamic quest system with meaningful rewards"
    • Complete a quest live to show progression
  5. "5 rarity tiers for endless loot excitement"
    • Find a legendary item and show its stats
  6. "60% token efficiency through smart context management"
    • Explain technical optimization

Demo Flow:

  • Start with landing page showcasing features
  • Click "Start Adventure"
  • Character creation
  • Show 2-3 room explorations with different biomes
  • Trigger combat to show critical hits and status effects
  • Complete a quest live
  • Find rare/legendary loot
  • Unlock an achievement
  • Switch voice narration on/off
  • Explain token efficiency

๐Ÿ™ Acknowledgments

Built with:

  • Google Gemini 2.0 Flash Experimental - The AI brain
  • ElevenLabs - Professional voice narration
  • Phaser 3 - Game engine foundation
  • Next.js Team - Amazing React framework
  • Vercel - Deployment platform
  • Tailwind CSS - Styling made easy

Special thanks to the Google DeepMind team for creating Gemini and hosting this hackathon!


๐Ÿ“ž Contact & Support

For bug reports, feature requests, or questions, please reach out via any of the channels above!


๐Ÿ“œ License

This project is built for the Google DeepMind Gemini 3 Global Hackathon 2026.

Feel free to explore, learn from, and build upon this code. If you use this project as inspiration, attribution is appreciated!


๐Ÿ‘จโ€๐Ÿ’ป Developer

Built with ๐Ÿ”ฅ by @mrbrightsides - an AI enthusiast exploring the boundaries of generative AI in gaming.

Tech Stack Mastery: Next.js, TypeScript, React, Phaser, Gemini AI, ElevenLabs, Web3

Focus: Infinite replayability, emergent storytelling, player-driven narratives, strategic gameplay


๐ŸŽฎ Play Now!

Ready to start your infinite adventure? Let the AI be your Dungeon Master!

๐ŸŒ Play at dungeonmaster.elpeef.com

Or run locally:

git clone https://github.com/mrbrightsides/dungeonmaster.git
cd dungeonmaster
npm install
npm run dev

Then open http://localhost:3000 in your browser.

May your rolls be high and your loot be legendary! ๐ŸŽฒโœจ


Last Updated: January 2026 Version: 4.0 - "Strategic Combat & Quest Edition"

๐Ÿ†• Latest Enhancements (v4.0):

Combat & Enemies

  • โœจ 10 Unique Enemy Types with distinct stats and behaviors
  • โš”๏ธ Advanced Combat System with critical hits and status effects
  • ๐Ÿ”ฅ 6 Status Effects: Burning, Frozen, Poison, Stunned, Blessed, Cursed
  • ๐Ÿ’ฅ 4 Damage Types with resistance/weakness system
  • ๐Ÿ“Š Detailed Combat Log with damage breakdown

Quests & Progression

  • ๐ŸŽฏ Dynamic Quest System with 5 quest types
  • ๐Ÿ† 4 Difficulty Tiers: Easy, Medium, Hard, Legendary
  • ๐Ÿ“ˆ Quest Progress Tracking with visual indicators
  • ๐Ÿ’ฐ Meaningful Rewards: XP, Gold, and Rare Items

Loot & Items

  • ๐ŸŽ’ 5 Rarity Tiers from Common to Legendary
  • โœจ Rarity-Based Visual Effects with glowing borders
  • ๐Ÿงช Usable Consumables (health potions, buffs)
  • ๐Ÿ’Ž Gold Economy with inventory value tracking
  • ๐Ÿ“ฆ Item Stacking for consumables

Visual & UI

  • ๐ŸŽจ Enhanced Particle Effects (critical hits, status auras, loot sparkles)
  • ๐Ÿ“Š Quest Tracker Component with progress bars
  • ๐Ÿ›ก๏ธ Status Effects Display showing active buffs/debuffs
  • ๐Ÿ“ˆ Upgraded Game Stats with combat bonuses
  • ๐Ÿ  Professional Landing Page showcasing all features
  • ๐Ÿ‘ฃ Footer Credits linking to developer profiles

Previous v3.0 Features

  • ๐ŸŽ™๏ธ ElevenLabs Voice Integration - Professional DM narration
  • ๐Ÿ”— Web3 SIWE Integration - Optional wallet-based cross-device sync
  • ๐ŸŒ 11 Dynamic biomes with unique mechanics
  • ๐Ÿ”Š Procedural ambient soundscapes per environment
  • ๐ŸŽฏ Gemini Function Calling API integration
  • ๐Ÿ“Š 60% token efficiency improvement
  • ๐Ÿ›ก๏ธ Safety & alignment guardrails implemented

๐ŸŽฎ Ready for Hackathon Judging! All systems integrated, polished, and production-ready.

About

Experience the next evolution of roleplaying. Every monster, every plot twist, and every cinematic description is generated in real-time by the power of Gemini 3.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors