Handling Liquids | Techniques

Any system (Inform, ZILF, Adventuron etc).

Is there a general “best practice” for handling liquid and liquid levels in game?

For example if the player fills a bottle and then drinks water from the bottle, should it (for example) reduce by a quarter such that when you examine the bottle it says “the bottle is three quarters full” and reduce/describe by a further quarter each additional “drink”?

If you elect to pour water on the floor, should the assumption be that the entire bottle empties unless otherwise specified?

Should the floor remain wet if examined for 20 turns etc?

Thoughts?

Adam :slightly_smiling_face:

1 Like

In a similar vein, what if you jump into a pool or ocean or stomp a puddle?

Interesting thread.

1 Like

The usual “best practice” is to not implement any of that stuff. Because (a) it’s a lot of work; (b) most stories are not about watching puddles dry, so they gain no real benefit from all that work.

Even in Hadean Lands, a game entirely about mixing chemicals, I didn’t implement any of the features you describe. No partially-full containers, no slow-drying liquids. If you jump into a pool, some of your items get wet and a couple dissolve, but these are immediate and complete state changes.

Now, if your story does centrally involve those sorts of interactions, you can make Inform (at least) support them. There are libraries and sample code out there. But I don’t expect them to work in IF games in general.

7 Likes

Savoir Faire by Emily Short has slowly evaporating puddles, though they are not of consequence to the puzzles as far as I know. More a cool bit of simulation.

In general, my expectations for pouring water would be that the bottle is empty afterwards, and for drinking that I get an “Aah, refreshing”-response without any change in the water level.

If you implemented a more thorough simulation, I would probably notice and go “Huh, cool!” I doubt if that player response would be worth going through the trouble of coding the liquid simulation though.

Of course, all sorts of nifty puzzles can be designed around liquid measuring and manipulating. For world simulation alone though, I probably wouldn’t bother.

For swimming or diving, I have had a few laughs with games that let you do this while carrying non-water-resistant stuff like flour. Maybe provide a water-resistant carry-all or force the PC to undress first?

2 Likes

Yes, I must admit that I like to see this. It just makes the whole thing feel more like a fleshed out world when the implementation goes to that level.

Don’t get me wrong, it’s a lot of work particularly if it doesn’t exist to support a puzzle or other challenge to be resolved. Nevertheless I like to see it.

Adam

2 Likes

My test for implementing something complicated like specific liquid mixing and measuring is “Will this be fun for the player?”

The answer may differ based on the game type. If the protagonist is an alchemist who is precisely measuring ingredients to create specific spell effects, this might be warranted and potentially fun.

In my personal experience, the novelty of a complicated system more often than not hits the problem where the player knows what they need to do and want to do, and they end up fighting with and becoming frustrated by the technical intricacies of the system. You don’t want to put the player in the situation of having solved the puzzle but unable to progress because the system needs them to interact in an unnatural way like INSERT MEDIUM COG BELOW LARGE COG. MESH TEETH OF LARGE COG WITH SMALL COG…

I have learned that you always want to be on the player’s side as opposed to working against them. If they have all the components they need to solve the puzzle, an author shortcut will prevent them from getting stuck and carrying out the dreaded ragequit.

For example - if I have a safe with a combination lock, I can implement spinning the dial to numbers, and keep track of the sequence and let the player do it wrong multiple times, or I can just print a message “You don’t know the combination.” until the player finds the scrap of paper with the code. When they have the scrap and interact with the safe, it just opens normally with a message “The combination on the scrap of paper works!”

TL;DR - if something is ridiculously complicated, err on the side of telling the story and narrating the difficult parts instead of placing potential obstacles that require lots of testing and troubleshooting in the player’s way.

6 Likes

Could you time-teleport to the early eighties and tell them this? It would help solving some puzzle-romps from that age.

I believe some game-creators had a much more inimical relation to their players then.

1 Like

I understand what you’re saying, but back in the 80s they were selling these games as full experiences, so often their mindset was to make them last longer by being difficult. IF player’s tastes have evolved since then…but I’ll get to work on that time machine if it will help!

>MAKE TIME MACHINE

You'll need need a flux capacitor, a DeLorean automobile, some uranium, and the plans from Doc Brown to do that.

Ugh. I’ll be back after some exploring.

2 Likes

Here’s how I decide what level of simulation to implement: I JUST DO WHATEVER I WANT.

Section 1 - Thirst

Lane has a number called thirst. The thirst of Lane is 10.

Every turn while the player is Lane:
	If the thirst of Lane is greater than 0:
		decrement the thirst of Lane;
		if the thirst of Lane is 0:
			say "[one of]You're already thirsty again[or]Gosh, you're thirsty[or]You smack your lips. You are thirsty[or]Good grief, it is hotter than heck. And you are thirster than heck.[paragraph break]No, [italic type]thirstier[roman type][as decreasingly likely outcomes].";

