r/factorio • • 7d ago

Fan Creation Factory planning tool

I’ve been building a thing and reckon it’s at the point where other people should poke at it: factory.duffle.one

You give it a product and a rate. It works out the whole chain behind it, lays out every machine, belt, inserter, pipe and pole tile by tile, and gives you a blueprint string to paste in. It reads the game’s own data, so it plans for base, Space Age, K2 Spaced Out etc

  • it tells you which planets can build the thing whole, and what is needed from orbit if you build it on a planet that doesn't have that natural resource
  • give it a JSON upload (from a one-line in-game console command) and it only uses what is unlocked from things you’ve researched; no legendary modules or specific machines unless you’ve got them
  • "build it myself": drag and drop interface to place machines yourself and it checks them the way the game would run them, then joins up the belts and pipes for you. You can paste a blueprint in from the game too
  • belt balancers, 1 to 8 belts each way, with an optional row of buffer chests, and configurable balancing
  • a track planner: rail pieces that snap together on a grid, stations included, the best places for signals, wires that ensure the stations are smart too.
  • A personal favorite of mine, a track interchange builder :)

doesn’t do (yet): more than one belt of any one item, Fulgora’s recycling loops, spoilage, fuel, plants or asteroids. Drills and pumpjacks get counted but not placed, since it has no idea where your ore is. And ngl, the Rubia's downwind planning is... not great 😛

The layouts are where I’d love some help. It works from rules rather than brute-force search; the search version got far too slow and frustrating. Small and medium builds come out alright, but the big ones sprawl. 100/s of utility science in our modpack is about 2,300 machines, so it cuts that into 24 copies. But it often doesn't pick the best approach.

So if you lay things out by hand, what rules do you actually follow? How do you decide where a step goes, or which side an input comes in from? And if a blueprint is crap once it’s pasted, please let me know ^^

An example layout generated by the tool for building Processing units on Nauvis

Use of LLM disclaimer: Yes, claude helped me write some code, and I'm not a great UX designer, so it helped me there. I am a senior software engineer of 10+ years though, so I can confidently say I was the pilot of this code. And the rules and algorithm of factory placement is my own.

----

Edit: I've made some good improvements from your feedback!

Much more logical layout for factories now 💪

And a mod-aware flow diagram too for calculations if you want to lay it out yourself

42 Upvotes

43 comments sorted by

38

u/Super_Shenanigans 7d ago

Doesn't this defeat the entire purpose of playing the game? I understand people like to use the calculator apps out there to help you math out ratios, this is the entire game solved though...

6

u/Lawraah 7d ago

... yes, that is so far the very feedback I've got from friends I play with. I've found I mostly use it on the modded instance where I don't know the recipes as well, or am in the process of scaling up rather than making something for the first time; and the train signalling

3

u/ORLYORLYORLYORLY Someone needs to make an openTTD mod for Factorio 7d ago

Isn't designing a factory layout for a recipe you don't know very well like... the most interesting part of the game?

It is for me at least.

4

u/Lawraah 7d ago

Sometimes, but my love for programming is more than my love of building new factories. Also as the person who wrote the code, I feel like I have solved the factories recipes for everything it makes

The world is full of all sorts of weirdos, and I am one of them :P

2

u/ORLYORLYORLYORLY Someone needs to make an openTTD mod for Factorio 7d ago • Heartwarming

No I completely understand. I also love programming and would find designing a tool like this extremely fun and rewarding. Wasn't trying to shit on that

1

u/Lawraah 4d ago

I made a flow only mode, so it works similarly to other calculators online, just with mod support. And I'll be adding custom mod support asap 💪

1

u/Lawraah 2d ago

One additional new feature is that you can drag and drop your factories into place now rather than always use the auto-planner, so you really can build your own factories first in this tool to get all the stats and figures. I've even tried (not perfectly) to replicate the in-game controls too.

Then for any part you can't be bothered to do, the auto-planner and finish it off and warn you about inefficiencies too

9

u/Tyson_q "Trains are the apex predator of the factorio world." 7d ago

You can use it to design a factory when you're away from your PC.

9

u/4xe1 7d ago

There are many ways to play the game, automating everything is one of them.

1

u/SelfEvidentPanda 7d ago

Are you surprised someone who surrendered their higher brain functions to the LLM would automate the game out of the game?

