Modifying built-in action behavior for sightless exploration

I’m kicking around an idea for a psych. horror game in which the player starts in a dark, unfamiliar, and hostile cavern from which he or she must escape. Everything must be explored using senses other than sight because the entire game takes place in the absence of natural or artificial light.

Since AFAIK Inform’s framework doesn’t really allow for subdivision of the Room object into physical dimensions, the first implementation that came to mind would be subdivision of rooms at a design level into ‘conceptual rooms’ such that the code could simply have multiple logical Rooms per conceptual room on my design map. Each such logical Room would be considered a 5’ cube in my design, so any objects at a greater distance than that from the player in the conceptual room would be in the next logical Room. Where that’d get really tricky is trying to accommodate multiple non-sight senses, which obviously have varying ranges but I think the experience would still be intact if I simplified that to being touch/taste as active (i.e. the user has to enter the command ‘touch x’ and ‘taste y’) modes of discovery within 5’ and sound/smell as passive (i.e. the game logic will automatically alert the player when they can hear/smell something) modes of discovery that would be pushed to the player iff the sound/smell potency : player distance from sound/smell source ratio was high enough to pass a ‘detection’ threshold. Does that sound workable? Are there any example stories using a similar mechanic whose source I could study?

I’m new to Inform 7 and the part I’m stuck on is probably the easiest of what I just described – how do I tell the framework that the ‘look’ action and all sight-related variants simply show(s) darkness all around and that ‘touch’/‘taste’ actions should mimic and replace most of the built-in look behavior but also expand upon it with sense-specific flavor (e.g. ‘touch floor’ or ‘grope nearby’ -> ‘at your feet is a rough, warm rock’ and ‘taste rock’ -> ‘the rock has a distinct iron taste. Combined with its disconcerting warmth, the image of blood comes unbidden to your mind’s eye’)? I’d also ideally remove the default description offered by the default look behavior upon entering a room, since a person wouldn’t automatically be touching/tasting everything (without problems arising). I guess that loaded question can be simplified to:

  1. How can I route all look actions to a simple and unhelpful response like ‘darkness presses in all around’ for all Rooms?
  2. How can I disable the default look action upon entering a new room?
  3. How can I re-map the standard look behavior to be the result of other actions, such as touch?
  4. How can I ‘branch’ behavior based on specific action, such that touch and taste actions both gather information similar to the standard look action about the player’s surroundings, but in different ways?

This is an interesting question! There are several approaches you could take, depending on what you want to do.

If you really want to have feel around etc. work exactly like looking except with different messages, you could try redirecting commands in some way. One way to do this is to set a flag to see whether the player is really looking or feeling around. If the player is looking, the looking action gets cut off; feeling around gets sent to a command that sets the flag and then redirects to the looking action. You also need to separately get rid of the rule that prints a room description when you enter a room, and tweak the messages for looking a bit.

[code]The Totally Dark Cave is a room. “The rough walls of the cave are slightly damp. You feel an opening to the west.” [note that this is a tactile description] A rock, a stalagmite, and a squishy thing are in the Totally Dark Cave.

The Totally Dark Hallway is west of the Totally Dark Cave. “This narrow corridor ends after a little while. It opens back to the east.” A diamond is in the Totally Dark Hallway. The description is “A diamond! This would be valuable if you weren’t trapped in these two dark rooms.”

Looking directly is a truth state that varies. [True when the player typed “look” or the look action got carried out automatically at the beginning.] Looking directly is initially true.

Every turn: now looking directly is true. [reset the flag]

[but the rule that prints a new description after you go into a room isn’t a looking action, so we have to zap that separately]

This is the describe new darkness rule: say “You are in a new dark place.” [if there were more complications–going by vehicles, pushing things, NPC actions we wanted to report–we’d have to complicate this. The describe the room gone into rule is pretty complicated because of all the special cases there can be.]

The describe new darkness rule substitutes for the describe room gone into rule.

Feeling around is an action applying to nothing. Understand “feel around” as feeling around.
Carry out feeling around:
now looking directly is false;
try looking.

Before looking when looking directly is true:
say “You can’t see a thing in this darkness, but you might be able to FEEL AROUND.” instead.

[need to make sure the message says “feel” rather than “see”]
The you-can-also-see rule response (D) is "[regarding the player][can] also feel ".
The you-can-also-see rule response (E) is "[regarding the player][can] feel ".

Test me with “look/feel around/w/look/feel around/take diamond/x diamond/e/feel around”.[/code]

This takes care of your first three questions. On the other hand, from your last question, it seems like you might want your touch and taste actions to do things other than straightforwardly mimicking the normal behavior of the “look” action. One way to do that would be to make every room dark–this automatically invokes special darkness code for looking, and describing the room gone into, and all that other stuff, and you can modify the darkness code–and write rules for feeling and touching and tasting that produced the behavior you wanted.

“Under, in Erebus” is a game that takes the approach of treating darkness in a way that mimics the general looking behavior–to the extent that “look” and “examine” work as usual, and it’s sometimes easy to forget that you’re in darkness. (Until you try to examine the Cyclops and that means rubbing him.) Unfortunately I don’t think its source code is available. “Bronze” and “Sand-Dancer” are two games with available source code that have some code for darkness, though perhaps not in the same way you want. (The source code for “Sand-Dancer” may be out of date with the latest Inform.) You might also want to look at the “Four Stars” and “Zorn of Zorna” examples in the Inform documentation.