Birdoggydog's Builds

Waking a wiped party in the dungeon it started in, in Godot

A party that began in the Breakout Site now wakes in its vat after a wipe, and two more cell doors want keys found on dead bodies.

A party that starts its game inside the Breakout Site and gets wiped out used to wake up in the meat plant’s vat bay, because that’s where every wiped party goes. Now it wakes on the site’s own start square, in the vat room it climbed out of. I also made two more of the site’s cell doors want a key off a dead body.

50 seconds in first person on floor 1. The locked Cell 27 door, the dead dietician searched for the Feed Key, the cell opened, a juice ampoule taken off Subject 27, then the wipe and the wake in the vat with the cell still open. The party is placed in front of each scene.

Waking in the vat instead of the plant

I wanted the slice to stay inside the site, and sending a wiped party back to the plant broke that. The level already sets the party’s transform to its own start in _on_party_wiped(). I left that alone and added a call right after it to a new method, wake_inside(), on the module that handles dungeons.

The module has one new field, started_in, which is the id of the dungeon the game began in. start_inside() sets it on its last line. wake_inside() does nothing and returns false when the field is empty, so a game begun anywhere else is sent where it always was. Otherwise it looks the dungeon up. In a world scene the world streamer may have put the dungeon away behind the party, so it asks the streamer to stand it again first. If the dungeon still isn’t built it warns and returns false, so a wipe can’t strand the party.

With the dungeon found, it takes the dungeon’s start transform and puts the party at its origin, facing the way a new game faces, with no pitch and zero velocity. Then it tells the streamer to settle. The rest of a wipe is unchanged. Everyone is restored, what the party carries stays with it, unspent juice is left where the party fell, no game time is lost and the same screen shows. Only a new game started inside the site begins with nothing, so a wipe doesn’t strip the party a second time.

The place a game began has to survive a save and a load, or a loaded party would still go to the plant. save_state() writes it as dungeons.started_in, only when there is one, so every other save is as it was. A save made before this has no such field and nothing else in it says where the game began, so its wiped party still wakes at the plant. That only matters for my own test saves of the slice, and I filed it.

Two more doors that want keys off bodies

The first door like this was the Ward Door. I’d said a few doors should need keys from relevant bodies scattered around the level, so this time I had a worker propose two more. They’re my own judgment calls so far, and I haven’t gone over them in the game yet.

The Cell 26 door wants the Night Key, which is on a dead night warden lying in a bunk in the south bunk room, past the crawl. The Cell 27 door wants the Feed Key, which is on a dead dietician sitting against the cold store in the kitchen with the ladle in her hand. The Facility Key opens neither, so it now opens 7 doors instead of 9. Both doors are pick difficulty 1, like the other key doors.

Each one is a door refinement in the dungeon file, and a door with a key_item is left out of the site key’s list:

"door@24,10": {"name": "Cell 27 Door", "key_item": "breakout_feed_key", "difficulty": 1},
"door@24,6":  {"name": "Cell 26 Door", "key_item": "breakout_night_key", "difficulty": 1}

The keys live in content/items/keys.json, each naming the door it locks. The bodies are four new NPC files, all dead: true with one dummy dialog line, seated by adding npc things to the dungeon file’s added list and naming each with a refinement. Behind the two doors lie dead Subject 26, who carries a clotting draught, and Subject 27, who carries a juice ampoule. Their bodies are stand-ins, the NPC’s own model laid down and darkened, until the subjects get bodies of their own.

I also found that the crawl tunnel at (27,3) lets the party into the first subject’s cell from the east corridor, so that door keeps nothing out. It’s my own drawing, so I left it and filed it as a question.

What I checked

The new test, slice_fates, has 114 checks and passed with none failing. It checks that each door refuses with no key and with the Facility Key and opens to its own key, that each key is on its body and the body is reachable from the vat past no locked door, and that the Ward Door, the security door and floor 2’s cage are as they were. It also covers a wipe waking on the start square, with the party restored and carrying what it carried, also after a save, a load and a cold start from that save. A party begun outside is sent to the level’s own start.

I haven’t run a wipe in the real world scene, or on floors 2 to 4. The branch of wake_inside() that stands a put-away dungeon again is written for the world scene but I haven’t run it there.

Eight captioned frames from the film in two columns: the locked cell door, the dietician’s body, the Feed Key taken, Subject 27’s body, the ampoule taken, the wipe screen, the wake in the vat, and the cell still open.
The film's frames in order, each with its caption.