Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dealing with liquids

17 views
Skip to first unread message

Pontus Wickholm

unread,
Sep 10, 2000, 7:44:02 AM9/10/00
to
How would you go about dealing with liquids in a text adventure game? Would
you allow the player to mix different kinds of liquids and let him/her
create new kinds of liquids? And how would the actual 'mixing' be done? If
the player types 'pour wine from goblet into chalice' should the entire
contents of the goblet be emptied into the chalice (assuming the goblet is
smaller than the chalice) or only a part thereof? Do you know of any game
where this has been done?


Neil Cerutti

unread,
Sep 10, 2000, 11:27:35 AM9/10/00
to
On pontus_...@hotmail.com posted:

>How would you go about dealing with liquids in a text adventure
>game?

Very carefully.

>Would you allow the player to mix different kinds of liquids and
>let him/her create new kinds of liquids?

Probably not, except for a "few". In other words, allow as much
mixing as you feel like coding.

>And how would the actual 'mixing' be done?

Simply remove the two old liquid objects and replace with the new
one.

>If the player types 'pour wine from goblet into chalice' should
>the entire contents of the goblet be emptied into the chalice
>(assuming the goblet is smaller than the chalice) or only a part
>thereof?

That's up to you. You can code it to divide quite a lot.
"Infinite" is probably more trouble than it's worth. Make up a
limitation and code to it.

>Do you know of any game where this has been done?

No mixing, but there's "ToxiCola(tm)" and "liquid nitrogen" in
the Inform Port of Ditch Day Drifter.

<http://homepages.together.net/~cerutti/ditchday/surface.html#(1.10.1.2)>

The ToxiCola is an example of an *extremely* limited liquid. It
can be carried in the cup or drank.

<http://homepages.together.net/~cerutti/ditchday/surface.html#(F)>

The liquid nitrogen is an example of a *quite* limited liquid. It
can be carried in either of two containers, poured from container
to container, poured into various things, and makes something
explode.

The point is, in Inform, liquid is not in the world model. You
have to write all the code from scratch. I don't believe there is
liquid in TADS either, or HUGO, etc... So, liquid can do whatever
you code it to do.

I believe that "Dangerous Curves" implements liquid mixing. I
don't know if the source code is available.

--
Neil Cerutti <cer...@together.net>
<http://homepages.together.net/~cerutti/>

Joshua Wise

unread,
Sep 10, 2000, 12:36:41 PM9/10/00
to

"Pontus Wickholm" <pontus_...@hotmail.com> wrote in message
news:6uKu5.88$F5.1...@newsb.telia.net...

> How would you go about dealing with liquids in a text adventure game?

Sparingly.

>Would
> you allow the player to mix different kinds of liquids and let him/her
> create new kinds of liquids?
> And how would the actual 'mixing' be done?

If you can come up with a simple code for this (and it should be able to be
done simply, but you'll probably have a lot of streamlining before it
actually works out that way) it shouldn't be so bad.
I would create an attribute of mixable, and allow things to be mixed only
with other objects with mixable.
Like this:

Object Red_Potion "red potion"
with name "red" "potion",
description
"A luminous red liquid.",
before
[; Mix: if (second==Blue_Potion) {move Purple_Potion to Player; remove
Blue_Potion; remove self;}],
has mixable;

Verb "mix" * noun "with" second ->Mix;

