Volumetric Limiter by Daniel Gaskell


Chapter: Overview

This extension adds a bulk property to all things, and a bulk capacity property to all containers and people. Objects cannot be put into containers that are full or too small for them.

Bulk is a value of the kind "volumetric size", with parts length, width, and height. For example:

The pot of gold is at Rainbow's End. The bulk is 20x20x12.

The dimensions are unitless, so "20" could represent 20 inches, 20 cm, or any other unit, so long as we are consistent about it. The default values assume dimensions will be given in inches (i.e. the pot of gold is 20 inches across and 12 inches tall).

The default bulk of a thing is 6x6x3 (the size of a small bowl). The default bulk capacity of a container is 24x16x12 (the size of a small chest). The default bulk capacity of a person is 120x72x72 (quite voluminous).

The implementation is simplified, but fairly intelligent: Volumetric Limiter will understand that we cannot put a four-foot broomstick in a box two feet wide, for example, but won't try to work out whether the broom could be wedged in diagonally. Fullness is likewise simplified: Volumetric Limiter only considers total volume, not how objects might coexist based on their shape. Still, it's enough to produce convincing parser responses like:

The umbrella is too long to fit in the jewelry box.
Laurie doesn't have enough room left to carry the sack of coal.
The piano is much too large to fit in the cassette player.

Note that this extension complements (rather than replaces) Inform's built-in capacity check for containers. The default carrying capacity of a container is 100, so capacity checks rarely come into play, but the rules still exist if needed.

Chapter: Special Tools

A number of internal phrases and definitions can be used separately, if needed. We can find the longest, second-longest, and shortest dimensions of a volumetric size using:

the longest dimension of (a volumetric size)
the second longest dimension of (a volumetric size)
the shortest dimension of (a volumetric size)

We can find the total volume of a volumetric size (length x width x height) using:

the cubic volume of (a volumetric size)

We can find out how much space is left in a container or person (by volume) using:

the free capacity of (something)

We can manually check dimensions and available volume using:

if (something) fits into (something)...
if (something) has enough space for (something)...

Finally, after running the "(something) fits into (something)" test, two variables will be set: "failed bulk dimensions" and "tightest fit factor". These are used to generate more intelligent failure messages.

"Failed bulk dimensions" holds the number of dimensions that don't fit, from 0 to 3. For example, a flagpole might have a small enough length and width to fit in a drawer, but not a small enough height, so "failed bulk dimensions" would be set to 1.

"Tightest fit factor" is a real number holding the percentage of the container that the largest dimension takes up. For example, a 12-inch cube in a 24-inch box would have a "tightest fit factor" of 0.5 (50%), while a 24-inch pole in a 12-inch box would have a "tightest fit factor" of 2.0 (200%).

Example: * Drawing Room - Some objects to play with, demonstrating relative volumes.

"Drawing Room"

Include Volumetric Limiter by Daniel Gaskell.

The Drawing Room is a room.

The gigantic novelty pencil is in the Drawing Room. The bulk is 36x5x5.
The scale model of the Parthenon is in the Drawing Room. The bulk is 12x10x6.
The marble is in the Drawing Room. The bulk is 1x1x1.
The inexplicable titanium cube is in the Drawing Room. The bulk is 12x12x12.

The matchbox is a container in the Drawing Room. The bulk is 3x2x1. The bulk capacity is 3x2x1.
The fishbowl is a container in the Drawing Room. The bulk is 12x12x12. The bulk capacity is 8x8x8.
The cabinet is a container in the Drawing Room. It is fixed in place. The bulk capacity is 24x12x12.

Test me with "put fishbowl in matchbox / put marble in matchbox / put pencil in fishbowl / put cube in fishbowl / put matchbox in fishbowl / put pencil in cabinet / put fishbowl in cabinet / put cube in cabinet / put model in cabinet".