Overview
The Factorio integration enables AIRI to interact with Factorio servers through the RCON (Remote Console) protocol. This allows for game automation, monitoring, and AI-driven factory management.Features
- RCON API Integration: Execute Lua commands remotely
- Game State Monitoring: Track resources, production, and entities
- Factory Automation: AI-driven base building and optimization
- Vision Model Integration: Computer vision for factory analysis
- Event-Driven Architecture: React to game events in real-time
- Plugin System: Extend with custom automation scripts
Architecture
The Factorio integration uses a modular architecture:Prerequisites
- Factorio server (headless or GUI)
- RCON enabled on Factorio server
- Python 3.8+ (for vision pipeline)
- Node.js 18+ (for AIRI integration)
- AIRI server runtime
Setup
1. Enable RCON on Factorio Server
Edit your Factorio server settings (server-settings.json):
2. Configure AIRI Module
In your AIRI configuration (Stage UI or config file):packages/stage-ui/src/stores/modules/gaming-factorio.ts:1:
3. Clone airi-factorio Project
4. Install Dependencies
5. Configure Environment
.env:
6. Start the Integration
Usage
Basic Commands
Send commands to AIRI through any connected interface (Discord, Telegram, etc.):RCON API
Execute raw Lua commands:Vision Analysis
The vision pipeline can analyze factory screenshots:Automation Examples
Auto-Research
Resource Monitor
Factory Builder
Plugin Development
Create custom automation plugins:Vision Model Training
The integration supports custom YOLO models trained on Factorio:Dataset Structure
Training
Deployment
.env:
Configuration Reference
Module Settings
RCON Commands
Common Lua commands:Troubleshooting
RCON connection refused
- Verify RCON is enabled in
server-settings.json - Check firewall allows port 27015
- Confirm password is correct
- Restart Factorio server
Vision model not detecting
- Ensure model is trained on Factorio data
- Check confidence threshold (try lowering)
- Verify screenshot quality and resolution
- Update to latest model weights
Commands not executing
- Check Lua syntax in RCON commands
- Verify player permissions
- Review Factorio logs for errors
- Test commands in Factorio console first
Performance Considerations
- Polling Interval: Balance between responsiveness and server load (recommended: 1000ms)
- Vision Analysis: CPU-intensive, consider running on separate machine
- RCON Limits: Some servers limit command rate
- Memory: Vision model requires ~2GB GPU RAM
External Resources
Next Steps
Training Custom Models
Train YOLO models on your factory
Plugin Development
Build custom automation plugins