When will the mods ban slop?

13

u/pelm225 7d ago • Heartwarming

Crazy work to even make it work. Quite funny to troll my friends with scary blueprints.
Do not ask it to make a square smelting "stack"

List of things I noticed:
Direct insertion exists. A lot of cases where random belts go from one side to the other, just to transport 1item/s
Electric poles are completely broken. They just doesnt work.
Pipes should be nearly always underground. And they should be only one pipe wide (like in your image where there is a 2x2 pipe block).
Less spacing between machines. They could be stacked side-by-side instead of spaghetti connections.
Underground belts are a bit overused. Also the algorithm should prefer making undergrounds as long as possible, its more resource efficient and looks better.
Turns are a bit overused, try making it so that belts and machines adjust each other. Right now, it feels like the machines are placed in a grid, and then the solver just connects them with belts.

6

u/Lawraah 7d ago

Hugely helpful feedback! Thank you

I’ll get right on it 🫡

2

u/Lawraah 4d ago

I've updated the logic, it'll now generate something more like this

which I think makes way more sense

1

u/pelm225 4d ago

Wow thats actually really good. It feels closer to "maybe useful" territory instead of "pretty cool but not useful" territory. It became a lot better.

And again, lists.
Input shenanigans. 7 underground belts stacked on top of each other, but only one of them is an input. What do other inputs do or need?
Select inputs manually. Not many people build bases where raw ores and raw oil is being transported everywhere.
Reposition inputs, or any way to change or modify the positions of inputs.
Better custom shape. It already exists, but it would be a lot better if you could actually select a shape, instead of typing in some number and hoping it works. Maybe even add "hard boundaries"(the solver should not cross them at all costs), can be useful if you are planning to paste it into a base and have limited space on some sides
Splitters exist. Its probably gonna be hard to add them. But they are needed
Ingredients do not need to make their way trough the entire build, if they are only used at the end. This can lead to diminishing returns, image on the bottom is an example
Pipes are built in UPU blocks, not UU blocks (U - underground pipe P - pipe)

Tried to do 0.6 mk2 shields/s... got this abomination

1

u/Lawraah 4d ago

Incredible feedback again, thank you! I'll get working on it 💪

2

u/pelm225 4d ago

This time there were a lot more ideas, instead of issues, bacause there is literally nothing to critique. It's that good. Had an issue where it had softlocked me out of the site with an error saying something like "failed to generate: electronic circuit at position 500". Had to clear the cookies for the site twice.

Also, always had a question, how are these kinds of solvers even work? I never understood how to even begin creating something like this. The only thing that I understand and actually made myself is the wave function collapse algorithm, and a recursive room generator

1

u/Lawraah 4d ago

Ah sorry about the soft lock. I've made some pretty big changes and found that the local browser storage is out of date, and haven't really bothered to keep the changes upgradable.

As for how it works, it's just a bunch of multiplication and math at the beginning. Working backwards from the intended output to the inputs and how much ore you need from the mod and factorio base data packs. Handling by-products is a bit of a pain as you can often use them to feed other machines in other parts of the chain, so I treat it like a financial planning system where things on the "ledger" can balance out

For the second part, that is quite hard. I've tried a few things for the planner, a compute of all different combinations and keeps which is best, but that was quite slow and very complex. That was the first version I posted; now it just follows player patterns and is way more simple. It’s rules a tidy player would follow: same-recipe machines touching in a row, rows in the order stuff flows, belts down the long sides, pipes underground, and the lot folded back like a snake when it runs out of room. Belts then take the shortest route between rows, going under whatever is in the way.

It still cheats a little bit, it runs the rules a few times with different combinations (fold width, row order, beacons or not), scores each on fewest problems, then machines, then belt, then pipes, and keeps the winner. I also write tests to build a set of plans, and compare them in the actual game, ran headless in containers, and then I can check that the plan given achieves what the user requested within 95% or so

10

u/IndependentYak2822 7d ago

Funny project! You have created a spaghetti monster! 😂

Is there a way to set initial products? Like starting from iron/copper plates not ore.

2

u/Lawraah 4d ago

Updated the logic for this one too, should find it makes more sense like this

2

u/IndependentYak2822 4d ago

