Page 1 of 1

Question concerning finite liquids

Posted: Tue Feb 26, 2013 4:50 pm
by JakeZKAM
Recently I thought of an interesting add on concerning potions after posting something about the system in off topic and seeing the cistern based one but it still didn't hit home. So I thought for awhile and possibly inspired myself into making an add on but I'd like to just check that I'm not getting in over my head before I try.

So I have a couple questions, 1. How difficult is it to code finite liquids into mine craft? Say you could build liquid resistant vats to contain it (made of glass/smooth stone or possibly other materials) and if it wasn't contained have it spill out and seep into the ground? In other words no source block, more like terraria water physics than mine craft.
2. If I could accomplish this task how much of a burden would multiple new types of liquids be on the game/how many block IDs would it take?
3. With finite water physics could water pressure also be accomplished without too many difficulties?

Thank you for any answers and while these parts wouldn't be the first things I'd try making in the add on, it's kind of the big part of it.

Re: Question concerning finite liquids

Posted: Tue Feb 26, 2013 5:20 pm
by FlowerChild
It's manageable, but I wouldn't expect such a mod to run well in SMP.

The problem with finite liquids is that they can require a huge number of block updates while transitioning state (as in, water moving around). Those block updates translate into network packets. Hence why MC water behaves the way it does.

As I joked in the IRC the other night, with finite liquid, the steps to bring down a server are as follows:

Step 1: Dig a hole into a lake.

Step 2: Laugh.

Re: Question concerning finite liquids

Posted: Tue Feb 26, 2013 5:23 pm
by Ulfengaard
I've only seen one mod do this, and it was extremely CPU-intensive when the liquid was moving. So, I think one of your challenges would be finding the most efficient way to handle those calculations/updates.

Water pressure would have to happen anyway, even if it was only a very simple model, because you'd need a method for driving water from one block to the next in order to make the liquid 'finite'.

EDIT: Yeah, it's pretty intense. It's just a lot of CPU-work. Dwarf Fortress has a very visible drop in FPS when I fill my moat. I usually end up looking forward to having the moat filled and over with.

Re: Question concerning finite liquids

Posted: Tue Feb 26, 2013 5:33 pm
by JakeZKAM
Thank you very much for the quick replies :-). Yeah if it's going to slow down the game too much I think I'll try to find an alternate system but I'll see about giving it a shot before giving up completely. And FC, are there any hooks in the screw pump code to try and make it work with liquids other than water?

Re: Question concerning finite liquids

Posted: Tue Feb 26, 2013 5:45 pm
by Sarudak
If the finite liquid were a player-made liquid that is very difficult to make in large quantity then you wouldn't have to concern yourself with the potential performance problems so much.

Re: Question concerning finite liquids

Posted: Tue Feb 26, 2013 5:56 pm
by JakeZKAM
Sarudak wrote:If the finite liquid were a player-made liquid that is very difficult to make in large quantity then you wouldn't have to concern yourself with the potential performance problems so much.
Player made liquid yes, small amounts erm, depends on what would be considered small. While it would nowhere be close to an ocean it's safe to assume you want a lot of it. I'd want to promote storing potions in player made vats rather than stuck in a bottle and stored in a chest. Then transporting them to different stations to add/subtract various effects. Basically a massive potion brewing/filtering/storage center.

Re: Question concerning finite liquids

Posted: Tue Feb 26, 2013 6:04 pm
by FlowerChild
JakeZKAM wrote:And FC, are there any hooks in the screw pump code to try and make it work with liquids other than water?
Nope.

Re: Question concerning finite liquids

Posted: Wed Feb 27, 2013 1:59 pm
by DNoved1
Hmm, sounds like a similar idea I had a while back on creating a "boiling water" block. I definitely like the idea of assigning an entire building to the task of brewing and storing potions as well. Also, as far as how many block IDs you will be needing, it should only be one, though that one will likely need a tile entity so that it can keep track of what exactly it contains, or anything else you may want to track such as temperature or quantities of liquid that aren't exactly 125 liters.

Re: Question concerning finite liquids

