I’m struggling to figure out how to model a concept of reachability where the player’s reach varies according to the situation.
My initial thought was to use a rulebook, which I set up like this:
Check reachability is an object based rulebook. The check reachability rules have outcomes in reach (success) and out of reach (failure).
An action-processing rule (this is the checking reach rule):
if the current action is going up and the door gone through is a door:
follow the check reachability rules for the door gone through;
if the rule failed:
if the actor is the player:
say "[if the actor is the player][We][else][The actor][end if] [can't reach] the opening." instead;
unless the action requires a touchable noun, make no decision;
follow the check reachability rules for the noun;
if the rule failed:
say "[if the actor is the player][We][else][The actor][end if] [can't reach] [regarding the noun][those]." instead;
The checking reach rule is listed before the basic accessibility rule in the action-processing rules.
So then I can have rules like these:
Check reachability rule while the player is wearing the extensible claw: in reach.
Check reachability rule while the player is on a booster and the posture of the player is standing: in reach.
Check reachability rule while the player is hoisted by someone: in reach.
Check reachability rule while the flight level of the player is greater than 0: in reach.
Last check reachability room for something out-of-reach: out of reach.
There are a bunch of custom concepts in those examples – a “booster” is just a special type of enterable supporter, “posture” is from Emily Short’s extension, and “hoisting” is an action+relation that allows you to ask another person to “hoist” you up onto their shoulders. I could post the details, but I don’t think it’s ultimately relevant to the core question.
Anyway, that approach works… but then I had the thought that those conditions should stack. For example, there could be a puzzle where you have to put one booster on top of another to reach a particularly distant thing, or a puzzle where you have to ask someone to climb onto a booster and then hoist you, or a puzzle where you need to be on a booster and wearing the extensible claw.
(Although, the “flight level” property mostly trumps everything else – if you can fly, all the other rules are irrelevant. But on the other hand, perhaps if you’re flying you can’t reach things that are lower than your current height…)
Some things I’ve tried that don’t seem to quite satisfy me (though I didn’t follow them far enough to be minimally functional):
- I thought of defining a phrase
to decide what number is the access level of (P - a person)
which would then be compared to alocale height
property on the thing being accessed. I think this would work, but it feels like it renders the use of a rulebook mostly redundant - nearly every case would be handled by a single rule that compares the access height of the player to the locale height of the object. - I thought of making the rulebook produce a number, also in conjunction with a
locale height
property, but that doesn’t seem to satisfy the requirements either.
I may ultimately decide to scrap this and return to the previous rulebook-based method where the various conditions don’t stack, but I’d like to at least explore as many options as possible first… so does anyone have any other ideas to achieve this?
As an aside: it’s not really that important, but it might be nice if the system also works for actors other than the player. I don’t really plan to have other actors taking unreachable things though, and so far I don’t mind them leaping through unreachable trapdoors in the ceiling.