AI-powered monster battle game built for DigitalOcean Hacktoberfest 2025.
Prompt Battle Arena is a turn-based monster combat game where every opponent is unique. Unlike traditional games with hardcoded AI, this game uses DigitalOcean Gradient AI Platform to generate dynamic opponent personalities, tactical decisions, and contextual battle narration in real-time.
- AI-Generated Opponents: Each battle features a unique opponent personality (Aggressive, Cautious, or Adaptive)
- Dynamic Narration: AI generates contextual battle descriptions based on game state
- Strategic Combat: Rock-paper-scissors style ability system with cooldowns
- Best of 3 Rounds: Intense battles with multiple rounds
- 3 Monster Types: Choose from Striker, Tank, or Speedster
- Personality Generation: AI determines opponent behavior patterns at battle start
- Contextual Decisions: AI analyzes HP, last moves, and battle momentum to choose abilities
- Dynamic Narration: Every turn generates unique flavor text explaining the opponent's actions
- Adaptive Strategy: AI personalities respond differently to your playstyle
- AGGRESSIVE (40%): Favors high-damage attacks, rarely defends
- CAUTIOUS (30%): Balances offense and defense, uses shields strategically
- ADAPTIVE (30%): Mirrors and counters your tactics
- DigitalOcean Gradient AI Platform (Agents) - AI opponent generation
- Phaser 3 - Game engine and rendering
- Vite - Fast development server
- Vanilla JavaScript - Game logic
- Node.js 18+ and npm
# Clone the repository
git clone https://github.com/yourusername/prompt-battle-arena.git
cd prompt-battle-arena
# Install dependencies
npm install
# Start development server
npm run devThe game will be available at http://localhost:5173
npm run build
npm run preview- Choose Your Monster on the main menu
- Battle begins with AI-generated opponent introduction
- Click ability buttons to attack or defend
- Watch AI narration to see how opponent responds
- First to 2 round wins claims victory!
- HP: 100
- Flame Rush: 25 damage (1 turn cooldown)
- Inferno Blast: 40 damage (2 turn cooldown)
- HP: 120
- Stone Shield: Block 30 damage (1 turn cooldown)
- Earthquake: 30 damage (2 turn cooldown)
- HP: 80
- Thunder Dash: 20 damage (no cooldown)
- Shock Wave: 35 damage + stun (3 turn cooldown)
/prompt-battle-arena
/src
main.js # Phaser game initialization
BattleScene.js # Core battle logic and UI
MenuScene.js # Start screen and monster selection
AIOpponent.js # AI integration and decision making
MonsterData.js # Monster configurations and abilities
index.html # Entry point
package.json # Dependencies
README.md # This file
The game currently uses a sophisticated rule-based AI with personality-driven decisions as a fallback. This demonstrates the game mechanics while the Gradient AI API is being integrated.
The AIOpponent.js file is already set up for Gradient AI integration. To enable:
- Set
this.useFallback = falseinAIOpponent.js - Configure your Gradient AI endpoint
- The AI will receive battle context and return:
- Chosen ability
- Contextual narration
- Tactical reasoning
Example AI Input:
{
opponentMonster: "STRIKER",
opponentPersonality: "AGGRESSIVE",
opponentHP: 75,
playerMonster: "TANK",
playerHP: 100,
playerLastMove: "Stone Shield",
turnNumber: 3,
availableAbilities: [...]
}Example AI Output:
{
ability: "Flame Rush",
narration: "Blaze charges forward recklessly, trying to break through your defenses!",
reasoning: "continuing aggressive pressure"
}- Prompt-Based Combat: Players type strategic prompts instead of clicking buttons
- Prompt Scoring: AI scores creativity, tactics, and effectiveness
- Environmental System: Interactive arena objects
- Monster Collection: Unlock new monsters by winning battles
- Progressive Difficulty: Escalating challenges across rounds
MIT License - see LICENSE file for details
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
This project was built for DigitalOcean Hacktoberfest 2025 to demonstrate:
- Production-ready AI integration
- Gradient AI Platform capabilities
- Scalable game AI architecture
- Open-source game development patterns
- Built with DigitalOcean Gradient AI Platform
- Powered by Phaser 3 game engine
- Inspired by classic turn-based battle games
For questions or feedback, please open an issue on GitHub.
Play now and experience AI-powered gaming! Every battle is unique. ๐ฎโจ