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.
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.