If you scroll all the way to the end of that line, there’s a joke where the narrator accidentally says “thirster” instead of “thirstier.” What a strange joke! Huh!

Section 2 - Water Bottle

Lane carries the water bottle.

The water bottle has a number called fullness. The fullness of the water bottle is 0.

Instead of giving the water bottle to Nathalie:
	if the fullness of the water bottle is 0:
		run a conversation from Nat4;
	otherwise:
		say "There's still some water in that bottle! Finish it off before you ask Nathalie for another one."

“Running a conversation from Nat4” involves changing the fullness of the water bottle to the maximum of 10, but the text says that she’s giving you an entirely new bottle.

Here we have a bunch of rules that prevent the water bottle from leaving your inventory. This just simplifies things for me so I don’t have to like, write a conversation where you ask for a new water bottle and Nathalie asks “what happened to the one you had?” or something like that.

Instead of dropping the water bottle, say "[if the fullness of the water bottle is 0]You're supposed to give Nathalie your empty bottles[otherwise]This water is the only thing keeping you going. It would be madness to leave it here[end if]."

Instead of inserting the water bottle into something, try dropping the water bottle.

Instead of putting the water bottle on something, try dropping the water bottle.

Instead of examining the water bottle:
	if the fullness of the water bottle is 0:
		say "Your water bottle is empty. It's not a good feeling.";
	otherwise if the fullness of the water bottle is less than 3:
		say "Your bottle is almost empty. Hopefully Nathalie will give you a full one.";
	otherwise if the fullness of the water bottle is less than 10:
		say "There's still plenty of water left in your bottle. For now.";
	otherwise:
		say "A full water bottle is a welcome sight, but only because you plan to make it stop being full."

Okay, so, here we’re going to see that “OPEN WATER BOTTLE” and “DRINK WATER BOTTLE” are two different routines, and I don’t know why that is, so let’s see if we can figure it out together.

There’s some randomness to how much water you drink with a given drinking-attempt. I think I started out by writing a bunch of random drinking messages—“you gulp down a bunch of water,” “you take a little sip,” etc—but I realized this would create weird situations if little sips and big gulps emptied the bottle at the same rate. So the text is tied to how much water gets drunk, and it’s impossible to take a big gulp when there’s only a little sip left.

