A command-line TypeScript application that analyzes Factorio blueprints and calculates production rates, external inputs/outputs, and machine utilization.
- Decodes Factorio blueprint strings (base64 + zlib compressed)
- Supports both single blueprints and blueprint books
- Calculates effective machine speeds considering:
- Base machine crafting speed
- Internal modules (speed, productivity, efficiency)
- Beacon effects with Space Age (2.0) transmission efficiency
- Identifies external sources and sinks
- Calculates production bottlenecks and machine utilization
- Supports Space Age expansion recipes and machines
npm install
npm run buildnpm run analyze <blueprint-file>
# or
node dist/index.js <blueprint-file>node dist/index.js sample.txtOutput:
Processing 1 blueprint(s)...
—
Analyzed sample.txt
Inputs: Iron Ore (0.16/s), Calcite (0.00/s), Copper Plate (0.35/s)
Outputs: Automation Science Pack (0.49/s)
Utilization:
Assembling Machine 3 (Automation Science Pack) x1: 100%
Foundry (Casting Iron Gear Wheel) x1: 4%
Foundry (Molten Iron) x1: 2%
—
-
Blueprint Decoding: Reads the blueprint string, strips the version byte, base64 decodes, and decompresses with zlib.
-
Machine Analysis: Identifies all production machines and calculates their effective speed and productivity based on:
- Base machine stats
- Installed modules
- Affecting beacons (with 50% transmission efficiency in Space Age)
-
Flow Analysis: Tracks item/fluid production and consumption across all machines to identify:
- External inputs (items consumed but not produced internally)
- External outputs (items produced but not consumed internally)
-
Bottleneck Resolution: Iteratively adjusts machine utilization to account for:
- Supply constraints (upstream production < consumption)
- Demand constraints (downstream consumption < production)
- Assembling Machine 1/2/3
- Foundry
- Chemical Plant
- Electric Furnace
- Centrifuge
- Electromagnetic Plant
- Cryogenic Plant
- Biochamber
- Crusher
- Speed Module 1/2/3
- Productivity Module 1/2/3
- Efficiency Module 1/2/3
- Quality Module 1/2/3 (Space Age)
This investigator uses Space Age (Factorio 2.0) mechanics:
- Beacon transmission efficiency: 150% (1.5x module effects)
- Beacon diminishing returns: Total effect divided by sqrt(number of beacons)
- Foundry base productivity: 50%
- Electromagnetic Plant base productivity: 50%
- New recipes: Molten iron/copper, Casting recipes, etc.
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Accept new baseline outputs (after reviewing changes)
npm run baseline-acceptThis project uses baseline testing. Tests compare CLI output against known-good reference files:
- Test inputs:
tests/*.txt(blueprint files) - Reference outputs:
baselines/reference/*.txt(checked into repo) - Actual outputs:
baselines/local/*.txt(generated during test runs, not committed)
When you make changes that affect output:
- Run
npm testto see what changed - Review the diff to ensure changes are correct
- Run
npm run baseline-acceptto update reference baselines - Commit the updated baseline files with your changes
Important: We do not write explicit unit tests that validate specific output values. All testing is done through baseline comparison. See CONTRIBUTING.md for details.
ISC