Birdoggydog's Builds

Adding pressure plates, item sockets and hidden switches

Three new ways to open a dungeon door in Godot, how each one decides it's been triggered, and how the generator places them without making a floor impossible.

Dungeon doors can now be opened by a pressure plate, by an item socket that wants one specific item, or by a switch that’s hidden until you walk up and look at it. The dungeon generator places all three now and then, and the checks that make sure every dungeon can be finished know how each one works.

51 seconds in a test hall. A plate holds its door open while the party stands on it, a second plate opens its door for good, a socket refuses until the party brings it a Line Fuse, and a bare wall turns out to have a lever on it.
Eight first-person frames in blue-gray metal corridors: a floor plate with blue studs in front of double doors, a close view of a wall, a small socket box on a wall, a fuse picked up across the hall, an open corridor after the fuse is fitted, a purple doorway, and an open door beside a plate on the floor.

The film’s frames in order, each with its caption.

These were three of the pieces the generator’s first version had to do without. A study of how dungeons are built listed what was missing from the kit, and I’m working through that list in order now that monsters are in the dungeons.

How does a pressure plate know it’s being stood on?

A plate is 1.4 by 1.4 meters and uses the trap plate’s frame and diamond plating, minus the spikes and the collision, since you walk over it. It counts as weighed when the party, or a monster that walks, is over it with its feet no higher than a step above it. A flyer doesn’t weigh anything. It sinks 2.5 centimeters when weighed. Its studs are blue when it’s idle, where a trap plate’s are amber, so that’s how you tell them apart. They turn green when it’s down.

A plate has two modes. A hold plate keeps its door open only while something stands on it and shuts it the moment it’s left. A once plate opens its door for good the first time it’s weighed. Both store their state in the switch’s flag, so a once plate stays down after a load. A hold plate’s flag gets set again from whatever is standing on it on the first frame after loading.

Plates and sockets are rows in the same table as every other dungeon fixture, marked as switches, so the existing switch code plans and builds them. Only the parts that are new live in a separate SwitchKinds script.

How does a socket take its item?

A socket sits on a wall and names one item. Press E while carrying it and the item is used up. It stays in the socket, you don’t get it back, and the door opens (or locks, if the socket is set to lock). Without the item it says // SOCKET EMPTY. SHAPED FOR ONE <ITEM>. I added two items to fit sockets, the line fuse and the knuckle cog.

How do you find a hidden switch?

Any lever, valve or console can be marked hidden. It isn’t drawn and isn’t solid until the party is within 1.9 meters and looks right at it, which is the same distance as a hidden panel. There’s no search key. Looking is the search. Once found, it works like any other switch, and the find is saved as a story flag, so it stays found.

How does the generator place them without breaking a floor?

Every generated dungeon is checked to make sure the party can reach everything it needs. Both of the reach checkers, the game’s and the Python one the generator uses, had to learn the new pieces. A once plate counts as thrown as soon as the party reaches it. A hold plate never counts as opening the way, because the party can’t stand on the plate and walk through its door at the same time. A socket counts only when the party can reach both the socket and its item. A socket whose item isn’t anywhere in the dungeon gets a warning.

That hold plate rule changed the generator. At first it placed hold plates too, and a hold plate on the only door through a floor makes that floor impossible. So now the generator places only once plates. A hold plate is something I’d draw by hand, with a second way to weigh it down.

The generator runs after a floor is stocked:

  • On 25% of floors with a key door, the door becomes a socket door. The socket goes on the nearest free wall on the near side, and the key is swapped for the socket’s item where it lay.
  • On 20% of floors with a plain door that’s the only way through, a once plate goes in the nearest free square of a room on the near side.
  • On 30% of floors with a secret door, a hidden lever goes on a wall of the room in front of it.

The floor’s seed decides whether it gets each one, and the stocking attempt decides where. Over seeds 1 to 20 that came to 1 socket, 4 plates and 2 hidden levers, and all 20 dungeons passed their checks. The rates are placeholders for now.

One thing broke on the way. The generator turned the locked office in a dungeon I’d described on the phone designer page into a socket door, which failed that dungeon’s test. A room I describe as locked now always keeps its key.

I also wanted dropped items to weigh plates down, but the game has no way to put an item on the floor yet. So for now a plate is weighed by the party or a monster you lure onto it. The phone designer page also can’t choose which door a plate or socket opens yet.

Also done

  • The new test for the three passes 51 checks, and the generator’s Python tests all pass.
  • The theme tour starts inside its first dungeon again. It sits 700 meters underground, and the world streamer was putting anything that far below the ground back on the surface, so the party started on the mountain above it.