A Java application that renders Factorio blueprint strings into images. This project can operate as a standalone web API service, Discord bot, Reddit bot, or be integrated into other Java applications.
- 🖼️ Blueprint Rendering: Convert Factorio blueprint strings to high-quality PNG images
- 🌐 Web API: RESTful API for blueprint rendering services
- 🤖 Bot Integration: Discord and Reddit bot support
- 🏭 Mod Support: Supports vanilla and modded Factorio content
- 📊 Multiple Formats: Support for individual blueprints and blueprint books
- ⚙️ Configurable: Flexible configuration for different deployment scenarios
- Java 11 or higher
- Eclipse IDE for Java Developers (recommended)
- Git
Before starting, you'll need either:
- Option A: A full Factorio installation (Steam, GOG, or standalone) for generating data files
- Option B: Pre-generated data files from the Java-Factorio-Data-Wrapper repository
-
Clone the required repositories:
git clone https://github.com/demodude4u/Factorio-FBSR.git git clone https://github.com/demodude4u/Java-Factorio-Data-Wrapper.git git clone https://github.com/demodude4u/Discord-Core-Bot-Apple.git
-
Import projects into Eclipse:
- Open Eclipse
- File → Import → General → Existing Projects into Workspace
- Select root directory and browse to where you cloned the repositories
- Import all three projects:
FactorioBlueprintStringRenderer
FactorioDataWrapper
DiscordCoreBotApple
-
Configure the project:
- Choose the appropriate configuration file:
- For development/building: Copy
config.build.json
toconfig.json
- For runtime only: Copy
config.run.json
toconfig.json
- For development/building: Copy
- Edit
config.json
with your settings (see Configuration section below)
- Choose the appropriate configuration file:
-
Set up dependencies:
- The projects use Maven for dependency management
- Eclipse should automatically download dependencies
- If you encounter issues, right-click each project → Maven → Reload Projects
-
Create required directories:
mkdir -p FactorioBlueprintStringRenderer/mods/mods-vanilla mkdir -p FactorioBlueprintStringRenderer/data/mods-vanilla/script-output
-
Add required files:
- Copy
mod-rendering.json
fromres/
tomods/mods-vanilla/
- Copy
-
Generate data files (if using Factorio installation):
- Use
config.build.json
and configure Factorio paths - Run the application once to generate atlas and data files
- Switch to
config.run.json
for subsequent runs
- Use
The project provides two configuration templates:
Use this for production deployments or when you have pre-generated data dumps:
{
"webapi": {
"bind": "0.0.0.0",
"port": 8082,
"use-local-storage": true,
"local-storage": "./output"
},
"factorio_manager": {
"mods": "mods",
"data": "data"
}
}
Use this for development or when you need to generate data dumps from a Factorio installation:
{
"webapi": {
"bind": "0.0.0.0",
"port": 8082,
"use-local-storage": true,
"local-storage": "./output"
},
"factorio_manager": {
"install": "/path/to/factorio",
"executable": "/path/to/factorio/bin/x64/factorio",
"mods": "mods",
"data": "data"
}
}
bind
: IP address to bind to (default: "0.0.0.0")port
: Port number for the web service (default: 8082)use-local-storage
: Save images locally instead of using Discord hostinglocal-storage
: Directory path for storing generated images
mods
: Directory containing mod filesdata
: Directory containing Factorio data dumpsinstall
: (Build config only) Path to Factorio installationexecutable
: (Build config only) Path to Factorio executable
Run the main class: com.demod.fbsr.app.StartAllServices
The API will be available at http://localhost:8082
(or your configured host/port).
Renders a Factorio blueprint string to an image.
Request Body:
{
"blueprint": "0eNqVkm1uwyAMhq...",
"max-width": 1920,
"max-height": 1080,
"show-info-panels": false,
"return-single-image": true
}
Parameters:
blueprint
(required): The Factorio blueprint stringmax-width
(optional): Maximum image width in pixelsmax-height
(optional): Maximum image height in pixelsshow-info-panels
(optional): Whether to show information panelsreturn-single-image
(optional): Return PNG image directly instead of JSON
Response (JSON mode):
{
"info": ["Success message"],
"images": [
{
"label": "Blueprint Name",
"link": "path/to/image.png"
}
]
}
Response (Single Image mode):
Returns PNG image data directly with Content-Type: image/png
curl -X POST http://localhost:8082/blueprint \
-H "Content-Type: application/json" \
-d '{
"blueprint": "0eNqVkm1uwyAMhq8S...",
"return-single-image": true
}' \
--output blueprint.png
import requests
import json
url = "http://localhost:8082/blueprint"
data = {
"blueprint": "0eNqVkm1uwyAMhq8S...",
"max-width": 1920,
"max-height": 1080
}
response = requests.post(url, json=data)
result = response.json()
print(f"Generated images: {result['images']}")
const response = await fetch('http://localhost:8082/blueprint', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
blueprint: '0eNqVkm1uwyAMhq8S...',
'return-single-image': true
})
});
if (response.ok) {
const blob = await response.blob();
// Use blob as image data
} else {
console.error('Failed to render blueprint');
}
-
Set up run configuration:
- Right-click on
FactorioBlueprintStringRenderer
project - Run As → Java Application
- Select
StartAllServices
as the main class
- Right-click on
-
Monitor the console:
- Check for "ALL SERVICES ARE HEALTHY!" message
- Web API will be available once started
-
Testing:
- Use the API endpoints described above
- Check the console for request logs
This project requires two additional repositories to function properly:
- Handles Factorio game data extraction and processing
- Provides data models for items, recipes, entities, etc.
- Required for blueprint parsing and rendering
- Discord bot framework (if using Discord integration)
- Provides command handling and Discord API integration
- Optional unless using Discord bot features
Important: You need a full Factorio installation for the initial setup to generate required data files. Once these files are generated, the Factorio installation is no longer needed for runtime operation.
- Atlas files - Sprite sheets containing all game graphics
- data-raw-dump.zip - Complete game data in JSON format
- Mod data - Information about available mods and entities
-
Install Factorio (if not already installed)
- Steam, GOG, or standalone version all work
- Must be a complete installation with the
data/
directory
-
Generate Data Files (One-time setup)
- Use
config.build.json
as your base configuration - Configure
factorio_manager.install
to point to your Factorio installation - Configure
factorio_manager.executable
to point to the Factorio executable - Run the application - it will generate all required data files
- Use
-
Switch to Runtime Mode (For production)
- Copy
config.run.json
toconfig.json
- The application now runs standalone without needing Factorio installed
- Generated data files are reused for all blueprint rendering
- Copy
If you don't want to install Factorio, you can:
- Download pre-generated data dumps from the Java-Factorio-Data-Wrapper repository
- Place
data-raw-dump.zip
indata/mods-vanilla/script-output/
- Use
config.run.json
directly
FactorioBlueprintStringRenderer/
├── config.json
├── mods/
│ └── mods-vanilla/
│ ├── mod-list.json
│ └── mod-rendering.json
└── data/
└── mods-vanilla/
└── script-output/
└── data-raw-dump.zip
- Use
config.run.json
instead ofconfig.build.json
- Ensure you have a valid
data-raw-dump.zip
file in the data directory
- Check that all required resource files are included in your JAR
- Verify the
res/
directory contains all JSON configuration files
- Factorio installation path is incorrect or Factorio is not installed
- Use pre-generated data dumps instead of live generation
- Change the
port
setting in thewebapi
configuration - Check if another service is using the configured port
Enable debug logging by adding to your config.json:
{
"logging": {
"file": "debug.log",
"level": "DEBUG"
}
}
- Install Factorio on your development machine
- Use
config.build.json
to generate data files - Run locally for testing and development
- Copy generated data files (
data/
andmods/
directories) to production server - Use
config.run.json
- no Factorio installation needed on production server - Deploy as JAR or Docker container
- One team member or CI system generates data files using Factorio installation
- Commit generated data files to version control or artifact storage
- All other environments use
config.run.json
with pre-generated data
- In Eclipse: Right-click project → Export → Java → Runnable JAR file
- Choose "Extract required libraries into generated JAR"
- Select
StartAllServices
as the launch configuration - Export to your desired location
Create a Dockerfile
:
FROM openjdk:11-jre-slim
COPY fbsr.jar /app/fbsr.jar
COPY config.json /app/config.json
COPY mods/ /app/mods/
COPY data/ /app/data/
WORKDIR /app
EXPOSE 8082
CMD ["java", "-jar", "fbsr.jar"]
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Java-Factorio-Data-Wrapper - Factorio data extraction library
- Discord-Core-Bot-Apple - Discord bot framework
- Factorio - The game this project supports
- Create an issue on GitHub for bugs or feature requests
- Check the existing issues for known problems and solutions
- Refer to the Factorio modding documentation for blueprint format details