Belt Balancer

by asdff45

Adds Balancer Parts, that can be put together, to balance all adjusting lanes.

Content
4 years ago
0.17 - 1.1
50.3K
Logistics

g implementation / performance question

5 years ago

g'day. I was looking at this interestedly, because many similar mods use an on_tick handler for their implementation.

as far as I can see your mod is a bunch of standard splitters in a funny hat, as in, that are compactly hidden inside the balancer entity. so performance should be pretty much identical to implementing this with, y'know, standard splitters.

is that correct?

5 years ago

It is much more complicated, than just having Standart Splitters. Yes, you still can make this, with the normal Splitters (the Blueprint-libraries are around everywhere), but this mod is more space-efficient.
Normal Splitter are not really possible. This mod can have as many Parts as you want, in any form you want and it will still balance everywhere. Also normal splitters dont balance single lanes.
I not even use the splitter prototype, but the "entity-with-force" prototype. Making this with an splitter prototype, lead to weird behaviour, because the items can be run through my entites, and are some kind of splitted, by the c++ splitter code.

I've tested it, with an on_tick handler and decided, that this approach is too slow. Fortunatly factorio provides an on_nth_tick handler, which i use. So this mod, runs only when it has to, depending on the adjusted belts.

Code, to run only on nth_tick, as Subscribe/Unsubscribe Pattern: https://github.com/knoxfighter/belt-balancer/blob/master/helper/message-handler.lua
Code, to calculate, on which tick an balancer has to run: https://github.com/knoxfighter/belt-balancer/blob/master/objects/balancer.lua#L304

5 years ago

ah, I see. thank you for explaining. I appreciate it. my question wasn't meant to suggest that this was pointless because "you can do it with splitters", and I'm sorry if it came across like that. it was to understand how you internally implemented this, which you explained well, thank you.

(that, in turn, helps me understand the cost at scale.)

5 years ago

this is in comparison to the standard way to how this is in, efficiency compared to used materials

5 years ago

I wait hard that someone make such one lane balancer with invisible inserters... Should be better than on_nth_tick

5 years ago

I dont think, this is really possible right now. Something like https://forums.factorio.com/viewtopic.php?f=6&t=21121&p=132760&hilit=splitter+transport+line+position would be great.

5 years ago

i know this mod is a thing. https://mods.factorio.com/mod/Lane-Balancer though i'm not sure how it does it, since i haven't read the code.

5 years ago

well, ive some fork of that mod, on_tick . Still need to make some invisible inserters version.

5 years ago

Lane-Balancer is using invisible inserters as Entity. Those inserters are not used. The mod itself is looking in on_tick for items to be moved. Items are moved with InputLane.remove(stack) and OutputLane.insert_at_back(stack).
Lane-Balancer is working quite similar to my apprach, but with on_tick.

5 years ago
(updated 5 years ago)

Ah, alright. Thanks for the analysis. Look forward to playing around with this mod. Are the balancers configurable at all, e.g. filters or priority lanes?

Also, how does this mod compare against compound splitters, besides shape freedom?

5 years ago
(updated 5 years ago)

Nope, nothing really usefull. Also if you want may be to cooperate development - message me at discord SuicideParty#0652

5 years ago
(updated 5 years ago)

No, the balancer is not configurable. It is interesting to have that too. When i find time, i will implement that :)

@FluiD96 If you want to participate in this mod, you can just make a fork and create Pull Requests. https://github.com/knoxfighter/belt-balancer

The difference between belt-balancer and compound splitter:
- I actively work on this mod
- Compound Splitter is not really working well, especially when the buffer chest is full. Also the balancing sometimes breaks. Some information gets removed, when the item is put into buffer and on the belt (like damage).
- Compund Splitter also has no difference in performance, than the belt balancer.

That is the reason i started to create this mod :)

5 years ago

Nice, nice. Alright, well, looking forward to filter+priority outputs (would make main buses a LOT easier to sort. Heck, it would even basically render the belt-sorter mod obsolete too ;)

5 years ago

Had another question about how it works. I noticed it takes in from any side, will it also output to any side that has an outward belt? So you could have a single block split an incoming lane into three lanes?

5 years ago

exactly, it will output to every belt, underground-belt or splitter, that is facing away of the balancer.
And it will input from every belt, underground-belt or splitter, that is facing towards the balancer.

5 years ago

Alright. 100% adding this to my IR run. Fantastic. Thanks for all the answers. Might want to go update your description, get lots of downloads ;)

New response