[BUG][✓] Lemmings get trapped at the top of the level

Started by hrb264, May 21, 2026, 04:07:24 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

hrb264

Hi - I've noticed this happening on and off before but in Retrolemmini 3.0 there seems to be a bit of an issue with lemmings getting trapped at the top of the terrain even when their feet are still visible. I've just been trying to complete Gigalems 'into the furnace' and I have been having some issues with it because of this. I've attached my replay.

It could be that this is part of the game but I don't remember it happening before if so? Would anyone be able to take a look?

ericderkovits

Lemmings also get trapped at the ceiling not only in Retrolemmini, but also SuperlemminiToo

hrb264

Quote from: ericderkovits on May 22, 2026, 12:39:00 AMLemmings also get trapped at the ceiling not only in Retrolemmini, but also SuperlemminiToo

Yeah, to be clear I'm not saying it should be changed, but I noticed it happening a few times now and it was interfering with a solution i tried for the level (although I worked out how to complete the level without this)

WillLem

Confirmed.

This is happening because of a clash between these physics rules:

1a) The level must specify a top boundary of 0 or greater, with 8 being the default if none is specified
1b) In the level provided by hrb264 (attached here), the boundary is set to 0, so lems can build all the way to the top of the level
2) If a builder lemming is at or above the top boundary (usually 8, but 0 in this case), they will stop building
3) If a lemming encounters an obstacle that is too tall for them to step onto or their y-position is less than or equal to 8, they turn around - the latter of these conditions is symptomatic, which is the source of this bug

The first and foremost fix is to stop lemmings from building when they reach the default top position. This is easy, and fixes hrb264's example level/replay.

Preventing lemmings from repeatedly turning (which is what traps them at the top of the level if they reach a certain height) is harder: what should the condition be, and how can we make sure the fix doesn't create side effect bugs of its own?

It's too hot to think about this right now. I'll come back to it later.



P.S. I've also attached a level (Top of Level Test) which makes it possible to reproduce the bug:

1) Allow 1 lemming to walk up the stairs (contain the others with Blockers). They will turn around before reaching the thin platform and begin to walk back down the stairs
2) From the stairs, have them build up to the platform. The platform will stop them, they will turn around, step into the thin platform, and continuously turn around

If we can prevent this, the bug will be fixed for all levels, regardless of any other factors.


WillLem

This bug has brought about the question of whether levels should be able to mess with the level boundaries. Personally, I see no good reason to allow this. It's most likely a hangover from support for some early level format or something, i.e. it seems unlikely to be a desired and intentional physics feature.

I'm tempted to strip variable level boundaries out of the code (the Editor doesn't support it directly anyway), and maintain the default boundaries for all levels. This will make it much easier to then tighten up top-of-level physics.

As it stands for now, I've gone ahead and committed the Builder fix (i.e. Builders now always stop building at Y=8, making it practically impossible for a lemming to reach Y<8), but will soon come back to the top-of-level stuff later, likely in a separate topic.

This one can be considered resolved, then.

Fixed in RLPlayer commit f142f69.