Skip to content

Akanksha-Mcode/AI_GAMES

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Arena - LLM Games Platform

A platform featuring AI-powered games where Large Language Models compete against each other in real-time.

Games

1. Agent Battle Royale

4 LLM agents fight to the death on a 32x32 pixel grid with real-time visualization.

2. AI Chess 2v2

Teams of 2 AI agents collaborate and play chess against each other, with real Stockfish analysis and live commentary.


Features

  • Free LLM APIs - Uses Gemini, Groq, Cohere, and Mistral (no paid APIs required)
  • Real Stockfish Integration - Actual chess engine analysis (depth 10-12)
  • Team Collaboration - AI teammates discuss strategy before each move
  • Live Commentary - AI-generated play-by-play commentary
  • Real-time Updates - Server-Sent Events (SSE) for instant UI updates
  • Canvas Rendering - Pixel-art visualization for Battle Royale

AI Agents

Agent Model Provider Free Tier
Gemini gemini-2.0-flash Google
Groq llama-3.3-70b-versatile Groq
Cohere command-a-03-2025 Cohere
Mistral mistral-small-latest Mistral

Setup

1. Install Dependencies

npm install

2. Create .env File

# Required - Get free API keys from each provider
GEMINI_API_KEY=your_gemini_key
GROQ_API_KEY=your_groq_key  
COHERE_API_KEY=your_cohere_key
MISTRAL_API_KEY=your_mistral_key

# Optional - For TTS commentary
ELEVENLABS_API_KEY=your_elevenlabs_key

3. Get Free API Keys


Run

npm start

Open http://localhost:3000


Game Details

Battle Royale

  • 32x32 grid arena with shrinking zone
  • Agents choose archetypes: Berserker, Tank, Scout, Mage
  • Each agent gets a random charm ability
  • LLM-driven decisions every turn (move, attack, defend, use charm)
  • Fastest LLM response acts first
  • Items spawn every 3 turns, zone shrinks every 8
  • Last agent standing wins

AI Chess 2v2

  • Team White: Mistral & Cohere
  • Team Black: Groq & Gemini
  • Teams discuss strategy for 2 rounds before each move
  • One teammate decides the final move (rotates each turn)
  • Real Stockfish 18 analysis shows:
    • Position evaluation (centipawns)
    • Best move recommendation
    • Principal variation (next 5 moves)
    • Move quality assessment
  • Live AI commentary after each move
  • Full move history and chat logs

Tech Stack

  • Backend: Node.js + Express
  • Frontend: Vanilla JS + HTML Canvas
  • Real-time: Server-Sent Events (SSE)
  • Chess Engine: Stockfish 18 (via stockfish npm package)
  • Chess Logic: chess.js
  • LLM SDKs: @google/generative-ai, groq-sdk, cohere-ai, @mistralai/mistralai

Project Structure

├── server.js           # Express server with API routes
├── game/
│   ├── engine.js       # Battle Royale game loop
│   ├── chess-engine.js # Chess 2v2 game logic
│   ├── stockfish.js    # Real Stockfish integration
│   ├── combat.js       # Battle mechanics
│   ├── grid.js         # Arena management
│   └── archetypes.js   # Agent classes
├── llm/
│   ├── provider.js     # LLM orchestration
│   ├── gemini.js       # Google Gemini
│   ├── groq.js         # Groq (Llama)
│   ├── cohere.js       # Cohere
│   ├── mistral.js      # Mistral AI
│   ├── prompt.js       # Battle Royale prompts
│   └── chess-prompt.js # Chess prompts
└── public/
    ├── home.html       # Game selection
    ├── index.html      # Battle Royale UI
    ├── chess.html      # Chess UI
    ├── app.js          # Battle Royale client
    └── chess-app.js    # Chess client

API Endpoints

Battle Royale

  • GET / - Home page
  • GET /battle - Battle Royale game
  • POST /api/start - Start battle
  • GET /api/events - SSE stream

Chess

  • GET /chess - Chess game page
  • POST /api/chess/start - Start chess game
  • POST /api/chess/stop - Stop game
  • GET /api/chess/state - Get game state
  • GET /api/chess/events - SSE stream

Screenshots

Home Page

Choose between Battle Royale and Chess 2v2

Battle Royale

4 AI agents fighting on a pixel grid with real-time combat

AI Chess

Teams collaborating with Stockfish analysis panel


License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors