any way to 'load balance' items properly between 2 or more machines?

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

steve g

New Member
Jul 29, 2019
445
0
0
been scratching my head on this one for a bit and not sure how to go about it.

i need a setup where wood from a tree farm is *evenly* distributed between a couple of cyclic assemblers. the catch: the wood comes in stacks (up to 64) and i need those split up evenly.

dont say bc pipes, they pick destinations at random and they dont split stacks
dont say factorization routers, same thing..they dont split stacks

and it has to be fast...fast enough it wont vomit wood blocks all over the map. theres gotta be something that can do this...
 

Vicerious

New Member
Jul 29, 2019
63
0
1
Too bad, BC pipes are still the answer :p

Use wooden transport pipes powered by either redstone engines or autarchic gates it extract items from an inventory one at a time. If you need more speed, use multiple wooden pipes attached to the different faces of the source inventory and join their outputs to a single iron pipe. You can increase output speed further by either using multiple source inventories or transvector interfaces to attach more woodent pipes.

For example, if your source inventory is an ME interface set to export logs, you could attach up to 11 wooden transport pipes to it - 5 on the ME interface itself and 6 more on a transvector interface bound to it. You could then combine the outputs of those with 3 iron pipes into a single main line. You may want to use a diamond pipe to distribute to your machines as a sort of "reverse" iron pipe.

With a large number of items passing quickly through the system, random distribution is exactly the same as even distribution. If the probability to use any given output is the same between all outputs, it is even distribution for all practical purposes.
 

draeath

New Member
Jul 29, 2019
456
0
0
Random does not work that way. It will not be evenly distributed, because you can't have randomness and even distribution at the same time!

I'm interested in a proper answer to this one as well...
 

Loufmier

New Member
Jul 29, 2019
1,937
-1
0
i can't remember any round robin solutions but closest would be LP with supplier pipes.
you can also try installing additional buildcraft objects, which add distribution pipe, which splits passing through items in set proportions to set sides.
 

Vicerious

New Member
Jul 29, 2019
63
0
1
Of course random works that way. If you have 1000 items moving through a system with a 50% chance of ending up in one of two chests, each chest is going to end up containing very close to 500 items each, The more items that pass through, the closer the numbers get to perfect. The margin of error will get vanishingly small after processing only a few dozen stacks of materials.

This is math. For any practical purpose, for a large number of items, random distribution (where all chances are equal, as in the outputs of a diamond pipe) is the same as even distribution.
 

Loufmier

New Member
Jul 29, 2019
1,937
-1
0
Of course random works that way. If you have 1000 items moving through a system with a 50% chance of ending up in one of two chests, each chest is going to end up containing very close to 500 items each, The more items that pass through, the closer the numbers get to perfect. The margin of error will get vanishingly small after processing only a few dozen stacks of materials.

