Introduction
Hyperscape integrates ElizaOS to enable AI agents that play the game autonomously. Unlike scripted NPCs, these agents use LLMs to make decisions, set goals, and interact with the world just like human players.ElizaOS 1.7.0: Hyperscape is compatible with ElizaOS 1.7.0+ with backwards-compatible shims for cross-version support. AI agents connect via the same WebSocket protocol as human players and have full access to all game mechanics.
Plugin Architecture
The@hyperscape/plugin-hyperscape package provides:
Plugin Registration
LLM Autonomy System
As of PR #628, agents use a THINKING+ACTION format that separates reasoning from action selection, making agent behavior transparent and debuggable.
THINKING+ACTION Format
Agents respond with structured reasoning before taking actions:- Clear separation of reasoning and decision
- Debuggable agent behavior (see why it chose an action)
- Better parsing and error handling
- Foundation for multi-step reasoning
Target Locking
Agents lock onto combat targets for 30 seconds to prevent target switching:- Agent attacks one target until it dies
- Lock clears when target dies, despawns, or 30s timeout
- Dramatically improves combat effectiveness
Force Flee Mechanism
Pre-emptive survival check runs BEFORE LLM selection:Combat Readiness Scoring
NewgetCombatReadiness() function evaluates combat preparedness:
- Health level (deduct up to 30 points for low health)
- Weapon equipped (deduct 25 points if no weapon)
- Food available (deduct 20 points if no food)
Available Actions
The plugin provides 23 actions across 9 categories:Goal-Oriented Actions
Autonomous Behavior
Movement Actions
Combat Actions
Skill Actions
Inventory Actions
Social Actions
Banking Actions
State Providers
Providers supply game context to the agent’s decision-making. As of PR #628, three new providers enhance LLM decision-making:New Providers (PR #628)
possibilitiesProvider
Tells the LLM what actions are currently possible:goalTemplatesProvider
Provides structured goal templates for OSRS beginner flows:woodcutting,mining,fishing- Gathering skillssmithing,firemaking,cooking- Artisan skillscombat- Combat trainingexploration- Discover new areasstarter_items- Acquire basic tools
guardrailsProvider
Provides safety constraints and warnings:Core Providers
goalProvider
Provides current goal and progress tracking.gameStateProvider
inventoryProvider
nearbyEntitiesProvider
skillsProvider
equipmentProvider
availableActionsProvider
Evaluators
Evaluators assess game state for autonomous decision-making:Configuration
Environment Variables
ElizaOS 1.7.0: Added support for Ollama plugin (
@elizaos/plugin-ollama) for local LLM inference.Running AI Agents
- Game server on port 5555
- Client on port 3333
- ElizaOS runtime on port 4001
- ElizaOS dashboard on port 4000
Agent Dashboard
Access the agent dashboard athttp://localhost:4000 to:
- View agent status and goals
- Monitor skill progression and XP gains
- See current position and nearby locations
- Control agent behavior (stop/resume goals)
- Send messages and quick commands
- Configure API keys and settings
- Summary Card: Online status, combat level, total level, current goal
- Goal Panel: Current objective, progress, time estimates, stop/resume controls
- Skills Panel: All skill levels with XP progress bars and session gains
- Activity Panel: Recent actions, kills, deaths, gold earned
- Position Panel: Current zone, nearby POIs, coordinates
- Quick Action Menu: One-click commands (woodcutting, mining, fishing, combat, pickup, bank, stop, idle)
ElizaOS 1.7 Compatibility
Hyperscape now uses ElizaOS 1.7.0 with backwards-compatible shims for API changes: Key Changes:max_tokens→maxTokens(with fallback for older versions)- Updated dependencies:
@elizaos/core,@elizaos/plugin-sql,@elizaos/server - Added
@elizaos/plugin-ollamasupport for local LLM inference
Agent Dashboard
The agent dashboard provides real-time monitoring and control of AI agents.Dashboard Features
Agent Summary Card:- Online/offline status with uptime
- Combat level and total level
- Current goal with progress bar
- Session statistics
- Current goal description and progress
- Estimated time to completion
- XP rate tracking
- Lock/unlock goal controls
- Stop button - Immediately halts agent and sets to idle
- Resume Auto - Resumes autonomous goal selection
- Recent goals history
- All skill levels with XP progress bars
- Session XP gains tracking
- Live updates when viewport is active
- Recent actions feed (combat, skills, items, goals)
- Session stats (kills, deaths, gold earned, resources gathered)
- Live activity tracking
- Current zone name (Central Haven, Eastern Forest, etc.)
- Coordinates (X, Y, Z)
- Nearby points of interest with distances
- Live position tracking
- One-click commands for common tasks
- Nearby locations (banks, furnaces, trees, fishing spots)
- Quick commands (woodcutting, mining, fishing, combat, pickup, stop, idle)
- Available goals
- Inventory actions (equip, use, drop)
Stop/Resume Goal Control
The dashboard includes robust stop/resume functionality: Stop Goal:- Immediately cancels current movement path
- Sets agent to idle mode
- Blocks autonomous goal selection
- Shows “Goals Paused” state in UI
- Chat commands still work (user can send manual commands)
- Re-enables autonomous goal selection
- Agent resumes normal behavior
- Clears paused state
POST /api/agents/:agentId/goal/stop- Stops goal and sets paused statePOST /api/agents/:agentId/goal/resume- Resumes autonomous behaviorgoalsPausedflag tracked server-side and synced to plugin- Pause state persists across reconnections
Dashboard API Endpoints
Rate Limiting
Dashboard components use polling with retry logic to avoid rate limiting: Polling Intervals:- Agent Summary: 10 seconds
- Goal Panel: 10 seconds
- Skills Panel: 10 seconds
- Activity Panel: 10 seconds
- Position Panel: 5-10 seconds (faster when viewport active)
Spectator Mode
Watch AI agents play in real-time:- Start with
bun run dev:ai - Open
http://localhost:3333 - Click the Dashboard icon
- Select an agent to spectate
- Observe decision-making in the viewport and activity feed
Agent Architecture Flow
Decision-Making Pipeline
- Providers - Gather game context (10 providers)
- Compose State - Merge provider data into unified state
- Evaluators - Assess situation (5 evaluators)
- LLM Decision - Generate THINKING+ACTION response
- Parse - Extract reasoning and action name
- Validate - Check if action is possible
- Execute - Perform action via HyperscapeService
- Update - Server sends state changes back
Event Handlers
Game events are stored as memories for agent learning:Detailed Documentation
Actions Reference
Complete reference for all 22 agent actions including movement, combat, skills, inventory, and goals.
Providers Reference
All 7 context providers that supply game state to the LLM for decision-making.