[MixSub;
if (noun hasnt mixable||second hasnt mixable) {"At least one of those is
not mixable.";}
else {}];

Granted, I would revamp this code a bit to tell the player exactly which of
the two wasn't mixable, but that is a generally easy way to deal with this.

>If
> the player types 'pour wine from goblet into chalice' should the entire
> contents of the goblet be emptied into the chalice (assuming the goblet is
> smaller than the chalice) or only a part thereof?

You could add to this code somthing like this:

Object Blue_Potion
with name "blue" "potion",
description
"A dark azure liquid.",
amount 4,
has mixable;
!with code for mixing added.

amount 4, would be the number of "doses" in the potion. You could then
ammend the "drink" and "pour" (and even "mix") commands like so

Extend "drink" first
* "half" "of" noun ->DrinkHalf
* "part" "of" noun ->DrinkPart
* "all" "of" noun ->DrinkAll;

[DrinkHalfSub;
if (noun.amount>1) {noun.amount==noun.amount/2; "You drink half of the
potion.";}
else "You can't drink half, for there is only a very little left.";}];

[DrinkPartSub;
if (noun.amount>1) {noun.amount==noun.amount--; "You drink only a small
portion of the potion.";}
else "You can't drink just part, for there is only a very little left.";}],

[DrinkAllSub;
noun.amount=0; "You drink all of the potion.";}];

You could then have a before routine to make the potion do something.

before
[; Drink: give Player invisibility; StarDaemon(self);]

In such a case you might want to create a timer or daemon to time how long
the effects will last. You might even have the length of the effects depend
on how much the Player drinks.

To do the pouring and mixing, you can simply deduct parts from the potions
mixing, and add them to the potion being created. This leads into the
sticky area of percentages (red-purple, purble, and blue-purple potions.)
And I leave that up to you.

Do you know of any game
> where this has been done?

Not one that's been published, though I did something much more clumsy than
what I've shown you here, in a game I never published.

(actually, as a defense, a few of the games that I have advertised from time
to time on the newsgroups were lost in a computer crash, and were left to
die after that. It was not a matter of laziness...;o) ).

Well, I hope that helps a bit,
Joshua Wise


Jon Ingold

unread,
Sep 10, 2000, 3:08:05 PM9/10/00
to

Pontus Wickholm <pontus_...@hotmail.com> wrote in message
news:6uKu5.88$F5.1...@newsb.telia.net...

"Mulldoon" and "Christminster " both have liquid handling. Each can handle
mixing - Mulldoon also keeps track of the amount in every container.

Jon


Stefano Gaburri

unread,
Sep 11, 2000, 8:19:19 AM9/11/00
to

Neil Cerutti wrote:

> Simply remove the two old liquid objects and replace with the new
> one.

If you want to hurt yourself, you could define each liquid as containing some percentage of
"reagents" (which will be hidden of course, not known to the player). Mixing them in a bowl or
whatever, you could take track of the relative percentages and produce the final liquid (healing
potion!) Only when they are in a certain range, according to some kind of formula found elsewhere in
the game (and of course, shadowy written in cryptic alchemic references).
Of course the whole lab would spectacularly explode in a number of cases, to discourage trial and
error :)

If you REALLY want to do yourself great harm, you could introduce stechiometric reactions that alter
the percentage of the reagents and/or produce new ones. But it's completely pointless if the player
cannot "see" them.

mmmh, I wonder if I just said something sensible...
bah

whatever

later,
S

ical...@my-deja.com

unread,
Sep 11, 2000, 11:11:17 AM9/11/00
to
In article <slrn8rnab8...@horpner.together.net>,

cer...@together.net wrote:
> On pontus_...@hotmail.com posted:
> >How would you go about dealing with liquids in a text adventure
> >game?
>
> I believe that "Dangerous Curves" implements liquid mixing. I
> don't know if the source code is available.

Not really. DC does allow you to put a small object (like a dollar
bill) in the shot glass and then pour a drink in, but it doesn't
allow mixing of liquids. If you try to pour gin into a glass of
vodka, you get the message, "You'll have to empty your shot glass
first" and if you try to pour the vodka into the bottle of gin, the
bartender will grab the bottle and ask "What's the matter with you,
anyway?" You can also pour a liquid out of its container onto the
bar, and the bartender will wipe up the spill, but that's about it.

irene


Sent via Deja.com http://www.deja.com/
Before you buy.

Pontus Wickholm

unread,
Sep 11, 2000, 7:10:39 PM9/11/00
to

