It’s completely fine to program a highly detailed simulation just for the sake of programming a highly detailed simulation. It might not get hailed as high art, but it’s fun. It could be educational. It might even get hailed as high art. It certainly won’t end with anybody getting their arm chomped off.
I realized that none of my examples actually dealt with the original issues of the thread, of distributing identical objects and disambiguating objects from their distributors. Here’s something from The Little Match Girl 2: Annus Evertens. It has to do with spanakopita:
The plate of pastries is scenery in 2B.
The spinach snack is an edible thing.
Instead of taking the plate of pastries:
if the spinach snack is offstage:
now the player carries the spinach snack;
say "You take [one of]one of the pastries from the plate. Looking closer, you can see the green stuff is spinach[or]another pastry, for some reason[stopping].";
otherwise:
say "You haven't eaten the one you already took."
Already we’re using the technique Mathbrush cited of giving identical names to the “dispenser object” and the “dispensed object,” but we’re still going to run into a disambiguation issue. The completely normal command TAKE PASTRY is going to refer to the plate, but the similarly inevitable command EAT PASTRY is going to refer to the individual item.
To handle this, we make the assumption that once the player has access to the discrete object, they don’t really have a reason to refer to the “dispenser object.” Is this a dangerous assumption? In my experience, it is not. So, we Understand "pastry" and "spanakopita" and "spinach" and "snack" and "triangular" and "green" as the spinach snack.
BUT, ALSO, we Understand "pastry" and "spanakopita" and "spinach" and "snack" and "triangular" and "green" as the plate of pastries while the spinach snack is offstage.
As long as the individual pastry is around, the plate does not get all these synonyms.
I think maybe the syntax Understand [WHATEVER] as [THE THING] while [THE OTHER THING ISN'T AROUND TO CAUSE CONFUSION]
is the main technique that @wmodes needs to handle the situations that inspired this thread. (e.g. Understand "berries" as the berries on the bush while there are no berries in the pail
, although that doesn’t handle PICK BERRIES, does it.)
If players do want to refer the plate of pastries while the individual pastry is present, I would expect them to use the terms “plate” or “pastries,” which are built into the name of the object, so there’s no problem. But you might also declare non-conditional synonyms like “spanakopitas” for the plate that wouldn’t apply to the individual pastry.
There’s still a problem when a command like EAT PASTRY is submitted before the player picks up a pastry, because the parser is going to try to grab the plate of pastries—and give you the single pastry instead, sure—but it’ll still think the thing you’re trying to eat is the plate itself. So I have this slightly complicated rule:
Instead of eating the plate of pastries:
if the spinach snack is visible:
try eating the spinach snack;
otherwise:
try taking the plate of pastries;
try eating the spinach snack.
The first part of this somewhat unrelatedly redirects “EAT PLATE OF PASTRIES” to eating the single pastry in your hand, but I’m okay with forcing that sort of decorum on the player character in this situation (because the Little Match Girl is always very polite).
There are certain other actions that should work the same way, aren’t there? Actions where you have to pick up the individual object before you do something with it? I can’t think of any, though. Maybe a big bowl of keys?
Here’s something else from Mud Warriors. In this game, the distributor object of the mud is literally everywhere:
The mud is a backdrop. The mud is everywhere.
And yet, some locations are mudless???
A room can be mudless.
A1a is mudless.
A1b is mudless.
D2 is mudless.
D3a is mudless.
F2 is mudless.
F3a is mudless.
In fact, “mudless” refers to locations where I don’t want you to be able to pick up mud, because the description of the location says the mud is thin on the ground or something. So you can still look at the mud, and try to take the mud, without the game unhelpfully telling you it doesn’t exist.
In Mud Warriors, you have to pick up lumps of mud so you can throw them at people. The player character and all the other kids have a Constitution stat that determines how many lumps they can carry at a time.
To grab is a verb.
To try is a verb.
Instead of an actor taking the mud:
if the location is mudless:
say "[The actor] [grab] at the mud, but there isn't enough here to scrape together a decent lump.";
otherwise:
let Currentmud be the number of lumps of mud enclosed by the actor;
if Currentmud is less than the constitution of the actor:
let newlump be a random offstage lump of mud;
now the actor is carrying newlump;
say "[The actor] [pick] up a [one of]glob[or]lump[or]wad[or]hunk[at random] of mud.";
otherwise:
say "[The actor] [try] to pick up some mud, but [cannot] carry any more."
A lump of mud is a kind of thing. The plural of lump of mud is lumps of mud.
There are 10 lumps of mud.
Understand "glob" and "wad" and "hunk" and "globs" and "wads" and "hunks" as a lump of mud.
Somehow, ten mud-lumps is all the world model needs? I think this works because all the battles are one-on-one, and nobody’s Constitution score is ever greater than five.
Obviously, having an omnipresent “mud” object coexist with these “lumps of mud” objects is very fraught! But there’s curiously very little code here about dealing with them—probably because I predicted that there were only so many actions the player would attempt with the mud:
Does the player mean throwing a lump of mud at something: It is likely.
Does the player mean examining a lump of mud: It is unlikely.
Check taking a lump of mud:
if a person encloses the noun:
try taking the mud instead.
I don’t know if this adds up to an elegant or seamless play experience, but it seems at least to be playable.
In Visit Skuga Lake, there are some mops:
Some mops are welterweight scenery in E1c.
Description of the mops is "There's a bunch of mops here. Why do they need so many mops?"
Understand "mop" as the mops while the mop is not visible.
“Welterweight” is a property used in the extremely complicated magic system. A portable thing is usually “featherweight,” which is why no weight is specified for the individual mop object:
The mop is a thing.
Description of the mop is "A wooden mop. This will come in handy if you suddenly need a dance partner."
Instead of taking the mops:
if the mop is offstage:
say "You grab a mop.";
now the player carries the mop;
otherwise:
say "You already took a mop."
This works exactly like the spanakopita from earlier! But instead of eating it, there’s some machinery here for dropping it. You can abandon it in any other location, as is normal with text adventure objects, but you can also put it back where you found it:
instead of inserting the mop into the cleaning supplies, try dropping the mop.
instead of inserting the mop into the mops, try dropping the mop.
Instead of dropping the mop in E1c:
remove the mop from play;
say "You return the mop to its rightful place."
Now you can grab it again, if the mood strikes you. It wouldn’t hurt to add this behavior to the spanakopita, except that it’d be sort of gross for you to pick up a pastry and then put it back on the plate. I guess it comes down to putting yourself in the player’s shoes, thinking “what would I bother trying to do with this? what would I type? how would I expect that to turn out?” and trying to make that behavior happen. And adding more behavior when your beta testers try things you didn’t think of.
The brooms in Visit Skuga Lake work the same way as the mops. It is interesting to note that neither the mops or the brooms are useful for any of the game’s many puzzles (even though so many of the puzzles have multiple solutions). It would be way easier for me and arguably more elegant if the game never let you pick up a mop or a broom. But I like it better this way, I guess because it adds “texture.”
On the other hand, the mud you can pick up in Visit Skuga Lake is useful in at least one puzzle. I handle it differently than in Mud Warriors.
A grounding is a kind of thing.
A room has a grounding called the substrate.
The pile of sand is a grounding.
Description of the pile of sand is "A pile of sticky sand."
The lump of dirt is a grounding. Understand "soil" and "earth" as the lump of dirt.
Description of the lump of dirt is "Just some dirt."
The lump of mud is a grounding. Understand "soil" and "earth" and "wad" and "ooze" as the lump of mud.
Description of the lump of mud is "An oozing handful of mud."
The sfloor is a grounding.
The spavement is a grounding.
The swater is a grounding.
The srock is a grounding.
There are other substrates, but they’re kind of spoilery. The “sfloor” and so on are important to have so that I can give sensical answers when the player tries to “DIG” inside a building or something.
To say current substrate:
let M be substrate of the location;
choose row with obj of M in Table of Substrates;
say txt entry.
Table of Substrates
obj txt
pile of sand "sand"
lump of dirt "dirt"
lump of mud "mud"
sfloor "floor"
spavement "pavement"
swater "water"
srock "rock"
There are other “groundings” to serve as the “substrates” of all the locations, but some of them are spoilers so we’ll just discuss this sample. The substrate of a location comes into play mainly when you dig there:
Instead of digging while player carries the shovel:
let localTreasure be the treasure of the location;
if localTreasure is something and localTreasure is offstage:
now localTreasure is in the location;
let localSubstrate be substrate of the location;
let ourLocation be the holder of the player;
now localSubstrate is in ourLocation;
say "You randomly stick your shovel into the [current substrate] and start turning it over a bit.[paragraph break]Eventually you hit something! You lean down to carefully brush the [current substrate] aside, and reveal [long text of localTreasure].";
otherwise:
let localSubstrate be the substrate of the location;
if localSubstrate is the spavement:
say "You can't dig through the pavement.";
otherwise if localSubstrate is the sfloor:
say "You can't dig through the floor.";
otherwise if localSubstrate is the swater:
say "You can't dig through water.";
otherwise if localSubstrate is the srock:
say "You can't dig through solid rock.";
otherwise if player carries localSubstrate:
say "You already have [a localSubstrate] in hand.";
otherwise if localSubstrate is in the location:
say "You've already done plenty of digging here, as evidenced by [the localSubstrate] sitting on the ground.";
otherwise:
say "You stick your shovel in the ground and turn up [a localSubstrate].";
let ourLocation be the holder of the player;
now localSubstrate is in ourLocation.
So complicated! But it lets you do what I want to let you do: You can dig around for treasure anywhere you like, except where that wouldn’t make sense. And digging produces lumps of sand and mud, which you can carry around if you feel like it.
Maybe you have noticed that this system only involves a single floor object, to serve as the substrate for every interior location, and a single “lump of mud” object, serving as substrate for every muddy location. This poses a problem if you should be able to dig up lumps of mud everywhere that there’s mud on the ground.
So the critical lines are: if player carries localSubstrate, say "You already have [a localSubstrate] in hand.";
and if localSubstrate is in the location, say "You've already done plenty of digging here, as evidenced by [the localSubstrate] sitting on the ground.";
You can’t dig up another lump of mud if a lump of mud is nearby. Without these lines, if you picked up some mud and then dug up some more mud, the mud in your inventory would just disappear (as it moved to the ground). That would not be acceptable.
HOWEVER. THIS IS THE ACTUAL INSIGHT, WAY DOWN HERE: If you abandon the lump of mud somewhere, and you go to another muddy location and dig up some more mud, you do get some more mud. (The mud you abandoned quietly disappears from its location and moves to wherever you’re digging.) This matches how piles of mud work in real life: Once you drop a handful of mud somewhere, you stop caring about it, and you don’t notice if it’s missing when you go back to where you left it. Put another way, if the game said “You can’t dig up more mud here; there’s a perfectly good pile of mud somewhere else,” it would sound deranged.
Why did I think this would all be about food?
Hey, @jsnlxndrlv, about those annotated sources:
You can make a “pile of rocks” object with custom descriptions and rules based on whether there is one, some, or none rocks remaining that are out of play, and use grouping rules to keep the rocks together in your inventory, but then once you start dropping them into the environment or whatever, those subtle differences become relevant once disambiguation matters.
Are you referring to something specific? Because I can’t think of anything I’ve done like that.