Yet another shower thought that got out of hand.
I was looking to illustrate some distributed system design concepts in a fun, digestible way at work (because who has time for boring system design docs?). I had the thought that this model generation (Claude 5.5, Gemini Neon and co) is exceptional at building scripted videos, and that Factorio (a game I play often to “relax”) has a fully scriptable API. So how would Opus 5.5 do when tasked with building a diagramming tool with Factorio as the “renderer”?
So, the first pass was a simple e-commerce server, and of course it churned that out quickly.
Prompt: i would like to build out a system for creating system architecture, flow diagrams and animations for complex distributed systems using factorio.
The system is described in a small YAML spec; services become machines, calls become belts, and messages become items on those belts:
title: Order pipeline
nodes:
web: {kind: client, label: Web app, rate: 4/s}
gw: {kind: gateway, label: API gateway}
orders: {kind: service, label: orders-svc, capacity: 10/s}
db: {kind: database, label: orders-db (Postgres)}
bus: {kind: queue, label: order-events (Kafka)}
billing: {kind: worker, label: billing-worker, capacity: 4/s}
edges:
- web -> gw: {msg: HTTP request}
- gw -> orders: {msg: CreateOrder}
- orders -> db: {msg: INSERT}
- orders -> bus: {msg: OrderCreated, kind: async}
- bus -> billing: {msg: OrderCreated, kind: stream}
timeline:
- {at: 6s, fail: billing}
- {at: 14s, recover: billing}
It did well enough on that that I decided to up the difficulty level.
Prompt: could we build out a scenario demonstrating horizontal autoscaling using circuits, bots and blueprints ? i’d like to show “pods(assemblers)” being constructed in response to a temporarily increased number / throughput of some raw material. then being deconstructed. circuit network is feasible.
The autoscaler is a hand-built scene rather than a generated one, so its “spec” is the config table at the top of the scenario script. The rest is circuits, a pod blueprint, and a roboport full of construction bots:
local CFG = {
target = 30, -- backlog per desired replica
deadband = 20, -- backlog that is just in-flight work, ignored
miss_hold = 1, -- this many misses in a window: hold current replicas
miss_step = 6, -- this many: current + 1 (at most one step per window)
retry_window = 180, -- ticks between retry batches (requeue with backoff)
min = 1, max = 8,
up_cooldown = 180, -- ticks between scale-up decisions (= retry window)
down_window = 360, -- desired must stay below current this long (stabilization)
down_step = 150, -- at most one pod terminated per this many ticks
-- traffic profile: {start_second, requests_per_second}
traffic = {{0, 1.2}, {10, 7.5}, {58, 1.2}},
}
Well damn, it turns out we can, with a couple of adjustments to include retries in the autoscale metrics signal.
We now had a fun, reasonably accurate illustration of a Kubernetes Horizontal Pod Autoscaler assembled from Factorio’s in-game circuit automation! With “pods” assembled and torn down on demand as load grows.
That escalated quickly.
Code: github.com/SandwichLabs/factorio-flow (MIT, a just-for-fun experiment; needs your own copy of Factorio 2.x).
Further reading
- My earlier post on why Factorio is engineering training: The Factory Must Grow… And So Must Your Engineering Intuition
- Shopify CEO Tobi Lütke, the best-known advocate of Factorio as training: “I honestly just think this game is profound.” (The Observer Effect, 2020), and “Shopify lets people expense factorio.” (@tobi, 2022)
- Ruurtjan Pul, Understanding Kafka with Factorio (2019)
- Hopkins, Bakler & Khan, Factorio Learning Environment (2025): LLM agents playing Factorio through code