> ## Content Index
> Fetch the complete content index at: https://simstructures.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Factorio Under the Hood: Deterministic Sim, Transport Lines & UPS Tricks
- URL: https://simstructures.com/factorio-under-the-hood/
- Published: 2026-08-31T17:11:33.000Z
- Updated: 2026-08-31T21:38:20.000Z
- Description: How Factorio keeps thousands of belts and machines at a locked 60 UPS: a custom C++ deterministic engine, merged transport lines, sleeping entities and multithreaded updates.
- Author: ENGN GAME STUDIO LLC
- Tags: Factorio, Articles

### Engine & Tech Stack

- **Engine / language:** a custom C++ engine; **Lua** drives both the data/prototype stage and runtime mod scripting.
- **Map representation:** a tile grid partitioned into **32×32 chunks**; entities live on the grid and are tracked in per-system update lists.
- **Determinism:** the simulation is fully deterministic, enabling **lock-step multiplayer** where only player inputs are sent over the network.

### Core AI & Decision Making

- **Enemies (biters):** pollution spreads per-chunk and raises aggression; enemies form **unit groups** that move and attack together.
- **Dispatch:** attack targets and routes come from the pathfinder; groups gather, then path toward the nearest polluting structures.

### State Management & Data Architecture

- **Model:** custom C++ entities updated from active **update lists**; entities with nothing to do are removed from those lists ("sleeping") so idle factories cost almost nothing.
- **Transport lines:** contiguous belt segments are merged into a single **transport line** with a compact item representation: items aren't simulated as individual objects, which is the core belt-throughput optimization.
- **Persistence:** the entire deterministic world state is serialized to the save.

### Tick Scheduling & Performance Tricks

- **Fixed 60 UPS:** the simulation runs at a constant 60 updates/second, fully **decoupled from render FPS**.
- **Multithreading:** later versions parallelize belt, fluid, electric-network and entity-preparation work across cores; the electric network and heat/fluid systems update on their own schedules.

### Pathfinding & Spatial Systems

- **Algorithm:** **A\*** over the collision grid with an abstract, cached base-to-base pathfinder to keep long enemy paths cheap.
- **Spatial partitioning:** chunk-based iteration and path caching bound the search space as the factory sprawls.