SpelunkyFan wiki

Cavemen sliding off ledges

Verified against the spelunky.ai port v0.1.10 on .

Cavemen sliding off ledges is a quirk of Spelunky Classic in which a caveman stopping at a ledge slides on past its edge, and off it the next time.

A Caveman walks back and forth, and stops when it reaches the edge of a ledge, as the Temple's Hawkmen and the Ice Caves' Yetis do. Only the Caveman's stop doesn't hold: it slides past the edge, and the next time it heads that way it slides off, so Cavemen come down from their ledges where the others stay put.

What happens

#

A Caveman and a Hawkman walk to the edges of their platforms and stop. The Hawkman stops dead; the Caveman keeps sliding, stops at the edge again and slides off it, dropping to the floor below [1].

A caveman slides off the ledge it stops at. A caveman and a hawkman walk to the edges of their platforms and stop. The hawkman stops dead; the caveman keeps sliding, stops at the edge again and slides off it: its walk sets its speed back after stopping it.

Why

#

Walking, a Caveman tests for floor past its front edge, and where there's none, it stops: it goes back to standing (IDLE) and sets its speed to 0. But the line that sets its walking speed comes after the test, so it moves on in the same step:

    if (facing == LEFT)
    {
        if (not collision_point(x-1, y+16, oSolid, -1, -1))
        {
            status = IDLE;
            counter = rand(20,50);
            xVel = 0;
        }
        xVel = -1.5;
    }
objects/oCaveman/step.gml:88-97, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).

Its friction takes 0.1 off a step, and 0 below 0.5 [2], so it stands with its speed running down from 1.5, and slides about 10 pixels: past the edge, but not off it. When it sets off that way again, the test finds no floor at once, and it stops and slides again, off the edge this time [3].

The Hawkman and the Yeti walk with the same code, with the two lines the other way round: the speed first, then the test, which sets it to 0 [4]. So they stop dead.

Reproducing it

#

Watch any Caveman on a ledge in the Mines, the Jungle or the Temple: its first stop at an edge takes it over the edge, and its second at the same edge takes it off. The replay of the clip's staged scene, on a custom level, has a Caveman and a Hawkman stop at their platforms' edges on the same step, the Hawkman dead and the Caveman sliding on; the Caveman stops there again and falls, and the Hawkman never does [5].

In the port

#

The spelunky.ai port reproduces it exactly: it's in docs/quirks.md's list of the 1.1 source's bugs [3], and the oracle's fingerprint of the replay pins the slide. No option turns it off.

FAQ

#
Why do Cavemen fall off ledges in Spelunky Classic?

A Caveman that reaches a ledge stops, but its code gives it its walking speed back in the same step, so it slides about 10 pixels on. The next time it walks that way it's already past the edge, and the same slide takes it off.

Do Hawkmen and Yetis fall off ledges too?

No. They walk with the same code, with its two lines the other way round, so they stop dead at an edge.

Can a Caveman be lured down from a ledge?

It comes down on its own: the second time a Caveman walking on a ledge stops at the same edge, it slides off it.

See also

#

References

#
  1. Clip quirks/caveman-ledge-slide
  2. objects/oCaveman/step.gml:198-200
  3. Quirk 1 (docs/quirks.md)
  4. objects/oHawkman/step.gml:87-106
  5. Replay fidelity/replays/enemy-caveman-ledge-slide.txt

Source code

#