Birdoggydog's Builds

Climbing ladders by hand instead of by script

Ladders stopped taking the controls away. You hold E to grab on, climb at your own pace, and open the hatch above before you go through.

Ladders in the game are climbed by hand now. Press E on one to take hold, use forward and back to go up and down, and jump to let go. Hatches over a ladder are shut until you open them with E, and I stopped the old scripted climb that broke about half the time.

32 seconds. Taking hold of a ladder, climbing up and down, opening a shut hatch from the rungs, stepping off at the top and jumping off part way.

Why did half the ladders break?

I tried every ladder I could find and about one in two broke or locked the party in place. I’d guessed the climbing animation was the problem. The cause turned out to be how the climb worked. It took the controls away from the player and moved the party along the ladder by game time. It also switched the hatch’s collider off for the climb and back on at the end. Taking the controls and toggling a collider behind the party is what went wrong, and nothing does either of them any more.

So I asked for the simplest thing that couldn’t do that. You hit E to climb, you move up and down yourself, and you can jump off if you want. I also wanted hatches and doors over ladders to be opened first, because those had the same problem.

How does the hold work?

There is now a state on the party, Party.ladder. While it is set, the party’s physics step asks the ladder to move it, in place of walking and falling:

if ladder != null and ladder.hold(self, input, delta):
    _update_camera()
    _update_focus()
    return

hold() returns true when it moved the party this step and false to let go. The ladder class extends a small base class, PartyHold, which lives in the actors package so the party script doesn’t have to name a class from the levels package.

Forward climbs at 2 m/s and back climbs down. A duct is still crouched and still 0.8 m/s. The speed is in physics time now, so it’s the player’s pace and not the game clock’s. The ladder used to be 1.2 m/s, and I made the new one faster. At the foot the party steps off onto the floor. Past an open hatch at the top, it glides 0.35 meters over to the floor beside the hatch. Jump lets go anywhere, and the party falls.

What happens at the hatch?

A hatch over a ladder is a solid body while it’s shut. So are a duct’s top grate and a ceiling vent’s grate. E opens one, from the rungs under it or from the floor beside it, and a climb stops with your head under a shut one. A lid swings open over 0.4 seconds of game time. It only ever opens, and it stays open. You can’t open one while standing on it.

A ceiling vent has a second grate under the hole, and it works the same way. If the party falls into the shaft and lands on the shut grate, a grip in the middle of the shaft lets you take hold again.

Saving is refused on the rungs, and the message says “get off the ladder first”. A load lets go of the ladder.

Also done

  • tests/ladders_tour loads the five tour dungeons and climbs all 18 ladders, ducts and ceiling vents both ways, opening the hatch, stepping off and jumping off half way. It runs 330 checks.
  • The older ladder and duct tests and five films were ported to the hand climb.
  • I haven’t confirmed the speeds, E not letting go, or the hatch staying open. They are my choices for now.