Challenge: Infinite corridor in Inform 7

Lurking Horror features the Infinite Corridor, which is a corridor at MIT that isn’t actually infinite. However… would it be possible to implement an actual semi-infinite corridor in Inform 7? By semi-infinite, I mean having some ludicrously large number of locations, probably 2³¹-1 of them so you could use an integer as coordinate. That would be infinite as far as any human player typing commands at the keyboard was concerned.

Clearly it’s doable in other systems; for example, Level 9’s “Snowball” had over 6,000 identical cryosleep rooms. But as I recall, the Z machine doesn’t have dynamic allocation, so you can’t keep a lazy list of rooms. There’s also the problem of how to track objects dropped in the corridor so you can drop something, go east 1,027 times, then go west 1,027 times and see the object still there.

You’ll want to stick to only a single “room” object, but it should be doable. Objects are limited, but the player doesn’t have to know what’s an object and what isn’t!

The Infinite Corridor is a room.
The Infinite Corridor has a number called the current position.
A thing has a number called the dropped position.

Instead of going west in the Infinite Corridor:
    say "You walk west. Nothing changes.";
    increment the current position of the Infinite Corridor;
    update item placements;
    try looking.

Instead of going east in the Infinite Corridor:
    if the current position is zero:
        say "You finally escape!";
        move the player to the Finite Side Passage;
    otherwise:
        say "You walk east. Nothing changes.";
        decrement the current position of the Infinite Corridor;
        update item placements;
        try looking.

After dropping something in the Infinite Corridor:
    now the dropped position of the noun is the current position of the Infinite Corridor;
    continue the action.

After taking something:
    now the dropped position of the noun is -1;
    continue the action.

Limbo is a container.

Definition: something is nonplayer if it is not the player.
To update item positions:
    let X be the current position of the Infinite Corridor;
    repeat with the item running through nonplayer things in the Infinite Corridor:
        if the dropped position of the item is not X, move the item to Limbo;
    repeat with the item running through things in Limbo:
        if the dropped position of the item is X, move the item to the Infinite Corridor.
5 Likes

The Dubai example in the docs is about generic locations: it has an elevator in a hotel with 27 floors, and a table for the floors that have specific rooms: the other floors are generic. Then it shows two ways of handling dropped objects: 1) having the staff pick them up and take them to the lost-and-found or 2) take them out of the generic room but remember which floor they belong on so it can put them back where you expect them to be when you visit again.

4 Likes

Anyone else imagining expanding this intosomething like an endless desert/ocean where you can move in any of the 8 compass directions or an endless void where you can move in any of the 8 compass directions, up or down, or any combination of up/down and a compass direction? Naturally, you could just use two or 3 ints to keep track of the player’s location on a plane or in a space, and just have secondary directions increment two coordinates, but for true free roaming in 3D, I’m guessing you’d need to define directions like up north and down southeast manually… and since the most obvious application of such I can think is searching in a massive, mostly empty environment for points of interest(e.g. searching for ruins in the desert, islands on the ocean, or celestial bodies in outer space), I find myself wondering how much work it would be to define coordinates for rooms you can move inside from those coordinates and to define some kind of visibility function for them(e.g. get within a certain taxi cab distance of ruins/island/a star and a message of the form "You can see an outcropping of rocks to the xxx/something is visible on the horizon to the xxx/A star brighter than all the rest is to your xxx) or to implement commands like n10 for go north 10 times if such a shorthand isn’t built in or a goto that accepts a set of coordinates.

1 Like

There are a few games that have done that; BOSH is the first that comes to mind, in a four-dimensional space. Scroll Thief has a three-dimensional space with a spherical coordinate system but the payoff for figuring it out was never finished.

1 Like

That’s perfect, I just didn’t find it when I was searching the index of examples. I guess at some point I should just read through them all so I have an idea of what’s in there.

I’m completely blanking on the name of the game, but wasn’t there a “fly a bomber plane to a location and drop bombs” section in a game that someone did a forum let’s play of in the last couple years? You have a radio direction finder or something, and you have to figure out how to set the heading and the altitude, I think? Maybe some Infocom thing? Hmm. Searching is not turning it up Jigsaw has the Ghost plane but that doesn’t look like it?

Also Mathbrush’s Ether has a 9x9x9 3D grid that you move around in.

The eternal problem with Inform’s documentation…

I’m pretty sure that’s Jigsaw: Let's Play: Jigsaw - #264 by Draconis

3 Likes

Curiously enough, I’m doing this right now in a game I’m developing with my new system. My approach is a single desert room with a randomized description and exits in all compass directions that loop back to the same room. At the moment I’m only counting how many turns a player spends in the desert and how many times they try to travel – I’m not tracking coordinates – but easily could do, and whether objects were dropped at given coordinates.

Thanks! :person_facepalming: I should have actually read through more of the thread to find my posts - instead I took a quick look at https://ifarchive.org/if-archive/solutions/Jigsaw.sol which didn’t seem to mention flying the plane to a particular location?

I can’t remember the details of this, but there’s a whole lot of elaborate simulation of of the plane’s position which ends up being mostly irrelevant to the gameplay. I can’t remember if this is because you can use the autopilot to get to the correct destination or whether the plane starts out on the correct heading to get to the destination anyway?

2 Likes

As I recall, the Jigsaw plane starts on almost the correct heading. You can hit the target by trying small adjustments and then retrying until it works.

2 Likes