Instead of opening the water bottle:
	if the fullness of the water bottle is greater than 2 and a random chance of 1 in 3 succeeds:
		now the fullness of the water bottle is the fullness of the water bottle minus 3;
		now the thirst of Lane is the thirst of Lane plus 6;
		if the fullness of the water bottle is less than 0:
			now the fullness of the water bottle is 0;
		if the fullness of the water bottle is 0:
			say "You open up your water bottle and take one last long gulp. Now it's empty.";
		otherwise:
			say "You open the bottle. You raise the bottle to your lips and, forgetting yourself for a moment, you chug down an unladylike gulp.[paragraph break]But it's so satisfying.[paragraph break]You put the lid back on the bottle.";
	otherwise if the fullness of the water bottle is greater than 1 and a random chance of 1 in 2 succeeds:
		now the fullness of the water bottle is the fullness of the water bottle minus 2;
		now the thirst of Lane is the thirst of Lane plus 4;
		if the fullness of the water bottle is less than 0:
			now the fullness of the water bottle is 0;
		if the fullness of the water bottle is 0:
			say "You open your bottle and take another drink. Now it's empty.";
		otherwise:
			say "You open your bottle and take a drink. The water doesn't stay cold for long, but it's refreshing nonetheless.[paragraph break]You screw the lid back on.";
	otherwise if the fullness of the water bottle is greater than 0:
		now the fullness of the water bottle is the fullness of the water bottle minus 1;
		now the thirst of Lane is the thirst of Lane plus 2;
		if the fullness of the water bottle is less than 0: [yeah, uh, this can't happen]
			now the fullness of the water bottle is 0;
		if the fullness of the water bottle is 0:
			say "You open your water bottle and drink down the last mouthful. Delicious.";
		otherwise:
			say "You open your water bottle and take a meek little sip. Then you screw the lid back on.";
	otherwise:
		say "The bottle feels too light as you reach for the lid.[paragraph break]Oh, it's empty. That's no good."
		
Instead of closing the water bottle, say "You always leave the lid on, to avoid the risk of spilling."

OH, I get it now! See, the “DRINK WATER BOTTLE” logic below is exactly the same as the “OPEN WATER BOTTLE” logic above, but the text is different:

Instead of drinking the water bottle:
	if the fullness of the water bottle is greater than 2 and a random chance of 1 in 3 succeeds:
		now the fullness of the water bottle is the fullness of the water bottle minus 3;
		now the thirst of Lane is the thirst of Lane plus 6;
		if the fullness of the water bottle is less than 0:
			now the fullness of the water bottle is 0;
		if the fullness of the water bottle is 0:
			say "You take one last long gulp from your water bottle. Now it's empty.";
		otherwise:
			say "You raise the bottle to your lips and, forgetting yourself for a moment, you chug down an unladylike gulp.[paragraph break]But it's so satisfying.";
	otherwise if the fullness of the water bottle is greater than 1 and a random chance of 1 in 2 succeeds:
		now the fullness of the water bottle is the fullness of the water bottle minus 2;
		now the thirst of Lane is the thirst of Lane plus 4;
		if the fullness of the water bottle is less than 0:
			now the fullness of the water bottle is 0;
		if the fullness of the water bottle is 0:
			say "You take another drink, emptying your water bottle.";
		otherwise:
			say "You take a drink from your water bottle. The water doesn't stay cold for long, but it's refreshing nonetheless.";
	otherwise if the fullness of the water bottle is greater than 0:
		now the fullness of the water bottle is the fullness of the water bottle minus 1;
		now the thirst of Lane is the thirst of Lane plus 2;
		if the fullness of the water bottle is less than 0: [yeah, uh, this can't happen]
			now the fullness of the water bottle is 0;
		if the fullness of the water bottle is 0:
			say "You drink down the last mouthful from your water bottle.";
		otherwise:
			say "You take a meek little sip from your water bottle.";
	otherwise:
		say "The bottle feels too light.[paragraph break]Oh, it's empty. That's no good."

If you type in “DRINK WATER BOTTLE” then the narration doesn’t mention anything about messing with the lid of the bottle. If you type in “OPEN WATER BOTTLE” then the narration says stuff like “You open the bottle and drink…” to respect the player’s literal input as well as the player’s implied intention. The fiddliness of bottlecaps did not appeal to me (even if the fiddliness of sip-volume obviously did) but I didn’t want to respond to “OPEN WATER BOTTLE” with something like “Hey don’t worry about opening it, just drink the water” when I could save the player some time.

A Rope of Chalk is in many ways a game about drinking water, so it made sense to implement the drinking of water in this much detail, although it has no practical effect beyond staving off messages about how thirsty you are. But a system like this would not be out of place in any game about being outside on a hot day, even one in which the elemental power of water is not a vital thematic concern.

4 Likes

For example if the player fills a bottle and then…

Red Alert! right there.

Oh boy, am i gonna have fun with this! First thing, I’m going to fill every single container i have with water. Then I’m going to try emptying some and see if things get wet. Then I’m going to try pouring water from one container to another. Do containers have different capacity? Then I’m going to try doing those water-jug pouring puzzles to make some prime numbers. Then I’ll try putting things in the containers not completely full of water; mud, gravy, very small rocks. Gosh, i hope they float or things dissolve.

Then I’m going to try putting water on fires or flames, throwing it over people, making surfaces slippery etc.

DO all containers hold water. what about my pocket, my bag, my hat etc.

If i get to mix things with water, I’m going to mix in one bottle, then pour into another bottle (already with plain water) then see if i can unmix the water.

If, for example, my hat doesn’t hold water. I’m going to put the hat in another container (eg a tin bath) then pour water from a bottle into the hat and see if it moves out into the bath.

what larks!

And if any of this fails, i’m going to contact the game developer and complain… :slight_smile:

5 Likes

Ah, the joys of playtesting! Give me a rope, a liquid and a container and I’m a happy tester. (Throw in a slingshot and I’m extatic.)

Edit; Ooh, ooh, and some powdery substance like flour!

1 Like

Haha - me too, I just can’t help myself! And when the game recognises this and allows it, or at least makes a decent stab at it, I really appreciate it. AND I appreciate it in isolation to whether or not it adds to the game in other ways i.e puzzles, problem solving etc

Adam

1 Like

Consider yourself engaged as beta-tester on my next game, which contains most of those things! :slight_smile:

3 Likes

On the wet floor, depends on climate… and there’s legions of puzzles about frozen floor :wink:
turning a basketball field into a ice rink is, to say the least, a very interesting idea…

aside that a wet floor is one of the component of the classical solution of the “deactivating evil robot(s)” puzzle, the other being electricity…

Best regards from Italy,
dott. Piergiorgio.

2 Likes

I think the short answer is “no”. However, it depends on the game. As everyone knows, a liquid is one of the most difficult things to model in an adventure. My recommendation is to keep it simple, both for your own sanity and for the player’s sanity.

As has already been pointed out by others, if you model a liquid in such a way that it replicates real-world physics, you’re asking for trouble. You must be consistent throughout the entire game. And your players will most likely be confronted with a guess-the-verb nightmare as they try to work out how to deal with liquids.

1 Like

I understand that, but in my D&D games, the players quickly learn to fill a breakable container with lamp oil to build a Molotov cocktail to throw. Now there’s a nice thing to add.
-abc

2 Likes