A puzzler [buildcraft]

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
This is going to sound easy at first, but it's tricky...

I should have just recorded a quick video rather than try to explain it, but I'm at work now so this will have to do. I linked an earlier version of the room below for a visual reference, though it predates the XP fountain:


This concerns probability when running liquids and items split through pipes. It's easier to bypass this problem with emerald transport pipes, but they don't help with liquid.

There are two things I'm trying to do. Both of which revolve around splitting 1 source into 5 or 6 different outputs and getting the probability for each one of them to be equal. This is something that I THOUGHT I would be able to just pop in and experiment with but it's not that simple.

First off is a matrix of 6 furnaces coming off of my auto-sorter. I want it to separate the items I want it to auto-smelt, have it all go into one chest and then semi-evenly sorted out among the 6 furnaces. I could use an emerald pipe, but I still feel like there's a pattern I can make with regular pipes to get 6 outputs each with a 16.6% chance.

Second, you can see a few tanks on the wall next to the smelter full of liquid XP. Last night, I discovered that I could set it up like a fountain, with some additional tanks at the top, with XP shower heads always on, and an additional pump taking from the main tanks to keep a steady stream of 5 XP shower heads, all falling back down on the grates, refilling the original tanks (Which are all about 15 blocks high now).

It's a cool effect, but I was hoping I could find some similar pattern for the input grates that will also output from each tank randomly, with a 20% chance to output into each tank as the XP filters through the fountain. The hope being that the levels in each tank would fluctuate up and down slowly over time as the fountain flows, with each tank ultimately "trying" to reset itself back to an even amount.

I feel like this could be easily done with gates or something, but I want this to end up being a practical build. I want to reign in the math.

Anyone else got any ideas? Or could someone here maybe at least help me clarify the mechanics behind what object goes to which pipe, etc to see if it's even possible?
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
I guess a more accurate question is about the mechanics. If I have a pipe that has 2 outputs, does that give me 50/50 or is one side favored? If there are 3 outputs, is it 33/33/33 or is is 50/25/25 or something? I can't find this detailed data anywhere.


If it's the former, I think I might have the 6 output thing solved anyway: split onnce, 50/50, then off each split, split it 3 times, 16.6% probablity for each one.
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
This is going to sound easy at first, but it's tricky...

I should have just recorded a quick video rather than try to explain it, but I'm at work now so this will have to do. I linked an earlier version of the room below for a visual reference, though it predates the XP fountain:


This concerns probability when running liquids and items split through pipes. It's easier to bypass this problem with emerald transport pipes, but they don't help with liquid.

There are two things I'm trying to do. Both of which revolve around splitting 1 source into 5 or 6 different outputs and getting the probability for each one of them to be equal. This is something that I THOUGHT I would be able to just pop in and experiment with but it's not that simple.

First off is a matrix of 6 furnaces coming off of my auto-sorter. I want it to separate the items I want it to auto-smelt, have it all go into one chest and then semi-evenly sorted out among the 6 furnaces. I could use an emerald pipe, but I still feel like there's a pattern I can make with regular pipes to get 6 outputs each with a 16.6% chance.

Second, you can see a few tanks on the wall next to the smelter full of liquid XP. Last night, I discovered that I could set it up like a fountain, with some additional tanks at the top, with XP shower heads always on, and an additional pump taking from the main tanks to keep a steady stream of 5 XP shower heads, all falling back down on the grates, refilling the original tanks (Which are all about 15 blocks high now).

It's a cool effect, but I was hoping I could find some similar pattern for the input grates that will also output from each tank randomly, with a 20% chance to output into each tank as the XP filters through the fountain. The hope being that the levels in each tank would fluctuate up and down slowly over time as the fountain flows, with each tank ultimately "trying" to reset itself back to an even amount.

I feel like this could be easily done with gates or something, but I want this to end up being a practical build. I want to reign in the math.

Anyone else got any ideas? Or could someone here maybe at least help me clarify the mechanics behind what object goes to which pipe, etc to see if it's even possible?

