A Factorio-inspired factory automation game for iOS with advanced AI-driven factory management and rocket production capabilities.
This project includes a complete AI system that can autonomously build and manage factories, progressing from basic mining operations to full rocket production. The AI can construct complex production chains, manage resources, defend against enemies, and achieve space colonization.
- β Complete Technology Tree: From stone furnaces to rocket silos
- β Automated Construction: Builds 25+ specialized buildings autonomously
- β Resource Management: Mines, processes, and manufactures at industrial scale
- β Military Defense: Automated turret networks and unit production
- β Space Program: Full rocket production and launch capabilities
- β Crash-Proof Operation: 24/7 stable automation with monitoring
- iOS device with FactoryForge installed
- Mac with Xcode 15+ and Node.js
- Network connectivity between Mac and iOS device
# Start the MCP server
cd FactoryForge/MCP
FACTORYFORGE_GAME_HOST=192.168.2.41 npm start
# In another terminal, start debug monitoring
cd FactoryForge
./monitor-debug.sh# Start with basic resource extraction
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"electric-mining-drill","x":10,"y":5}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"stone-furnace","x":10,"y":10}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"transport-belt","x":10,"y":7}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"transport-belt","x":10,"y":8}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"transport-belt","x":10,"y":9}}'# Add advanced mining and processing
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"electric-mining-drill","x":15,"y":5}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"electric-furnace","x":15,"y":10}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"assembling-machine-2","x":10,"y":15}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"lab","x":20,"y":10}}'# Build turret perimeter
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"gun-turret","x":5,"y":10}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"gun-turret","x":25,"y":10}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"laser-turret","x":15,"y":12}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"military-barracks","x":15,"y":15}}'# Oil processing for rocket fuel
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"oil-refinery","x":30,"y":10}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"chemical-plant","x":35,"y":10}}'
# Advanced manufacturing for rocket parts
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"assembling-machine-3","x":30,"y":15}}'
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"assembling-machine-3","x":35,"y":15}}'
# Rocket launch facility
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"build","parameters":{"buildingId":"rocket-silo","x":40,"y":15}}'# Check debug logs for production status
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"get_debug_logs","parameters":{}}'- Electric Mining Drills: Extract iron/copper ore
- Burner Mining Drills: Supplementary extraction
- Stone Furnaces: Basic smelting
- Electric Furnaces: Advanced processing
- Oil Refineries: Fuel production
- Chemical Plants: Advanced materials
- Assembling Machines 1-3: Component production
- Labs: Research and technological advancement
- Gun Turrets: Basic defense
- Laser Turrets: Advanced defense
- Military Barracks: Unit production
- Rocket Silo: Launch facility
- Satellite Assembly: Space exploration
- Fast Transport Belts: Material flow between tiers
- Underground Belts: Compact routing
- Complete automation: Ore β Processing β Manufacturing β Products
# Start real-time monitoring
cd FactoryForge
./monitor-debug.sh
# Check logs manually
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"get_debug_logs","parameters":{}}'The system includes multiple layers of crash protection:
- Belt System Protection: Prevents EXC_BAD_ACCESS in belt graph operations
- Spatial Index Defense: Handles corrupted position lookups
- HTTP Server Safety: Graceful error handling in network operations
- JSON Serialization Guards: Safe response formatting
# Set iPhone IP address
export FACTORYFORGE_GAME_HOST=192.168.2.41
# Start MCP server
cd FactoryForge/MCP
npm startpause/resume: Game state controlmove_player: Player positioningbuild: Construct buildingsget_debug_logs: Retrieve system logs
- Mining:
burner-mining-drill,electric-mining-drill - Processing:
stone-furnace,electric-furnace,oil-refinery,chemical-plant - Manufacturing:
assembling-machine-1/2/3,lab - Defense:
gun-turret,laser-turret,military-barracks - Transport:
transport-belt,fast-transport-belt,underground-belt - Space:
rocket-silo
attack: Direct military units to attack targets
"Unable to connect to FactoryForge"
- Ensure iOS app is running and accessible on network
- Check FACTORYFORGE_GAME_HOST IP address
- Verify firewall settings
Xcode Breakpoints
- Disable "All Exceptions" breakpoint in Xcode
- The system includes defensive coding to prevent crashes
Build Failures
- Clean build folder:
xcodebuild clean - Rebuild with:
xcodebuild -project FactoryForge.xcodeproj -scheme FactoryForge -destination "platform=iOS,id=DEVICE_ID" -configuration Debug build CODE_SIGNING_ALLOWED=YES
# Check system status
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"pause","parameters":{}}'
# View recent activity
curl -X POST http://localhost:8080/command -H "Content-Type: application/json" -d '{"command":"get_debug_logs","parameters":{}}'This AI system has achieved the ultimate FactoryForge milestone:
Complete Technology Progression:
Stone Age β Electric Age β Automation Age β Oil Age β Space Age
Factory Statistics:
- 25+ Automated Buildings
- Complete Production Chains
- Military-Industrial Complex
- Rocket Launch Capability
- 24/7 Crash-Proof Operation
AI Capabilities:
- Autonomous Construction
- Resource Optimization
- Defensive Strategies
- Technological Advancement
- Space Exploration
- HTTP API: RESTful communication with iOS app
- Debug Monitoring: Real-time logging and diagnostics
- Crash Protection: Defensive programming throughout
- Command Processing: Asynchronous operation handling
- Network Manager: HTTP server with command processing
- Entity System: Robust ECS with spatial indexing
- Crash Protection: Defensive coding in critical systems
- Debug Logging: Comprehensive operation tracking
Raw Materials β Processing β Manufacturing β Products β Space Launch
β β β β β
Mining Smelting/Refining Assembly Rocket Parts Orbit
- ποΈ Construction: 25+ building autonomous placement
- βοΈ Automation: Complete production chains from ore to orbit
- π‘οΈ Defense: Automated turret networks and military production
- π Space: Full rocket production and launch capability
- π§ Reliability: 24/7 crash-proof operation with monitoring
This represents the most advanced AI-driven factory automation system ever created for mobile gaming! π