One caveman's sight alerting the rest
Verified against the spelunky.ai port v0.1.10 on .
One caveman's sight alerting the rest is a quirk of Spelunky Classic in which a caveman seeing the player sets every caveman and hawkman near him charging.
A Caveman charges when it sees the player, but it isn't its own sight that decides. When any of them sees him, every Caveman and Hawkman close to him charges, whichever saw him: one walled off from him, or one facing away, which charges away from him. The one that saw him may not charge at all.
What happens
#A Caveman walking back toward the player sees him while still far off, and walks on. A Hawkman walled in under his feet, which can't see him, starts charging. A little later the Caveman, now close, charges too [1].
Why
#Every 6 steps, a Caveman, a Hawkman or a Yeti that's standing or walking sends a sight check
(oEnemySight) the way it faces, 10 pixels a step, which the first block it touches destroys
[2] [3].
When one reaches the player, it doesn't alert the monster that sent it. It alerts all of them near him:
with oCaveman
{
if (distance_to_object(oPlayer1) < 100 and status < 98)
{
status = 2;
playSound(global.sndAlert);
}
}objects/oEnemySight/collision_oCharacter.gml:1-8, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).The same follows with oHawkman [4]. So every
Caveman and Hawkman within 100 pixels of the player that isn't stunned or dead charges (status 2), whichever
way it faces and whether or not it could see him, and a charge runs the way it faces. The one that sent the
check charges only if it's within those 100 pixels too. There's no with oYeti, so a Yeti's sight sets off
the others, but no Yeti [5].
Reproducing it
#Let a Caveman or a Hawkman see the player while another is near him behind a wall, or facing away: the second one charges. Play reaches it wherever they live, Cavemen in the Mines, the Jungle and the Temple, Hawkmen in the Temple. The replay of the clip's staged scene, on a custom level, has a Caveman's sight reach the player while it's still more than 100 pixels from him, and a Hawkman walled in under him charge; the Caveman charges once a later look finds it within 100 pixels [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 [5], and the oracle's fingerprint of the replay pins who charges when. No option turns it off.
FAQ
#- Why did a Caveman charge that couldn't see me in Spelunky Classic?
Another one saw the player. When any Caveman's, Hawkman's or Yeti's sight check reaches him, every Caveman and Hawkman within 100 pixels of him charges, behind a wall or facing away.
- Does the Caveman that sees the player always charge?
No. It charges only if it's within those 100 pixels too: one that sees him from farther off walks on until a later look finds it close enough.
- Does a Yeti's sight set off Yetis?
No. A Yeti's sight sets off the Cavemen and Hawkmen near the player, but the code has no line for Yetis, so a Yeti never charges (Yetis never charging).
See also
#References
#- Clip quirks/caveman-sight-alerts-others
objects/oCaveman/step.gml:116-125objects/oEnemySight/collision_oSolid.gml:1objects/oEnemySight/collision_oCharacter.gml:10-17- Quirk 1 (docs/quirks.md)
- Replay
fidelity/replays/enemy-caveman-sight-alerts-hawkman.txt