tl;dr version? No. What you are asking does not exist within Buildcraft. You'll have to use either Thermal Dynamics or EnderIO to get the functionality you desire.
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
I have enderIO, but I'm still not convinced it can't be done even with basic buildcraft. It doesn't need to read anything, it just needs each output's probability to be even. This is more of a math problem than anything.
 

Pyure

Not Totally Useless
Aug 14, 2013
8,334
7,191
383
Waterloo, Ontario
I have enderIO, but I'm still not convinced it can't be done even with basic buildcraft. It doesn't need to read anything, it just needs each output's probability to be even. This is more of a math problem than anything.
I found it interesting. I've tinkered with pipe-probability in the past too.

Its really a knowledge-of-mechanics problem. You've identified the issue: you don't know how the "choice" works when a fork in buildcraft pipes is encountered. I just don't think you're likely to find a great answer to that unless @asiekierka pops on.

You don't even need the probability to be even. You just need to know what the probabilities are and adjust accordingly.

edit: fwiw, your answer is probably somewhere in here.
https://github.com/BuildCraft/BuildCraft/tree/8.0.x/common/buildcraft/transport/pipe
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
Yes, I agree. The biggest issue is the mechanics. And I still can't find a resource that spells it out.

Here's what I think and why, though:

What I have found is that it will pick a random output given the choices available. If that's the case, then the probablity *should* be 100/# of eligible outputs from each pipe, in which case, you'd think getting it to 20% each would be easy, but there are other issues, such as the amount of liquid you can pull out in the first place (this is mucks up the whole thing, too). Emerald pipes suck out 4x the amount that wood pipes do, and there are 5 tanks in this line. So, even if I could easily turn 5 inputs into 1 drum, then output that one drum and perfectly separate it to 5 tanks, my "shower" is outputting 5 mB/sec and my "filter", we'll call it, would still only be outputting 4, unless you can double it up from the same tank.

The main point there being that you're probably right, it would be much easier to adjust the fountain itself than it would be to make it work under these specific parameters.

But, I refuse to give in! lol..

If I'm right about my guess on the mechanics, this IS doable, but it'll be a challenge. I's have to split the 5 inputs into either 1 drum or two depending on whether or not you can pull from the same drum twice. Then split it back to 5, or to 5 twice over underneath the main tanks. But, there's a significant spacing problem as I'm doing this all at around y=6, which means I'll have to fight the bedrock for space or raise the whole thing accordingly.

I should really just start small scale with easier numbers to work with and see if the effect even works in the first place.
 

Pyure

Not Totally Useless
Aug 14, 2013
8,334
7,191
383
Waterloo, Ontario
Testing your theory about the mechanics is easily reproducable. 1 biggest-tank-you-can-find should pipe into a 5-way-output fork that each goes to a biggest-tank-you-can-find. Given a large enough sample size the individual output tanks should have approximately the same amount of fluid.
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
WAIT!

I got it. And it's actually super simple!

I don't need to convolute the INput. I need to adjust the shower tanks! I can continue pulling 1 mB per tank into a single drum hidden behind the wall, then output that via emerald pipe (at 4 mB per, compared to the 5 being put back into the main tanks, so no overflow) then output from that one single drum, through a single pipe, using non-connecting pipes to each of the 5 tanks, automatically giving me 20% per tank, back into the shower tanks.

This will slightly lower the flow, but it will also randomize it better.

This might actually work! I wanna go home and do it now, lol.

Edit: wait, no, that'll just continually overfill the interim tank... or will it just cap off and stop pumping? Edit: It'll stop pumping. This will actually work....


Final Edit, lol: I am still very much interested in any in-depth mechanics guides if anyone knows of any.
 
Last edited:

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
You're going to crash your server under the strain before you re-invent what is effectively round-robin logic using BC pipes. Best to simply use something actually built for it without bringing your server to its knees.

There is a way to average it out, yes, and because rand() is not truly random, you will eventually get an even distribution. It will, however, require so many iterations that it is best to not bother. There's a reason I used the tl;dr version instead of a multi-page dissertation into logic and balanced systems and the fallacy of the random number generator.

There is also a reason why I haven't used Buildcraft since 1.5. This is one of them.

In effect, you can use redstone logic, specifically an XAND gate and comparators to determine if the tanks are equal. From there, you need a recycling mechanism able to detect which one is the highball, to distribute among the others. Basically, bubble-sort logic. The highest gets clipped and redistributed.
 
