Connecting autogenerated rooms

I’m working on a game where the player can fly, so I want a sky above every room.

Sky is a kind of room.
A grounded room is a kind of room.
A sky is up from every grounded room.

Great! But the sky is totally disconnected; right now the player is like a helicopter that can only go up and down.

Directions can be horizontal. Directions are usually not horizontal. North, south, east, west, northeast, northwest, southeast, and southwest are horizontal.
Instead of going horizontal direction (called dir) when the location is sky:
move the player to the room up from the room dir from the room down from the location.

Okay. But not every room connection on the ground, like diagonally through corners and such, is implemented. Is there any way for Inform to, say, use a coordinate system for room traversal?

Does the sky have to be a room? If you just want to get different results to actions whether the player is flying or not, adding a “flying” property to the player is much much simpler. You could then add rules like

Instead of doing something other than looking or landing when the player is flying:
  say "You are riveted by the odd sensation of flying." instead.

(untested, though)

I agree with Janka. Then you just throw that flag into the room description as well:

The description of the open field is "[if the player is flying]You are approximately 30 ft above a[else]A[end if]n open field."

(also untested)

Oh, I see, but you also want crow-flies directions. Well, you could do something like this (still untested, but very similar to something I did in a certain past work):

Ground-accessibility relates rooms to each other. The verb to be ground-accessible from implies the ground-accessibility relation. Room A is north of Room B. Room C is east of Room B. Room C is ground-accessible from Room B. Definition: a room is off-limits if it is not ground-accessible from the location. Before going to a room that is off-limits: [tab]if the player is not flying: [tab][tab]say "You ran into a plotwall!"; [tab][tab]stop the action.

So in other words, you link up all of the sky “rooms”, but then you only selectively link the ground rooms.

I guess the way I would think of doing this is to make a lot fewer sky rooms than ground rooms, and associate each sky room with a Region of ground rooms. When you go down from a sky room, I’d try to get Inform to just pick a random ground room in the region associated with that sky room, for you to land in. Looking down (or just looking) from any sky room could get you the names of the ground rooms below. Probably 3 or 4 ground rooms per ‘sky region’ would be enough to achieve a sense of realism. And then I would just give the sky rooms all their own compass interconnections with each other rather than trying to calculate their connections from the ground.

Quick ‘n’ dirty, I guess, and probably not the best solution if it’s very important to give the flyer the ability to land anywhere with perfect precision.


tove: That works great, thanks!

Just one more thing: the game has different costumes that grant different abilities. In some cases, it’s important to have a costume that’s comprised of multiple parts. For example:

"Witchy is a kind of thing.
The broomstick, robe, and hat are witchy.

[I don’t want the player to have to specify each thing individually]
Wearing the witch costume is an action applying to nothing.
Understand “wear witch” or “put on witch” as wearing the witch costume.

Carry out wearing the witch costume:
repeat with cloth running through things worn by the player:
silently try taking off cloth;
repeat with cloth running through witchy:
silently try wearing cloth."

But using this method, I have to code that for every sensible verb, for every multi-part costume. Is there any way to just say something like this?:

“Carry out doing something (called verbing) with the witch costume:
repeat with cloth running through witchy:
silently try verbing cloth.”

Sounds like a job for AARP-Gnosis:

The extension Editable Stored Actions is sometimes useful here, as is the built-in “the current action”.