Mixing liquids

(This is how Søren Løvborg envisions components and mixer-objects in a liquid-simulation module.
It does not necessarily constitute the opinion of the developer group, nor is it in any way final.)


A Liquid is an actual gameworld object, which the player can examine, drink, etc.
A liquid is composed of one or more LiquidComponents.
While most liquids will simply be a Liquid instance, components will often be instances of several different LiquidComponent subclasses.
Besides any subclass-specific behaviour, all components come with basic handling of weight, volume, colour and alpha (reverse transparency). This includes naming of colours.

Here's a screenshot from the Component Testgame, which illustrates this mixing, using components (of the Water subclass):
As the testgame shows, it's simple to introduce a separate LiquidComponent subclass for poisons, or a magic potion, or an energy drink, or whatever special handling is needed.
The module keeps track of all components and the amounts automatically, calling the components' consume method when an actor drinks (possibly only a part of) the liquid, which the components are in.

Multiple liquids in a container

Normally, when two liquids are poured into the same container, a new Liquid instance would be created, containing the components of both the original Liquid instance.

However, this doesn't always have to be the case. Remember, Liquids are the game world objects, while LiquidComponents are indistinguishable to the player. The player can't see that a liquid contains three centiliters of poison, for instance. He might notice an odd odor from the liquid, but that again is a property of the liquid.

If the player pour oil into water, the two Liquids does not mix. They make contact, but they stay as separate objects. The player can examine the oil, or examine the water.

Mixer objects

(to be written)
Valid HTML 4.01 SourceForge.net