This is math. For any practical purpose, for a large number of items, random distribution (where all chances are equal, as in the outputs of a diamond pipe) is the same as even distribution.
random blows. period. even if it`s 50/50.
 

Vicerious

New Member
Jul 29, 2019
63
0
1
Which is why I made a point of talking about practical purposes and margins of error. With the high volume output of a sizeable tree farm, for example. you'll get to "close enough" even distribution fairly quickly.

But if the distribution of items must be absolutely even at all times, then another solution is necessary.
 
  • Like
Reactions: TaintedHorizon

MigukNamja

New Member
Jul 29, 2019
2,202
0
0
Brute-force would be a turtle.

Code:
-- above
function place_1()
  turtle.dropUp()
end
 
-- below
function place_2()
  turtle.dropDown()
end
 
-- left
function place_3()
  turtle.turnLeft()
  turtle.drop()
  turtle.turnRight()
end
 
-- right
function place_4()
  turtle.turnRight()
  turtle.drop()
  turtle.turnLeft()
end
 
-- behind
function place_5()
  turtle.turnRight()
  turtle.turnRight()
  turtle.drop()
  turtle.turnLeft()
  turtle.turnLeft()
end
 
args = {...}
while 1 do
  for i=1,args[1] do
 
    while not turtle.suck() do
      sleep(1)
    end

    if i == 1 then
      place_1()
    elseif i == 2 then
      place_2()
    elseif i == 3 then
      place_3()
    elseif i == 4 then
      place_4()
    elseif i == 5 then
      place_5()
    end
  end
end

The above Lua code is not tested. But, it gives a very good idea of how you could use a turtle with 1 input container and up to 5 output containers in a round-robin fashion.
 

Shirkit

New Member
Jul 29, 2019
189
0
0
Something to consider VIcerious... you know for a fact Minecraft is not using a true RNG. Most people don't have the thousands of dollars those cost just laying around.

Minecraft is using a pRNG, which will not produce random numbers.

Thus, even distribution is not guaranteed or even that likely. In fact over time the distribution may get worse!

This has no impact or whatsoever, since pseudo random numbers, in practical terms, will be output random results. Once you guarantee that different seeds feeds this algorithm, you'll be ok.

The result from the pRNG and a real random algorithm will tend to closeness, which is enough for every day applications.

If you need to guarantee even distribution, just use a round robin pipe, no need for randomness.

But as said, if you have a really large input of items, and you are just smelting stuff, you can go by with regular pipes. Sometimes items may spit out, just put a 2 or 3 layer depth of distribution and your problems should be solved.
 

Shirkit

New Member
Jul 29, 2019
189
0
0
Would give the same result as the BC pipes. It goes randomly, so for an infinite amount of items it will be even, but besides that, it won't. The maximum discrepancy I've noticed using pipes was a surplus of 10 items in the other side.
 

Skullywag

New Member
Jul 29, 2019
217
0
0
Wait for Thermal Expansion 3:


;)

Edit - also doesnt Additional Buildcraft Objects have a round robin pipe.
 

Wekmor

New Member
Jul 29, 2019
939
0
1
Would give the same result as the BC pipes. It goes randomly, so for an infinite amount of items it will be even, but besides that, it won't. The maximum discrepancy I've noticed using pipes was a surplus of 10 items in the other side.

Yeah I just realised it, I always thought they would distribute evenly tho :O
 

zilvarwolf

New Member
Jul 29, 2019
541
0
0
I haven't messed with the cyclic assemblers much, and, of course, am not sure of how your project is working or how fast they operate, but maybe you could use translocators in the mode that keeps a certain number of items in the receiving side? Say...10, or whatever. That way those resources will be kept at a static level and then replenished as used. Even distribution might be more maintainable that way?
 

SynfulChaot

New Member
Jul 29, 2019
599
0
0
IIRC, there are round-robin pipes from Additional Buildcraft Objects if you're running DW20's FTB pack. That should do exactly what you want.
 

zilvarwolf

New Member
Jul 29, 2019
541
0
0
I tested the translocator idea last night. Again...not sure of your setup or if it's applicable, but the diamond nugget modifier (it was mentioned in DW's mod spotlight, but I didn't see it on the translocators website) allows you to put them into supplier mode. Without knowing more particulars or testing it, that might handle your even distribution problem.
 

angelnc

New Member
Jul 29, 2019
232
0
0
I tested the translocator idea last night. Again...not sure of your setup or if it's applicable, but the diamond nugget modifier (it was mentioned in DW's mod spotlight, but I didn't see it on the translocators website) allows you to put them into supplier mode. Without knowing more particulars or testing it, that might handle your even distribution problem.

I think Translocators always distribute evenly if there are multiple outputs. The Diamond Nugget is only there to put it in supply mode.
 

Golrith

Over-Achiever
Trusted User
Nov 11, 2012
3,834
2,137
248
I'd say Translocators. Use one for each machine, and tell it to always keep a certain amount of stock in the machine. Then it's all down to the speed of the machine if it splits evenly.
Seriously though, I can think of no need to ensure an unlimited supply of a material is always split to an exact level.