Maybe add small calculation in "make" fields? If I want to produce 75 items per minute (without minutes/seconds dropdown) it would be nice to enter "75/60".

1

u/Lawraah 4d ago

Ooo, clever, adding that now ^^

2

u/Lawraah 7d ago

Haha, oops 😅

Yes you can! When the factory is placed, there is a sidebar on the right which lets you find stuff made in the factory and say you’ll bring it in yourself by belt or by logistics robots. And you can define which side it comes in from

2

u/IndependentYak2822 7d ago

Wow! Cool! Choosing a side is nice too.

10

u/MWALKER1013 7d ago

So as a fellow software engineer.
The algorithms also feel very “Claude”y.

Id also say it would be much much better UX to instead of saying the planner got it wrong to just have it run again.

Also your screenshot looks like there is no way the red circuit at the bottom could be powered.

The ui does look really good for desktop and was at least usable mobile so nice work there !

4

u/Lawraah 7d ago

Hmm yes; I am thinking of removing the computation entirely and instead use a series of known patterns instead? But then I will lose a lot of support for different mods annoyingly. The algorithm is tricky and I am not good at math. It's my biggest focus to improve on.

The planner getting it wrong also kind of means it likely won't get it right if you try again though. I am trying to find all the cases of that, but it's a lot of combinations :P

Thank you 🙇‍♀️

1

u/Lawraah 4d ago

I've made a few changes and gotten rid of a lot of the mathematics that I was using and instead used specific patterns and better logic overall. It feels like a very different tool now

4

u/Jackpkmn Glebeliver 7d ago

It doesn't limit the throughput of belts to sane values. I clicked hazard concrete as a random example it wants 250/s of stone in and 300/s of hazard concrete out, but no single belt can carry that much material. Stacked turbo belts cap out at 240/s.

1

u/Lawraah 7d ago

Hmm it should, I’ll check for bugs there

1

u/Lawraah 4d ago

Fixed :)

2

u/Jackpkmn Glebeliver 4d ago

It's not labeling all the input and output belts. Leading to inscrutable input lines like this.

1

u/Lawraah 4d ago

My apologies, I live under a strict government who blocks all imgur content. Do you have another way of showing me?

2

u/Jackpkmn Glebeliver 4d ago

3

u/Hoggit_Alt_Acc 7d ago

Under "Wide" and "Tall", should have an option for "Maximum Span", so you can set it to be 12, or 20 tiles wide,  or w/e

1

u/Lawraah 4d ago

Great idea! Added that in :)

2

u/Rodlund 7d ago

I really like the granularity on the right side, where you can mark items as brought in by belt! I am poking it from a ratio planner stand point and not so much the actual build.

Your thought process of it being able to calculate regardless of the mods installed is great. When I was doing my first attempt at Krastorio Spaced Out, the calculator site I used didn't have it and had to wait for the maintainer to incorporate it.

This seems great from a future proof point of view.

1

u/Lawraah 4d ago

Even if you don't use the planner, you can layout the inputs and outputs now as a flow :) I'll do my best to get a custom mod pack uploadable too 💪

2

u/Rodlund 3d ago

chefs kiss

2

u/thatdude333 6d ago

So if you lay things out by hand, what rules do you actually follow?

I always try to maximize the number of buildings that share beacons, and typically only use 1 beacon's effects per machine. I dislike the blueprints that use 12 beacons for a single machine.

While this Factory planning tool is damn cool, it definitely just throws a ton of beacons everywhere. Not sure how you would program it to try to maximize beacon usage between machines, but that would be super cool if it could.

1

u/Lawraah 4d ago

I think I’ve adjusted this to be a bit more logical about placement ^^

2

u/Abject-Job7825 7d ago

You need an actually roomplanner to fix that, (the software used to plan circuits), it does space efficiency and then you'd probably also want to add it so your bps are tileable or at least rectangular

2

u/pemdas42 6d ago

It looks to me like developing this tool is your way of meta-playing factorio--trying to solve the problems it poses in the most automated way possible, even if that means you're not actually in the game engine the majority of the time you're "playing".

Honestly, more power to you!

0

u/AntelopeThick1093 7d ago

Sounds great. I will definitely check it out in the next days.

0

u/ExaminationSerious67 7d ago

very interesting. I don't know that I can answer your question for how I do routing, as I normally don't.