Stefano Gaburri <gab...@elet.polimi.it> skrev i
diskussionsgruppsmeddelandet:39BCCDC7...@elet.polimi.it...

>
> Neil Cerutti wrote:
>
> > Simply remove the two old liquid objects and replace with the new
> > one.
>
> If you want to hurt yourself, you could define each liquid as containing
some percentage of
> "reagents" (which will be hidden of course, not known to the player).
Mixing them in a bowl or
> whatever, you could take track of the relative percentages and produce the
final liquid (healing
> potion!) Only when they are in a certain range, according to some kind of
formula found elsewhere in
> the game (and of course, shadowy written in cryptic alchemic references).
> Of course the whole lab would spectacularly explode in a number of cases,
to discourage trial and
> error :)

Let's see if I understand you correctly. Every 'receptacle' would have a
data-structure describing the liquid it could possibly contain.

struct receptacle
{
int amount; // in centiliters
int vodka; // amount of vodka in percent
int orangeJuice; // amount of orange juice in percent
};

receptacle glas;

glas.amount=0; // let's empty the glas
glas.vodka=0;
glas.orangeJuice=0;

By pouring some vodka into the glas the glas.ammount variable would be set
to, let's say 4, and the glas.vodka variable would be set to 100 (meaning
that 100% of the 4 centiliters of the liquid in the glas is vodka). By
pouring some orange juice into the glas the glas.amount would increase to 8,
the glas.vodka variable would decrease to 50 and the glas.orangeJuice would
be set to 50. The new liquid (50% vodka and 50% orange juice) would be
recognized as "screwdriver" by the game.

The advantage of this approach is that liquids are treatet as qualities of
receptacles rather than being treated as objects in their own right. This
means that the player can mix the "base elements" (in this case vodka and
orange juice) as much as he/she want's to.

Have I understood you correctly?

> If you REALLY want to do yourself great harm, you could introduce
stechiometric reactions that alter
> the percentage of the reagents and/or produce new ones. But it's
completely pointless if the player
> cannot "see" them.

I'm afraid I lost you there. What does "stechiometric" mean? Could you give
an example?


Stefano Gaburri

unread,
Sep 12, 2000, 8:36:55 AM9/12/00
to

Pontus Wickholm wrote:

> Let's see if I understand you correctly. Every 'receptacle' would have a
> data-structure describing the liquid it could possibly contain.

yeah, or you can make it "implement the receptacle interface" :)



> By pouring some vodka into the glas the glas.ammount variable would be set
> to, let's say 4, and the glas.vodka variable would be set to 100 (meaning
> that 100% of the 4 centiliters of the liquid in the glas is vodka).

Or you can just keep in memory the total amount, calculating relative percentages as needed.

> By
> pouring some orange juice into the glas the glas.amount would increase to 8,
> the glas.vodka variable would decrease to 50 and the glas.orangeJuice would
> be set to 50.

maybe it's easier to avoid the automatic recalculation, keeping track (as said above) of the total
amount. triggers (ie demons) can perform the calculations. Consider that some demons (reactions) may
want to consider only the relative quantities of some reagents.

> The new liquid (50% vodka and 50% orange juice) would be
> recognized as "screwdriver" by the game.

yay!

> The advantage of this approach is that liquids are treatet as qualities of
> receptacles rather than being treated as objects in their own right. This
> means that the player can mix the "base elements" (in this case vodka and
> orange juice) as much as he/she want's to.

exactly!



> Have I understood you correctly?

perfectly!



> > If you REALLY want to do yourself great harm, you could introduce
> stechiometric reactions that alter
> > the percentage of the reagents and/or produce new ones. But it's
> completely pointless if the player
> > cannot "see" them.
>
> I'm afraid I lost you there. What does "stechiometric" mean? Could you give
> an example?

mmmh, i made that term up on the spot; i figure that (being greekish-scientific) the englis
equivalend would have been close enough. In fact, the correct word is "stoichiometric" which sounds
even more greekish and meins simply "of the calculations of element in chemistry". So I assume you
can safely substitute "chemical" instead of s. in the sentence above...

