A text-based RPG adventure set in the Warcraft universe, powered by AI.
- Interactive Storytelling: Experience epic adventures across different Warcraft expansions
- AI-Powered Game Master: Choose between OpenAI and Google Gemini for dynamic storytelling
- Character Customization: Play as iconic Warcraft characters or create your own
- Rich Audio Experience: Text-to-speech narration and background music
- Responsive Design: Beautiful UI with Warcraft-inspired aesthetics
- Persistent Game State: Your progress is automatically saved to localStorage
- Cost Control: Configurable token limits and context detail levels
- Framework: Next.js 15 with React 19
- Styling: Tailwind CSS with custom animations
- State Management: Zustand with persistence
- AI Integration: OpenAI GPT and Google Gemini APIs
- Audio: Web Speech API for TTS, HTML5 Audio for music
- Form Handling: React Hook Form with Zod validation
- UI Components: Custom Radix UI components
- Deployment: Vercel
- Node.js 18+
- npm or yarn
- API keys for OpenAI and/or Google Gemini (can be added via UI)
- Clone the repository:
git clone <repository-url>
cd azeroth-chronicles- Install dependencies:
npm install- Copy environment variables (optional):
cp .env.example .env.local- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
You can add your API keys in two ways:
- Via UI (Recommended): Use the in-game settings to add your OpenAI or Gemini API keys
- Via Environment: Add keys to
.env.localfile
-
Connect to Vercel:
- Go to vercel.com
- Import your GitHub repository
- Vercel will automatically detect Next.js settings
-
Configure Environment Variables (Optional):
- In Vercel dashboard, go to Project Settings → Environment Variables
- Add any default API keys or configuration
-
Deploy:
- Push to your main branch
- Vercel will automatically build and deploy
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# For production deployment
vercel --prod- Start the Game: The game automatically initializes when you first visit the page
- Enter Actions: Type your desired action in natural language in the input field
- Examples of Actions:
- "Look around the area"
- "Talk to the nearby merchant"
- "Head north towards the forest"
- "Attack the orc with my sword"
- "Use a health potion"
- Character Management: Your character sheet shows your current health, inventory, and location
- Game Persistence: Your progress is automatically saved and will be restored when you return
- Health Points: Monitor your character's health with a visual health bar
- Inventory Management: Items are automatically added/removed based on your actions
- Location Tracking: See where you are in the world
- Class & Level: Your character progresses through the adventure
- Dynamic Responses: The AI responds to your actions with rich, contextual narrative
- World Consistency: Maintains knowledge of your character state and previous actions
- Lore-Accurate: Stays true to Warcraft universe lore and The Third War setting
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linting
npm run lintsrc/
├── app/ # Next.js app router
│ ├── api/ # API routes
│ ├── globals.css # Global styles
│ └── page.tsx # Main game page
├── components/ # React components
│ ├── ui/ # Radix UI components
│ ├── ScenarioSelection.tsx
│ ├── CharacterSelection.tsx
│ ├── CharacterSheet.tsx
│ ├── SettingsModal.tsx
│ ├── OnboardingModal.tsx
│ ├── BackgroundMusic.tsx
│ └── TokenUsageDisplay.tsx
├── hooks/ # Custom React hooks
│ ├── useBackgroundMusic.ts
│ ├── useTooltipOnHover.ts
│ └── useOnboarding.ts
├── lib/ # Utilities and LLM providers
│ ├── llm-providers/ # AI provider implementations
│ ├── tokenEstimator.ts
│ └── utils.ts
└── stores/ # Zustand state stores
├── useGameStore.ts
└── useSettingsStore.ts
The game supports multiple AI providers:
- OpenAI: GPT-4, GPT-4 Turbo, GPT-3.5 models
- Google Gemini: Gemini Pro, Gemini Flash models
- Text-to-Speech: Configurable voice and speed
- Background Music: Volume control and enable/disable
- Typewriter Effect: Adjustable typing speed
- Context Detail: Minimal, Standard, or Rich descriptions
- History Length: How much game history to include in AI context
- Max Tokens: Control response length and cost
This implementation places the API key in the frontend code for development purposes. This is acceptable for a private, personal project but should not be used for public websites. For production use, implement a backend API to handle LLM requests securely.
- "API key not found" error: Make sure your
.env.localfile contains the correct API key - Game state not loading: Clear your browser's localStorage for the site
- Build errors: Run
npm run buildto check for TypeScript/ESLint issues
The Google Gemini API has rate limits. If you encounter rate limit errors, wait a moment before taking your next action.
This is a hobby project, but feel free to fork and modify it for your own use!
This project is for educational and personal use. Warcraft is a trademark of Blizzard Entertainment.