Posted: Wed Feb 27, 2013 2:30 pm
by FlowerChild
DNoved1 wrote:Hmm, sounds like a similar idea I had a while back on creating a "boiling water" block. I definitely like the idea of assigning an entire building to the task of brewing and storing potions as well. Also, as far as how many block IDs you will be needing, it should only be one, though that one will likely need a tile entity so that it can keep track of what exactly it contains, or anything else you may want to track such as temperature or quantities of liquid that aren't exactly 125 liters.
If you go that route, you have to be *very* careful about the number of them that will possibly be created. Like, I'm fairly certain assigning a tile entity to all water blocks in a world would bring MC to its knees.

Re: Question concerning finite liquids

Posted: Wed Feb 27, 2013 2:34 pm
by DNoved1
Well, the idea I had regarding boiling water back then wasn't so much to assign a tile entity to water itself, but rather have water check every once in a while for a heat source below it, such as fire of lava. If so, it converts into a "boiling water" block, which itself has a tile entity. Thus, it would avoid the computational problems of having large sections of your world updating every tick.

Re: Question concerning finite liquids

Posted: Wed Feb 27, 2013 4:50 pm
by Mason11987
DNoved1 wrote:Well, the idea I had regarding boiling water back then wasn't so much to assign a tile entity to water itself, but rather have water check every once in a while for a heat source below it, such as fire of lava. If so, it converts into a "boiling water" block, which itself has a tile entity. Thus, it would avoid the computational problems of having large sections of your world updating every tick.
If something like this is done I'd recommend having this check just happen at block update. Being near an ocean where every block was (even rarely) checking it's surroundings seems like an issue, but having every water block that is has a neighbor update is unlikely to cause many problems.

The idea of boiling water is definitely interesting to me though.

Re: Question concerning finite liquids

Posted: Wed Feb 27, 2013 4:57 pm
by JakeZKAM
DNoved1 wrote:Hmm, sounds like a similar idea I had a while back on creating a "boiling water" block. I definitely like the idea of assigning an entire building to the task of brewing and storing potions as well. Also, as far as how many block IDs you will be needing, it should only be one, though that one will likely need a tile entity so that it can keep track of what exactly it contains, or anything else you may want to track such as temperature or quantities of liquid that aren't exactly 125 liters.
I'm hoping to incorporate something like boiling water in the system as well but less of a block and more to help with filtering out side effects in potions. The main potion system I was hoping to accomplish was the initial brewing input that moves on to a filtering complex to either add better effects, or process it to refine/remove others. Then promoting storage in hand made vats rather than simply bottling them up and storing them in a bunch of chests.

Re: Question concerning finite liquids

Posted: Sun Mar 03, 2013 11:47 am
by mazer246
I remember a mod which did this very nicely and little CPU lag (from what I rememeber, I played on a puny laptop back then) I think what helped lots was that the mod only converted reasonably small bodies of water into finite liquid while oceans and large lakes remained infinite. It was pretty cool seeing as you had to build water towers to water your crops instead of just placing one spring source.

Re: Question concerning finite liquids

Posted: Sun Mar 03, 2013 8:42 pm
by Utterbob
I can't comment on it directly as I still haven't had the time to look through MC's code (as much as modding it is of interest). That said you might find some clues in BtB if you still have a copy around (I still have mine but since it's not avaliable for public D/L anymore I hesitate to share it without permission).

It had some very interesting liquid moving mechanics that would simulate what your are trying to do and it was also finite (though the vMC rule of having a 2 source blocks next to an air block with a solid under still produced a new source block). It also managed it without to much of a performance hit.

BtB was before the 1.3 rewrite fun-and-games but still, might help. Also BtB or just plain Buildcraft might offer insights with storage, since BC converts water to a finite amount, once its in pipes/devices, that need various amounts of storage space.

Can't answer the physics question so I won't try but if that does turn out to be a problem you could always add a block to achieve the functionality, design the block so that its use, look and placement make it feel like preasure is a factor.

Just my 2c, wish I could be more specific about it code terms, sounds like a really interesting project!

Re: Question concerning finite liquids

Posted: Mon Mar 04, 2013 5:09 pm
by JakeZKAM
From what everyone has told me so far the main issue on CPU drag would be lots and lots of updates to the blocks in order to keep them balanced. But this is using water as an example, what if I used a liquid that was slower moving, more similar to the speed that lava moves but still finite, could that resolve some of the lag issues in theory?