Last edited:

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
You're going to crash your server under the strain before you re-invent what is effectively round-robin logic using BC pipes. Best to simply use something actually built for it without bringing your server to its knees.

There is a way to average it out, yes, and because rand() is not truly random, you will eventually get an even distribution. It will, however, require so many iterations that it is best to not bother. There's a reason I used the tl;dr version instead of a multi-page dissertation into logic and balanced systems and the fallacy of the random number generator.

There is also a reason why I haven't used Buildcraft since 1.5. This is one of them.

In effect, you can use redstone logic, specifically an XAND gate and comparators to determine if the tanks are equal. From there, you need a recycling mechanism able to detect which one is the highball, to distribute among the others. Basically, bubble-sort logic. The highest gets clipped and redistributed.


You have, no offense, missed the entire point of this exercise.

I appreciate the attempt to help, but that's not what I'm looking for. I found my solution, though.
 
  • Like
Reactions: Pyure

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
Spent about 18-20 hours on this so far and it's still not right! Lol

It's half way there. I can rain XP drops randomly and have it fill all 5 tanks evenly, whether I pump it in via a drum or letting it slowly trickle in from the mob juicers.

For the record, it does appear that I was right about how the pipes distribute liquids and I would assume items as well. A particle enters a pipe, and it has x number of valid options. It will randomly chose 1 of those directions with an equal chance of each. I suspect you could use this principle to calculate how to evenly distribute anything into any number of outputs you need.

But, making it loop properly is a different story. I'm trying to set up the 5 tanks to pump individually into the same tank, pumping faster than a second pump can send it up to the shower head. This regulates the flow so the wrong tanks don't overflow and the fountain can flow indefinitely.

The problem is, once you create that backlog, it doesn't give equal chance for each input when there's room in the tank. I actually can't even figure out the pattern here, except from the moment the interim tank is filled, the fate is sealed. Any given tank could steadily rise, or steadily drain and it stays that way until a tank inevitably drains completely, then at least 1 tank that was riding will start to drain, until there's just one tank left with all of it.

This is the exact opposite of what I'm trying to do! Lol. But I am still completely and utterly absolutely convinced there is a solution that will do exactly what I originally envisioned without cheating. I feel like I am seeing one thing wrong. Just one wire crossed somewhere. I am one breakthrough away from solving this thing. Practically and without breaking the server.

Ugh, it's like I see a flash of it, too. The solution is right there, I just need to get it to come into focus. ><
 

KingTriaxx

Forum Addict
Jul 27, 2013
4,266
1,333
184
Michigan
Oh, your problem probably isn't tanks. It's probably pipe capacity. You need an over flow tank capable of containing the excess so the system can't back log. Essentially with enough overhead flow that it's not going to fill that tank. It may require multiple outputs.
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
I was backlogging them on purpose, but it seems like it gets buggy when that happens. I've tried it with multiple interim tanks in every configuration I could imagine, capping out on a loop with 4 different tanks per cycle. It'll come to me, but I put it aside today. I'll use my idle time at work tomorrow to keep working on that one.


But every time I think I've got a grip on this mod, it throws me off again. I needed some supplies, so I took a break from the XP fountain thing to run a quarry, only now all of a sudden, I can't get enough pumps to keep the combustion engines cool without standing there watching it. I used to do 7 engines with 2 water pumps. Now, I can't get 9 engines with 3 pumps. And by my understanding, 1 should cover 4. I can't get it to keep up all of a sudden...

Though, I suppose I should just replace that whole setup with lava engines by now....
 

KingTriaxx

