Skip to main content

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.
The Factorio integration is maintained as a separate project: airi-factorio. Documentation here covers the integration architecture and setup overview.

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):
Restart the Factorio server.

2. Configure AIRI Module

In your AIRI configuration (Stage UI or config file):
From packages/stage-ui/src/stores/modules/gaming-factorio.ts:1:

3. Clone airi-factorio Project

4. Install Dependencies

5. Configure Environment

Edit .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:
Register plugin:

Vision Model Training

The integration supports custom YOLO models trained on Factorio:

Dataset Structure

Training

Deployment

Update .env:

Configuration Reference

Module Settings

RCON Commands

Common Lua commands:

Troubleshooting

RCON connection refused

  1. Verify RCON is enabled in server-settings.json
  2. Check firewall allows port 27015
  3. Confirm password is correct
  4. Restart Factorio server

Vision model not detecting

  1. Ensure model is trained on Factorio data
  2. Check confidence threshold (try lowering)
  3. Verify screenshot quality and resolution
  4. Update to latest model weights

Commands not executing

  1. Check Lua syntax in RCON commands
  2. Verify player permissions
  3. Review Factorio logs for errors
  4. 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