Spelunky is © 2008, 2009 Derek Yu and Mossmouth, LLC, and is used under the [Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt). spelunky.ai is an unofficial fan project, not affiliated with or endorsed by Mossmouth. The game and its assets may not be sold.

Music by George Buzinkai and Jonathan Perry; sound effects made in SFXR. From Spelunky Classic 1.1, © 2008, 2009 Derek Yu and Mossmouth, LLC.

# Dark rubble landing off-centre

From the spelunky.ai wiki: <https://spelunky.ai/wiki/dark-rubble-off-centre>. Verified against the spelunky.ai port [v0.1.11](https://github.com/851-labs/spelunky/releases/tag/v0.1.11) on 28 October 2026.

Dark rubble landing off-centre is a quirk of Spelunky Classic in which the Ice Caves' rock leaves its rubble 8 pixels right of and below where it should.

| Quirk     |                                                                                                                                                                                                        |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Status    | GML + Oracle                                                                                                                                                                                           |
| Where     | [`objects/oDark/destroy.gml:5-7`](https://spelunky.ai/wiki/source/objects/oDark/destroy#L5-L7)                                                                                                         |
| Pinned by | `fidelity/replays/terrain-dark-rubble-off-centre.txt`                                                                                                                                                  |
| Row       | [docs/quirks.md §1, Bugs and leftovers in the 1.1 source](https://github.com/851-labs/spelunky/blob/main/docs/quirks.md#1-bugs-and-leftovers-in-the-11-source): “Dark rock's rubble lands off-centre.” |

A block that breaks leaves three pieces of rubble around its middle. The [Ice Caves](https://spelunky.ai/wiki/ice-caves)' dark rock, and
the [mothership](https://spelunky.ai/wiki/mothership)'s hull, leave theirs off-centre, to the right of where the block stood and below
it, because of a typo in the line that places them: `rand(0-8)`, a minus where a comma should be.

## What happens

The player breaks a brick with a [Mattock](https://spelunky.ai/wiki/mattock), and its rubble falls where the brick stood. He jumps a pit
and breaks a block of the Ice Caves' dark rock: its rubble comes out to the right of the block and below it, and
falls past the block's edge[^1].

**Clip: Dark rock's rubble lands off-centre.** The player breaks a brick with a mattock, and its rubble falls where the brick stood. He jumps a pit and breaks a block of the Ice Caves' dark rock: its rubble comes out to the right of the block and below it, and falls past the block's edge. ([video](https://spelunky.ai/wiki/media/clips/quirks/dark-rubble-off-centre/clip.mp4))

## Why

A brick's destroy event puts each piece of its rubble at the block's middle, plus or minus up to 8 pixels:

```gml objects/oBrick/destroy.gml:5
    instance_create(x+8+rand(0,8)-rand(0,8), y+8+rand(0,8)-rand(0,8), oRubble);
```

[`objects/oBrick/destroy.gml:5`](https://spelunky.ai/wiki/source/objects/oBrick/destroy#L5), from `spelunky.gmk`, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC ([Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt)).

The dark rock's has `rand(0-8)` in place of the second `rand(0,8)`:

```gml objects/oDark/destroy.gml:5-7
    instance_create(x+8+rand(0,8)-rand(0-8), y+8+rand(0,8)-rand(0-8), oRubbleDark);
    instance_create(x+8+rand(0,8)-rand(0-8), y+8+rand(0,8)-rand(0-8), oRubbleDarkSmall);
    instance_create(x+8+rand(0,8)-rand(0-8), y+8+rand(0,8)-rand(0-8), oRubbleDarkSmall);
```

[`objects/oDark/destroy.gml:5-7`](https://spelunky.ai/wiki/source/objects/oDark/destroy#L5-L7), from `spelunky.gmk`, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC ([Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt)).

`0-8` is one argument, -8. `rand` returns a whole number from its first argument to its second[^2], and the missing second is 0, so `rand(0-8)` is -8 to 0. Subtracted, it adds 0
to 8, and the rubble lands 8 to 24 pixels right of and below the block's corner, where `rand(0,8)-rand(0,8)`'s -8
to 8 centres it on the block. Both draw the same random numbers, so only the rubble's place differs. The
mothership's hull has the same line[^3][^4].

## Reproducing it

Break any block of the Ice Caves' dark rock, with a bomb or the Mattock, and watch where its rubble starts. The
replay of the clip's staged scene, a custom level, has a brick and a block of dark rock each over a pit. The
brick's rubble starts over the brick's own place; the dark rock's starts 13 to 23 pixels right of its corner
and 16 to 19 below it, and falls past its right edge[^5]. In play, a bomb that breaks the hull of
the mothership leaves the same off-centre rubble[^6].

## 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[^4], and the oracle's fingerprint of the replay pins every piece's place. No option turns it off.

## FAQ

### Why does the Ice Caves' rubble fall to the right of the block?

The line that places it has a typo: `rand(0-8)` where it means `rand(0,8)`. That draws a number from -8 to 0 instead of 0 to 8, and subtracting it puts the rubble 8 to 24 pixels right of and below the block's corner, not around its middle.

### Does the mothership's hull do it too?

Yes. The [mothership](https://spelunky.ai/wiki/mothership)'s hull has the same line, so its rubble lands off-centre as the rock's does.

### Does it change anything but where the rubble falls?

No. Both lines draw the same random numbers, so what comes after is the same; only the rubble's place differs.

## See also

- **Related:** [The Ice Caves](https://spelunky.ai/wiki/ice-caves), [Mothership](https://spelunky.ai/wiki/mothership)

## References

[^1]: Clip quirks/dark-rubble-off-centre

[^2]: [`scripts/rand.gml:1-2`](https://spelunky.ai/wiki/source/scripts/rand#L1-L2)

[^3]: [`objects/oAlienShip/destroy.gml:3-5`](https://spelunky.ai/wiki/source/objects/oAlienShip/destroy#L3-L5)

[^4]: Quirk 1 (docs/quirks.md)

[^5]: Replay `fidelity/replays/terrain-dark-rubble-off-centre.txt`

[^6]: Replay `fidelity/replays/ice-seed-63-barrier-through.txt`

### Source code

- [`objects/oDark/destroy.gml`](https://spelunky.ai/wiki/source/objects/oDark/destroy)
- [`objects/oAlienShip/destroy.gml`](https://spelunky.ai/wiki/source/objects/oAlienShip/destroy)
- [`objects/oBrick/destroy.gml`](https://spelunky.ai/wiki/source/objects/oBrick/destroy)
- [`scripts/rand.gml`](https://spelunky.ai/wiki/source/scripts/rand)