Forum Addict
Jul 27, 2013
4,266
1,333
184
Michigan
Pumps slowed down to ensure they only grabbed the fluid you want at some point. Instead, use gates for automation. Power requested provides a blue pipe wire signal on one gate running to the others, and those all turn on with a blue signal, but a red condition from the engine causes a red pipe wire signal, which the starting gate is looking to not have. (Make sure it's an AND gate.)
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
In terms of the XP hourglass/fountain whatever you wanna call it, it may be time to dip into the assembly table section of buildcraft which I haven't even messed with yet. But that issue was more of a mathematical one than a buildcraft issue. I still may well be misunderstanding some fundamental principle that makes it impossible to do what I want it to do. I feel like using gates will fall under "cheating" for the most part, but as long as I'm not actually measuring the amount of fluid from one tank to the next, like if I'm just using gates to regulate the flow or something, it may still count.

I may move on from that, though. It started off as just some thing to use to learn the mechanics. I have already come up with much more interesting practical applications for an XP "shower" that will make it so none of this really matters and any more time I spend on this experiment is just holding me back from the end game I have planned.

But, gates aren't the solution to my quarry issue. This USED to work just fine. I had a setup before where I could just walk away forever and this new design is based on that, only "improved", and now it's not working. it doesn't make any sense to me. Sometimes the pumps and/or redstone engines on the pumps just stop working. There's no water in the pipes, they just don't pump. Then, all of a sudden, they do. Whereas with the original design, they'd just stop pumping when everything is full and as soon as there's a need for more water, starts pumping again.

And then as of yesterday, it was even weirder, in that the pumps continued to pump like normal but simply couldn't keep up with the need, which I KNOW it should be able to. 1 water pump should be able to constantly cool 4 combustion engines. So 3 pumps should be able to handle 9 engines with no problems at all, but every time, as soon as they turn green, it starts running down the internal water supply and pumping regularly, but not fast enough to keep up. A full cycle lasts about a half a minecraft day because I'd get it set up to record a time lapse vid around dusk and I'd have to shut everything down for cooling by sunrise.

But, I digress. That's a different issue.
 

KingTriaxx

Forum Addict
Jul 27, 2013
4,266
1,333
184
Michigan
Redstone engines are a bit buggy at times. Try diverting a bit of your power from the quarry to the pumps. You've got enough, it shouldn't slow down the quarry much if at all.
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
Oh, I never even considered that. That's a good idea. I'm actually a little bit over the effective range anyway, so there's some energy just being wasted, and even if I had to dip in deeper, the difference would be borderline imperceptible.

Good call! Because I am OUT of diamonds, lol.
 

Drbretto

Popular Member
Mar 5, 2016
1,886
781
139
Though, now that I'm ender-pearl-capable, I really should just build an array of these: https://ftbwiki.org/Lava_Generator

And set it up with an ender tank in the nether. Now that I have the whole base automated, I don't need to push out maximum power. I should be able to just set up a quarry somewhere just running at all times and keep up with stock that way.

I just like the way it looks watching all the combustion and redstone engines running in a big complex machine... it's mesmerizing.
 

KingTriaxx

Forum Addict
Jul 27, 2013
4,266
1,333
184
Michigan
I'd have gone with Magmatic Dynamo's myself, since they can be power boosted, but they require Invar which is often a pain to get.
 

Celestialphoenix

Too Much Free Time
Nov 9, 2012
3,741
3,204
333
Tartarus.. I mean at work. Same thing really.
The hope being that the levels in each tank would fluctuate up and down slowly over time as the fountain flows, with each tank ultimately "trying" to reset itself back to an even amount.

If you're willing to cheat a little; have the tanks to fill/empty and use a separate feed for the shower/fountain effect. (this isn't the technical solution, rather a practical means to achieve those visual effects)

Put a gate on the pipe directly feeding the tank and set it to;
Tank empty= blue signal
Fluid in pipe= blue signal
Tank full=red signal​
As soon as the tank is empty, it'll turn on the supply feeding the tank. The fluid in the pipe keeps the filling signal on until the tank is full, when red can be used to shut it off.
You can then create the illusion of random filling/emptying by differing the flow rates through each individual tank, and sometimes having one tank empty into another.

Alternately a few pieces from RedPower may be useful; a randomiser, timer, and 2 toggle latches per tank. One latch controls filling, and the other emptying- using the randomiser to pulse the latches.
However the randomiser pulses rather quickly- so you won't see any real change in tank level, which is why you'll want the timer to activate the randomiser only occasionally. (say it takes 10 minutes to fill the tank from empty- you'll want a 2 minute count on the timer, so the randomiser has a chance to change the fluid level by 1/5th)