sorry about that :)

later,
S

Stefano Gaburri

unread,
Sep 12, 2000, 8:39:46 AM9/12/00
to

Stefano Gaburri wrote:

> mmmh, i made that term up on the spot; i figure that (being greekish-scientific) the englis
> equivalend would have been close enough. In fact, the correct word is "stoichiometric" which sounds
> even more greekish and meins

and forgive my spelling here, I shouldn't have kept typing while talking with two people at once :)

ciao
S

David Thornley

unread,
Sep 12, 2000, 2:21:59 PM9/12/00
to
In article <slrn8rnab8...@horpner.together.net>,

Neil Cerutti <cer...@together.net> wrote:
>
>The point is, in Inform, liquid is not in the world model. You
>have to write all the code from scratch. I don't believe there is
>liquid in TADS either, or HUGO, etc... So, liquid can do whatever
>you code it to do.
>
IIRC, there is a file in the TADS/examples directory that deals with
liquids, and comes with source code for a sample game that is
completely unmemorable, but does show how to use liquids. I don't
remember any of the detail, though.

Nor do I remember any liquids in TADS itself. Maybe in WorldClass?

--
David H. Thornley | If you want my opinion, ask.
da...@thornley.net | If you don't, flee.
http://www.thornley.net/~thornley/david/ | O-

Stefano Gaburri

unread,
Sep 13, 2000, 3:00:00 AM9/13/00
to

Chris wrote:

> All this is very interesting (haha) but essentially means exactly what was
> meant in the construction of a screwdriver, a 'stoichiometric' eqn for which
> is Vodka + Orange Juice ----> Screwdriver ( 1:1 ratio of reagents)
>
> Bored?

not if you pass the glass this way.

Mr. Sabre

unread,
Sep 13, 2000, 3:00:00 AM9/13/00
to
"Pontus Wickholm" <pontus_...@hotmail.com> wrote in message
news:6uKu5.88$F5.1...@newsb.telia.net...

Yes, 'Everybody Loves a Parade' by Cody Sandifer involved mixing two
liquids, though I can't really say which without giving away one of the
puzzles.

The best way to do this would probably be to put in a 'mix with' command, or
put a tag on the action of combining two liquid objects in one container
that causes both to be replaced by one different object that represents the
mixture.


Mr. Sabre

unread,
Sep 13, 2000, 3:00:00 AM9/13/00
to
And now I'll include the signature I forgot to add to that post... :)

Sabre
"Imagination is more important than knowledge." -- Albert Einstein

"Mr. Sabre" <pho...@neobright.nyet> wrote

Chris

unread,
Sep 13, 2000, 10:47:31 AM9/13/00
to
Stefano Gaburri <gab...@elet.polimi.it> wrote:
>
> mmmh, i made that term up on the spot; i figure that (being greekish-scient
> ific) the englis equivalend would have been close enough. In fact, the
> correct word is "stoichiometric" which sounds even more greekish and meins
> simply "of the calculations of element in chemistry". So I assume you
> can safely substitute "chemical" instead of s. in the sentence above...
>

It means (coming from a physicist with limited memories of A-level
chemistry), the ratio of things you need to add to get reagents, e.g.

C6H12O6 (glucose) + 6 * O2 ----> 6 * H2O + 6 * CO2

meaning if you do this you will end up with water [vapour] and CO2, but only
if you have the right ratio of things to start with (6 molecules oxygen to
one glucose in this case). Otherwise you end up with an inpure result, with
some oxygen or glucose left over. So sugary water if not enough oxygen...

All this is very interesting (haha) but essentially means exactly what was
meant in the construction of a screwdriver, a 'stoichiometric' eqn for which
is Vodka + Orange Juice ----> Screwdriver ( 1:1 ratio of reagents)

Bored?


Chris
--
Christian Lund
Jesus College
Cambridge

0 new messages