Hacker News new | ask | show | jobs
by kojiromike 1360 days ago
I love factorio, but it would be a lot harder if it didn't have magic backpressure for everything. Can you imagine all the piles of green chips everywhere if the assembler just kept dumping them until it clogged?

I'm not even saying that it'd be better for interviews if you could turn off that backpressure. You gotta limit these things. I'm just saying, if someone asked me how factorio was different from systems in the real world, that'd be my first example.

5 comments

> Can you imagine all the piles of green chips everywhere if the assembler just kept dumping them until it clogged?

Isn't that effectively the same thing as when the belt stops? You've just added a bit more buffer before everything seizes up, and some extra cleanup.

I'm not even sure you can say factorio has backpressure; the factory getting overloaded doesn't trigger slower production rates in prior parts of the system. The queue gets full and stops accepting input, and the prior machines stop sending input as a result (they could alternatively send input and it be dropped & deleted ala software systems, but that's just making it harder to debug because you don't see the whole thing freeze; the problem/solution is still the same)

> The queue gets full and stops accepting input, and the prior machines stop sending input as a result

That is backpressure...

Interestingly I think if Factorio didn't have backpressure, and unconsumed items disappeared when they reached the end of the conveyor, the game would be easier because you could just put every kind of items on a single belt. Un-balanced consumption wouldn't stop down the next production stage because the conveyor would keep running, whereas now if you're not consuming one type of item from a mixed stream you will block it preventing you from getting the other types of items.

Software often has built in back pressure. Most IO syscalls block, TCP surely does, so everything built on TCP does. Belt is memory. The full belt equivalent of software is OOM. If memory allocation can't be done everything comes to a halt. We could write software that instead of crashing just sits there until memory becomes available... It's the human scale circuit breakers (request timeouts) that cause issues. I guess one has to differentiate between batch processing software and interactive request/response style software. Factorio approximates the former, not the latter, but some of the underlying concepts are still the same.
That “magic backpressure” is solved in the real world with simple sensors, shutting down part of the manufacturing line is a relatively common occurrence (maintenance, safety stop, etc) and doesn’t cause the entire system to collapse.
Well, there is always the Belt Overflow mod [0], but is is truly masochistic.

[0] https://mods.factorio.com/mod/belt-overflow

"magic"? You mean a human shutting down a line when there is a backup on the output?