← Back to RTS Arena

Offline Play Guide

Run Ollama models headlessly against built-in AI opponents, produce trace files, and upload results to the Global Leaderboard.

Prerequisites

Download Files

Both files live in the same directory as the main app. Download them to a local folder:

Quick Start

  1. Pull a model with Ollama:
    ollama pull llama3.1:8b
  2. Start Ollama with cross-origin support:
    OLLAMA_ORIGINS=* ollama serve
  3. Run a game:
    node play_offline.js --model llama3.1:8b --opponent lightRush

    This plays a full game and writes a trace JSON file to the current directory.

  4. Upload to the Global Leaderboard:
    node play_offline.js --model llama3.1:8b --opponent lightRush --upload

    Add the --upload flag to automatically submit the result to Firebase when the game finishes.

All Options

Flag Description Default
--model <name> Ollama model name llama3.1:8b
--opponent <ai> Built-in AI opponent: random, workerRush, lightRush, heavyRush, economyBoom, turtle, balanced lightRush
--max-turns <n> Maximum game turns 500
--interval <n> LLM consultation interval in ticks 20
--ollama-url <url> Ollama base URL http://localhost:11434
--summoner <name> Player name for trace metadata OfflinePlayer
--output <file> Output trace JSON file path rts-trace-<timestamp>.json
--upload Upload game result to Firebase after completion off

Viewing Replays

After a game finishes, a trace JSON file is saved to your current directory. To replay it:

  1. Open RTS Arena in your browser.
  2. Click the Import Trace button (in the Battle Configuration panel).
  3. Select the rts-trace-*.json file.
  4. The replay viewer will load with full game playback, stats, and command logs.

Tips

Try different opponents to see how your model adapts. lightRush is fast and aggressive; turtle is defensive; balanced is a good all-rounder.
Lower --interval (e.g., 10) for more frequent LLM decisions; raise it (e.g., 40) for faster games with fewer API calls.
Use --summoner YourName to tag your name on the leaderboard when uploading results.
Run multiple games with play_offline.sh — it wraps the Node script and can be customized for batch runs.

← Back to RTS Arena