Adding one-way and secret doors to the dungeon generator
The dungeons got doors that open from one side, walls that turn out to be doors, and a slot through the rock that shows the goal room early.
The dungeon designer has two new parts, a one-way door and a secret door, and the generator uses both. The quick exit past the boss, which I added in the multi-floor step as a door with a lever, now comes out through a one-way secret door instead. The lever is gone.
How does a door open from one side only?
I asked for “a secret door that only opens from one side”, so I started with the doors that already exist. A one-way door is an ordinary door with one extra field, opens_from, which is +1 or -1, the local face its handle is on. From the other face it has no handle and no keypad, and pressing E says “// NO HANDLE ON THIS SIDE”. Once it’s open you can walk through it either way, and only the handle’s side shuts it again. Nothing new is saved, because the side is how the door was built.
On the sheet the designer’s one_way_door names its side as north, east, south or west, and it has to lie along the door’s way. If it doesn’t say, or says something that doesn’t fit, the importer takes the side farther from the entrance and adds a warning. That makes a shortcut back, opened from inside. The checker treats the door as a gate that opens when its handle’s square is reached.
How does a wall turn out to be a door?
The secret door is built on the illusion wall, so until it’s found it is the interior’s wall piece for that side of the room, worn the way the laid walls are. It stops the party, monsters, sight and shots. Stand within 1.9 m and look at it, and it says “// THIS WALL HAS A SEAM”. Then E opens it. The piece draws back 0.18 m over the first fifth of its travel and then sinks into the floor, over twice the usual door time in game time, so a stopped clock stops it. E again raises it, unless something stands in the way.
A one-way secret door has a plate and a push bar on its back only. Putting the bar on the wall face would give it away. That is the quick exit now: wall from the boss’s room side, a plain door from the tunnel on floor 1. The generator also lays a mixed secret, where the first secret is this door and the rest are crawl spaces and panels, plus one extra loop with a one-way door.
I’m not happy with one thing. At about 0:15 in the film, from the blank side of the one-way door, dark bar shapes show on the leaf. The test finds the bars only on the handle’s face, so I think they’re seen through the leaf. I haven’t fixed it yet.
Why does the generator cut a slot into the goal room?
The checker has a metric (M15) that wants the goal room, or its door, to be seen from a square in the first third of the way to it. On the ring-shaped dungeons the goal is the far side of the loop, so it almost never was. Only the hub cycle had it, on 3 of 20 seeds.
So where the goal isn’t seen early, the generator cuts a glimpse. It looks for a square on the early way and a square of the goal room that share a row or a column, no more than 24 squares apart. If the line between them runs through at most 20 squares of rock, that rock is dug as narrow passage and a window goes at the goal room end. The slot may touch nothing open except where it leaves from and one square of the goal room. The entrance’s ramp needs 9 squares of rock in a straight line out of it, and the importer refuses a dungeon where a slot crosses them, so those squares are never cut.
My first version cut slots that stepped corner to corner. The checker’s line of sight accepted them, but in the built rock none of 64 lines held, because a narrow passage’s walls stand in from the edge of its square. So only straight slots are cut, and those hold in the game.
With that, the goal is seen early on 12 of 20 seeds for two_paths, 11 for lock_on_other_arc, 9 for flooded_loop and 20 for hub_code. An earlier set of higher numbers came from the checker alone and was wrong in the game, so I dropped it.
Also done
- The designer page rings the things the generator added, and outlines the squares I drew.
tests/dungeon_valveshas 34 checks, and all pass.- Still to fix: the game’s reach walk doesn’t know one-way doors yet, and the glimpse misses on many ring floors.