how to debug factory designs?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Laie
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Fri Dec 25, 2020 6:18 pm
Contact:

how to debug factory designs?

Post by Laie »

So I've planned a bit of factory and now I'd like to see if it works as expected.

With belt based production, you can easily see if a belt is full or not (that's not the whole story, of course, but bear with me for a moment) but I'm trying bots and it's pretty hard to spot if an assembly machine runs only intermittently. I guess the only way to be sure is to run it in a test bed and see if I get the desired output.

I'm still at a point of the game where I can quickly STOP all other production and use the production stats to check how well this one works.

Still, that's kind of a roundabout way of checking it. I've seen screenshots where people have used bottomless chests to supply arbitrary amounts on one end, and make the products disappear on the other -- and as this was on a checkerboard background, I presume it was put together in an editor of sorts? I had a look at the scenario editor and while I'm sure that I could make it work for testing factory layouts, I have an inkling that there is a better way.

Surely, there must be a writeup somewher, but I cannot find it -- probably because I'm using the wrong search terms. If you could give me some pointers, that would be most kind.
Koub
Global Moderator
Global Moderator
Posts: 7812
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: how to debug factory designs?

Post by Koub »

You may want to get https://mods.factorio.com/mod/EditorExtensions.
Used with editor mode (/editor in the console), plus maybe a few QoL mods (https://mods.factorio.com/mod/Bottleneck typically), it's great for debugging.
You may also activate always display gris in the display options.

The way I do is have a standalone install (downloaded from the website), that I use solely for debugging purpose, and I play my unmodded games with the Steam version. Easy to run both in parallel, and that way, can't screw my achievements if I want them.
Koub - Please consider English is not my native language.
Tertius
Filter Inserter
Filter Inserter
Posts: 953
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: how to debug factory designs?

Post by Tertius »

You don't need mods for getting a working sandbox.
In the main menu, go to Single Player -> New Game -> Sandbox
At map creation, to get a lab-like environment, deactivate all resources (you can create them manually), deactivate all terrain, deactivate enemy bases, deactivate pollution.
Go to play, then you get the question if you want to have all tech researched (-> yes), cheat mode (-> yes), always day (-> yes).
Then open the console and enter /editor
This removes the running player character and enables map editor and its powerful menu.
In the map editor, change to the "surfaces" section and click:
remove all entities
fill with lab tiles
activate generate new chunks with lab tiles
And that's it.

You find the endless supply chest in the "entities" section of the map editor, choose the the category with the surprise box icon. You probably need the Electric energy interface, the infinity chest and the infinity pipe. And in the logistics category, locate the 3 loaders. They pull stuff from the infinity chests to a belt, fully compressed.
In the "Time" category of the map editor, you find options to start/stop the ticks or to advance one tick only. To see things actually working as in the regular game, click the Play icon. I find this helpful and use the corresponding hotkeys to start/stop/advance 1 tick. More info about the map editor can be found in the wiki.
If you need water tiles, create water tiles with the "Tiles" section of the map editor.

I created one save of this and re-use and expand the save whenever I need to design something.
Laie
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Fri Dec 25, 2020 6:18 pm
Contact:

Re: how to debug factory designs?

Post by Laie »

Thanks for the replies.

sadly, I haven't come around to trying one or the other approach: shortly after posting the question I decided to start over from scratch and am still far from launching the first rocket. It's only a question of time until I have to look at that blueprint again, though.
Tertius
Filter Inserter
Filter Inserter
Posts: 953
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: how to debug factory designs?

Post by Tertius »

Difficult to recommend something.
What I do:
Rate factory experiments by comparing how well they consume or fill a full belt. A full (yellow/red/blue) belt is the benchmark. Work out the minimum amount of machines in a tiled setup to still fill or consume some full belt.
Check the "items produced" info by hovering over the assembly machines. All machines in a production line should produce the same amount of items.
Watch the input slots of assembly machines. They should never get empty/display the reddened icon to visualize not enough supplies.
Check how many items should be processed by the info on machines, multiply by amount of machines and modifiers (modules), then compute the theoretical throughput. Let the factory run, count the actually processed items and check if they match the computed theoretical amount of items.
Build two slightly different factories that should produce the same item. After some time, compare the output: which is higher?

For example, take this green circuit factory:
Screenshot 2021-07-02 205849.png
Screenshot 2021-07-02 205849.png (510.2 KiB) Viewed 5311 times
It looks easy and totally straightforward. It almost produces the theoretical maximum amount of green circuits possible with 4 assembling machines+beacons with 4 productivity modules.
However, it took me a whole evening with tinkering to work out that 2x6 stack inserters for output are required for full throughput of copper wire, but only 2x4 for input, and these must have 1 space in between. And that exactly 2 stack inserters per machine are required for plate input and circuit output. To get all this, I varied the setup of one side and compared the throughput (items processed by one assembling machine) with the other side. And I compared the 2 lanes of the resulting belt and saw how that gap of circuits developed while I varied the setup inside.

The math is always part of the debugging: 1 copper machine with 8 speed (beacons) and 4 prod modules give 8 speed * 2 cables * 1.4 prod factor / 0.5/s= 44.8 copper wire per second. These are consumed with a factor of 1/3 per cycle to produce 1 green circuit with a prod factor of 1.4: 44.8 / 3 * 1.4 = 20.9 green circuits per belt lane or 41.81 per belt. This is the theoretical maximum.

Then I counted the gap length: belt lane has 9 filled tiles and 1 gap tile, which means 90% full tiles, which means 45*0,9=40.5/s throughput.
Theoretical maximum is 41.81/s, actual result is 40.5/s. That's good enough, given the fact that I saw by observation where the speed loss of 1,31 items/s takes place: it's some kind of resonance interaction between input and output in the wire machines that I wasn't able to resolve, even by changing the amount of inserters or varying their stack sizes. This hiccup makes the output stack full and the next moment the input stack empty about every 10 seconds - no chance to do anything about that.

I used the above sandbox for development. To reset everything for a new test, I just "cut" the complete factory and pasted it back to where it was, so all counters were reset. I find this cut/copy+paste the best feature of the sandbox in comparison to the non-sandbox game. It's also perfect to make a copy of some factory, make a change in the copy and compare the output of the two.

If you're debugging for bots, perhaps funneling the result onto belts or into chests might give you the chance to count/compare the result. I didn't used bots yet for mass production - currently, I mainly use them with the personal roboport or to transport tiny amounts of items over large distances, for example locomotive fuel supply to all of the unloading stations that are distributed all across the main factory. Belts would be huge waste for this.
Laie
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Fri Dec 25, 2020 6:18 pm
Contact:

Re: how to debug factory designs?

Post by Laie »

OK, now I had reason to try and... entering sandbox and editor mode seems easy enough, but somehow I cannot string red&green wire in the editor?
I tried to get my player character back so I could do it "manually" but couldn't figure out how.

Editor Extensions is probably not strictly necessary, but it provides me with a pre-made sandboxing scenario that "just works" without any struggle. Thumbs up.
Tertius
Filter Inserter
Filter Inserter
Posts: 953
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: how to debug factory designs?

Post by Tertius »

In the standard sandbox, while being in the "None" mode, if you open the inventory you have a 3 part inventory: at the left a common inventory, in the middle a "infinity chest" functionality and at the right an instant creation for every item in the game including intermediate items. In object building mode, you have only the opportunity to get building objects into your mouse hand and to place these, no intermediate objects. I propose you read the wiki article about the map editor: https://wiki.factorio.com/Map_editor
Pat Healy
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Feb 25, 2021 1:27 am
Contact:

Re: how to debug factory designs?

Post by Pat Healy »

Tertius wrote: Wed Jun 30, 2021 4:41 pm You don't need mods for getting a working sandbox.
In the main menu, go to Single Player -> New Game -> Sandbox
At map creation, to get a lab-like environment, deactivate all resources (you can create them manually), deactivate all terrain, deactivate enemy bases, deactivate pollution.
Go to play, then you get the question if you want to have all tech researched (-> yes), cheat mode (-> yes), always day (-> yes).
Then open the console and enter /editor
This removes the running player character and enables map editor and its powerful menu.
In the map editor, change to the "surfaces" section and click:
remove all entities
fill with lab tiles
activate generate new chunks with lab tiles
And that's it.

You find the endless supply chest in the "entities" section of the map editor, choose the the category with the surprise box icon. You probably need the Electric energy interface, the infinity chest and the infinity pipe. And in the logistics category, locate the 3 loaders. They pull stuff from the infinity chests to a belt, fully compressed.
In the "Time" category of the map editor, you find options to start/stop the ticks or to advance one tick only. To see things actually working as in the regular game, click the Play icon. I find this helpful and use the corresponding hotkeys to start/stop/advance 1 tick. More info about the map editor can be found in the wiki.
If you need water tiles, create water tiles with the "Tiles" section of the map editor.

I created one save of this and re-use and expand the save whenever I need to design something.
Thanks so much for the step by step - somehow I've figured out how to launch rockets but have been struggling with how to create a decent test environment! For the first time in the game I'm seeing that a megabase is possible, so testing late game designs now. Very timely and helpful, thank you.
Laie
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Fri Dec 25, 2020 6:18 pm
Contact:

Re: how to debug factory designs?

Post by Laie »

Seems to fit here better than starting a new thread: my actual gameplay has long since outpaced the sandbox.

How can I set arbitrary levels of mining productivity?

It seems that the technology "mining-productivity-100" does not exist. What I can do, however, is

Code: Select all

/c game.player.force.technologies['mining-productivity-4'].researched=true
which will increase the tech level by 1 and can be repeated as often as I like. Only that repetition is boring, and I can totally imagine that someday, i might want to set it to a lower level than what I currently have. Is there a way to directly set a specific level?

BTW, Teritus, I just noticed that I never said thanks for your excellent setup guide. It has been extremely helpful.

ETA: setting the tech to 3 will undo all inifinite research, essentially resetting it. So if there is no direct way of setting arbitrary levels, I guess I could come up with a while loop in order to grant me as many upgrades as I like. That would be a "good enough" solution in my opinion... but if there is a better one, I would very much like to know.
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: how to debug factory designs?

Post by NotRexButCaesar »

Laie wrote: Sat Sep 11, 2021 7:04 pm How can I set arbitrary levels of mining productivity?
Go to the force tab of the editor menu (looks like a flag.)
Make sure the player force is selected & click “Edit other properties.”
Search with control-F for ‘mining-drill-productivity-bonus’ & set a multiplier value.
—Crevez, chiens, si vous n'étes pas contents!
Laie
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Fri Dec 25, 2020 6:18 pm
Contact:

Re: how to debug factory designs?

Post by Laie »

Excellent, thanks!
Post Reply

Return to “Gameplay Help”