[SUG] End-of-play conditions

Started by WillLem, May 09, 2023, 02:31:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Which would you prefer when the timer runs out? (in both of these cases, visual and sound cues will alert the player that the overtime state is active)

Lemmings walk past the exit and remain active in the level (i.e. skills will be assignable to them)
3 (33.3%)
Lemmings fall asleep in front of the exit, remaining stationary and non-assignable (thus simulating exit behaviour without actually exiting)
6 (66.7%)

Total Members Voted: 9

Voting closed: May 15, 2023, 01:49:34 AM

WillLem

I went down something of a rabbit hole with the end-of-play conditions yesterday. Here's what I've come up with:

:) Single-lemming Levels
If the initial lem count is 1, and 1 lemming dies, then the level doesn't end. This works nicely, and obviously works for levels with cloners as well (since, if the lemming is cloned once, and then 1 lemming dies, there is still another lemming in the level to keep it active. If that lemming then dies, the level should end anyway).

The only thing I'd like to add here is some sort of on-screen message such as "No lemmings remain. Rewind, Restart or Exit" to make it clear that there's a reason play is continuing with no lemmings on-screen.

If this works, the behaviour could extend to any condition where no lemmings remain (including when only zombies remain, which brings us nicely to...)

:sick: Only Zombies Remain
Ideally, now that we have a Kill All Zombies talisman, we don't want levels to end when only zombies remain. Thankfully, the talisman code includes a CheckForZombiesKilled method which can be used to prevent the level ending unless it returns true. That part ended up being easy enough (although further testing is needed to make sure that it behaves properly in all cases).

However, there is still the problem of what to do when only zombies remain and the user nukes. At the moment, the level ends instantly (only 1 frame of nuke animation is seen; the beginning of the countdown appears above one or two zombies); I've scoured the code and can't find any obvious cause for this, but ideally we want the nuke animation to play out before the level ends, otherwise it looks like an unintentional bug. It's not massively important, since it's purely aesthetic, but I do want to tidy up as many of these loose ends as possible.

:excited: Time Is Up
This has ended up being my favourite one to work on. The 'lems freezing mid-exit' behaviour is gone for now (since I always thought it looked a bit buggy), but I've left the code in comments in case we want to bring it back for any reason.

We still have our "overtime" period, where the time counter starts counting upwards in purple, and no actions taken during this period count towards the level result. But, I've made a few improvements:

Instead of freezing mid-exit, lems now fully exit and then re-spawn from the entrance hatch, creating an infinite loop which allows the player to start from the beginning of the level and work their way across again (with all previous skill usage - builder bridges, basher tunnels, etc - still present on the map). To compliment this, the skill count is set to infinite-of-each so that the player can fully experiment with the available skillset (although, at present, it isn't possible to assign skills to re-spawned lems - not sure why ???).

If I can get this fully working, it seems a shame to relegate this behaviour only to levels with time limits (especially since most levels tend to get made without time limits nowadays). It might be worth creating a hotkey which allows the player to activate this mode on the fly, for example if they're stuck on a level. Doing so would obviously have to instantly fail the level (so, if the level is exited during this state, the level would count as a no-solve), whilst pressing the hotkey again could revert to the previous state (before the hotkey was first pressed), so that the level can be completed from there if the player has come up with a solution in the meantime. This is pie in the sky at the moment, but the behaviour itself works perfectly for TimeUp conditions and can therefore be tested for potential usefulness elsewhere.

Plenty to think about.

Proxima

Quote from: WillLem on May 09, 2023, 02:31:58 PMInstead of freezing mid-exit, lems now fully exit and then re-spawn from the entrance hatch, creating an infinite loop which allows the player to start from the beginning of the level and work their way across again (with all previous skill usage - builder bridges, basher tunnels, etc - still present on the map). To compliment this, the skill count is set to infinite-of-each so that the player can fully experiment with the available skillset (although, at present, it isn't possible to assign skills to re-spawned lems - not sure why ???).

If I can get this fully working, it seems a shame to relegate this behaviour only to levels with time limits (especially since most levels tend to get made without time limits nowadays). It might be worth creating a hotkey which allows the player to activate this mode on the fly, for example if they're stuck on a level. Doing so would obviously have to instantly fail the level (so, if the level is exited during this state, the level would count as a no-solve), whilst pressing the hotkey again could revert to the previous state (before the hotkey was first pressed), so that the level can be completed from there if the player has come up with a solution in the meantime. This is pie in the sky at the moment, but the behaviour itself works perfectly for TimeUp conditions and can therefore be tested for potential usefulness elsewhere.

Following on from our discussion on discord:

* "Practice mode" is a nice idea if it isn't too much dev work -- it would let you experiment with parts of a level that are difficult to reach, or possibilities that are awkward to try out because the limited skillset makes them difficult to even set up. However, if it is implemented at all, it definitely shouldn't be restricted to levels with time limits.

* Practice mode should not be automatically entered on time up -- that would confuse more than it would help. When time ends, the main reason for wanting to keep playing is to know how close you were, how much longer it would have taken -- and for this, you want to keep the level's skillset restriction.

* I cannot see a reason why the player would want the behaviour of exiting lemmings respawning at the trapdoor. It creates states that cannot arise during normal play and so doesn't help towards finding a solution. If you just want to play around with a level, full-on practice mode is the way to go. (As we discussed, practice mode could include the feature of allowing the player to click to spawn a lemming anywhere.)

* If you don't like NL's behaviour of lemmings freezing at the level exit after time up, then as you suggested, the most natural alternative is that level exits stop working and the lemming walks past. However, there is some possibility of lemmings walking past the exit getting mixed in with other lemmings and creating a state that couldn't arise in normal play -- NL's behaviour is the cleanest way of preventing this. But it's not a very likely scenario.

WillLem

Appreciate the feedback, Proxima. It's helpful because it's very easy for me to get carried away with an idea like this one! To address your feedback:

Quote from: Proxima on May 09, 2023, 08:29:59 PM
"Practice mode" is a nice idea if it isn't too much dev work ... However, if it is implemented at all, it definitely shouldn't be restricted to levels with time limits.
---
Practice mode should not be automatically entered on time up

Yes, agreed on all points. I think I came to cross-purposes with the TimeUp ideas; these would be a much better fit for a Global "Practice Mode" that could ideally be accessed any time by pressing a hotkey to toggle it.

I image that "P" for "Practice" could be displayed onscreen somewhere, skills would be set to infinite-of-each, lems would be spawnable by Ctrl-clicking anywhere onscreen (credit to Eric Lang for this idea), time limit would probably display in purple and count upwards, like TimeUp (to reinforce the idea that purple timer = not part of regular gameplay), etc. I'll make a topic for this at some point.

For now, let's keep the discussion to the end-of-play behaviours.

Quote from: Proxima on May 09, 2023, 08:29:59 PM
I cannot see a reason why the player would want the behaviour of exiting lemmings respawning at the trapdoor

Well, I was playing around with the possibilities to try and find something better than the current mid-exit-animation lem cluster; I first changed it so that the exit animation completes, but they don't count as actually being saved - that was easy enough to manage, but there is obvious potential for this to confuse the player. So then I thought - well, why not have them spawn back in through the entrance hatch!

I think at first I just liked the idea and wanted to see if I could make it happen. After a bit of tinkering I got it to work, but the method I used is flirting with disaster as far as the ListIndex (the epicentre of lemming existence!) is concerned, and so probably isn't a great idea from either a programming or a gameplay point of view. Still, it's fun to watch :lemcat:

But yeah, joking aside - consider this idea retracted. Still need to know what to do about the TimeUp/janky-exit-animation combo though.

Quote from: Proxima on May 09, 2023, 08:29:59 PM
If you don't like NL's behaviour of lemmings freezing at the level exit after time up, then as you suggested, the most natural alternative is that level exits stop working and the lemming walks past

I've ended up doing this for now. It's tidy enough and works well, and I'll likely display an alarm clock graphic vertically above (not covering, as I previously suggestion) the exit, just to make it extra clear what's happening.

WillLem

#3
Quick summary of where we're up to with all this:

Single-lemming levels - play now continues if 1 lemming is lost in these levels. So, for levels that start with 1 lemming but have cloners, play continues as normal once the lemming has been cloned.

Only zombies remain - play now continues when only zombies remain. I might add a check for the KillAllZombies talisman to this, but haven't yet decided. I can think of other scenarios where the player might prefer to have the option to rewind from the end rather than restart from the beginning. It's also consistent with blockers remaining, neutrals remaining, etc.

Time is up, and the save requirement is met - reading back over this topic again, I was reminded that gameplay continues if time has run out even if the save requirement has been met. This is now fixed so that the gameplay ends and we exit to the postview screen in this case, which I think we can agree is preferable in the majority of scenarios.

Time is up, and the save requirement is not met - we enter "overtime" mode (with purple timer) as usual, but the lemmings now walk past the exit. I'll also add an 'alarm clock' graphic vertically above the exit to signal to the player why lems are no longer allowed to exit, but I need to figure out how to draw overlays to the screen for this.

No lemmings remain (including zombies) - this is a tough one. Continuing play is actually not that great, having had the chance to try it in practice. It's potentially confusing; the player is right to expect something to happen in this scenario. So, maybe an option to continue play or exit to postview is best here; postview by default, but players can make an informed choice to have "continue" behaviour if they wish. We likely also want to draw a prompt to the screen in this case, as well.

jkapp76

I like the idea of the exits locked after time is up.

One more possibility would be to play the old Failed end-time jingle after the time is up. This would be very clear something negative happened. I liked the old jingles, but they seemed to me that they should have been accompanied with a lemming with his thumb up or something like Revolutions... and a sad face for losing.

I like all the other ideas.
...Jeremy Kapp

WillLem

Quote from: jkapp76 on May 09, 2023, 11:16:15 PM
One more possibility would be to play the old Failed end-time jingle after the time is up. This would be very clear something negative happened

I'm thinking draw an alarm clock above the exit; that way, when the existing alarm bell sounds, these elements will complement each other.

WillLem

#6
Well, it turns out that the styles will be getting another update in the next version of SuperLemmix (namely, the Blocker sprite will be updated). So, I'm wondering if it might be worth creating a new lemming state: the Sleeper, for the specific purpose of falling asleep in front of the exit when time is up (and, being non-assignable whilst in this state).

The reason being that, as quoted from namida on Discord:

Quote from: namida
FWIW, the reason behind freezing them there is that it allows the player to experiment with things that are close but miss the timer. If the lemmings walked past ... they could be used in ways that couldn't be done in an actual solution

So, added a poll to see which people would prefer. Imagine you're playing a level and time runs out: what do you want to happen? Bear in mind the following:

:lemming: Lemmings walking past the exit keeps them active, allowing those lems to be used to experiment with new solution possibilties without having to rewind/restart. It's inaccurate to the state of the actual level, but potentially provides new thinking angles from which to construct an eventual solution.

:lemming: Having the lemmings remain stationary (but non-assignable) in front of the exit simulates the exact conditions of the lemming exiting (and thus being removed from the level), which is a more limited but also more accurate state within which to work on a solution.

WillLem

#7
OK, there seems to be enough support for the idea of a stationary, non-assignable lemming state for reaching the exit after time is up. I've made the Sleeper animation and given it a quick test run. It works nicely, and turns the lemming into a neutral (recolouring is applied).

Removing the ground under a Sleeper just allows them to drop whilst still in the Sleeper state, similar to an OhNoer being able to drop.




Oh, incidentally, gameplay now exits to postview when in Classic Mode. Yes, it's possible to Rewind (but not Framestep backwards) when in Classic Mode, but I feel it's more appropriate to the spirit of this mode to just end gameplay and exit to postview.

WillLem

#8
OK, there seems to be enough support for the idea of a stationary, non-assignable lemming state for reaching the exit after time is up. I've made the Sleeper animation and given it a quick test run. It works nicely, and turns the lemming into a neutral (recolouring is applied).

Removing the ground under a Sleeper just allows them to drop whilst still in the Sleeper state, similar to an OhNoer being able to drop.

The only real hurdle with this so far has been the lem count: since the Sleeper lem isn't actually removed from the level (if they were, they'd vanish), it was necessary to find a different way to reduce the "Lemmings Out" value. I couldn't just call Dec(LemmingsOut); because that caused the count to reduce all the way to 0 (and beyond) for only a single lem becoming a Sleeper; the state is handled per-frame, so the count was reduced by 1 each frame when attempting to do it that way.

The solution I've gone with is to instead Dec(LemmingsOut) only on the first frame of the animation; this might seem trivial, but it's actually quite important. Since the Sleeper sprite loops from frames 8-12, once a lem has become a Sleeper, they'll never enter the first frame again. This avoids all kinds of complexity with indexing and removal types, but I'm not yet sure whether it might cause issues elsewhere. Unlikely, and tbh the overtime mode is rarely encountered in normal gameplay anyway, but it's worth keeping an eye on.

Anyway, time permitting I can get the sprites made and hopefully have the Sleeper up and running (no oxymoron intended) by the next update.




Oh, incidentally, gameplay now exits to postview when in Classic Mode. Yes, it's possible to Rewind (but not Framestep backwards) when in Classic Mode, but I feel it's more appropriate to the spirit of this mode to just end gameplay and exit to postview.

WillLem

#9
Animated Zs unfortunately don't work for the Sleeper: when multiple lems have bunched up at the exit trigger, unfortunately it just ends up looking messy, which is what I'm trying to avoid by implementing the Sleeper in the first place. So, I opted to have them put on a purple sleeping hat (like the new Exit sign lem!)

Also, as added bonus, hovering over the lem shows if they have any permanent skills assigned. Could be useful, but - again - probably not when there is a massive bunch of them...!



Incidentally, when time is up and there are no lemmings out (including zombies), gameplay now ends (as of the next update).

Floyd Brannon

#10
I was set to vote against the sleeper. But after some thought and seeing the artwork I decided to vote in favor of it.

About the sleeper animation: You might be able to use part of the splat animation from Lemmings 2. In Lemm2 they don't always die but bounce with stars over their head and get back up. It might look nice to have these guys bounce to that same sleeping position. Maybe even have a temporary z zz zzz over their head instead of the stars?

I'm not wild about their skills floating above them. This could be messy with too many lemmings.

WillLem

Quote from: Floyd Brannon on May 12, 2023, 02:57:47 PM
In Lemm2 they don't always die but bounce with stars over their head and get back up. It might look nice to have these guys bounce to that same sleeping position

If you can source the sprite I'll have a look at it, sure.

Quote from: Floyd Brannon on May 12, 2023, 02:57:47 PM
Maybe even have a temporary z zz zzz over their head instead of the stars?

I tried this. It starts to look very messy very quickly as more and more lems build up in the same spot.

I suppose one possibility might be to have a single lem become a Sleeper, then for all subsequent lems to check if there is a Sleeper at their XY position, and if so then be removed from the level after a certain number of frames. I'm unsure if lems can check for specific states though... either way, any lems that are Sleepers would have a Sleeper at their XY position (i.e. themselves!), so that would also need to be accounted for. Might be doable, we'll have to see.

Quote from: Floyd Brannon on May 12, 2023, 02:57:47 PM
I'm not wild about their skills floating above them. This could be messy with too many lemmings.

Well, code exists for a permanent skill remover, so I suppose that sleeping lems could also have any permanent skills removed. Or, see if the helper graphics can be hidden when a lem is a Sleeper, something like that.

Floyd Brannon

#12
I apologize in advance for the quality of this animation. It's a series of small screenshots taken from Lemmings 2.

This is every frame of the non-death splat.

I think it would look great for the lemming to go from the standing position and then bounce once straight into sleeping like this.

Or, if you play the last few frames of him getting up in reverse it looks like he carefully lays down.

WillLem

Quote from: Floyd Brannon on May 14, 2023, 01:25:17 AM
It's a series of small screenshots taken from Lemmings 2

Ideally, I'd need it in a single sprite animation in order to test it in-game. See styles/default/lemmings for examples of how they're laid out if you want to have a go at making it.

Don't worry if you don't want to do this though, I'm pretty happy with the sprite I've made already tbh. The lemming just puts his sleeping hat on and lays down, here's a demo:


jkapp76

This sleeper looks great! I kinda wish he'd stand there another frame or two after putting his hat on though.
...Jeremy Kapp

Floyd Brannon

Your sleeper already looks about the same or better. I didn't know you had it this far done.
It's more polished than having them all stuck at the door for sure.

WillLem

Quote from: jkapp76 on May 14, 2023, 11:19:58 PM
This sleeper looks great! I kinda wish he'd stand there another frame or two after putting his hat on though.

I've made the work-in-progress sprite 24 frames long with a loopback to frame 16; this is so that there's 8 frames of playing room with things like timing etc before we settle on a final version.

In the ones I sent you, try setting the loop to a later frame (such as 20 - this is done in scheme.nxmi under $SLEEPER) and then copy 4 frames of just "standing up" before the lem begins to lie down. Since the last 8 frames are identical, they can just be overwritten as needed.




EDIT: Incidentally, the poll closed at 6:3 in favour of the Sleeper, so I think we can call it there.

WillLem

Just a quick post to clarify the end-of-gameplay conditions update in 2.7 8-)

SuperLemmix will be getting some of this proposed NeoLemmix update, but not all of it - namely, the config options won't be included.

Instead, the most favourable behaviour based on each individual gameplay condition has been selected as the default. This is because the end-of-gameplay checks are considerably more complex in SuperLemmix due to Classic Mode, the Kill All Zombies talisman and the existing update to "Time Up" behaviour (which I'd like to keep in SLX, but which doesn't exist in NL).

To specify exactly what will happen, here's a handy list.




:lemming: Exit to Postview

In Classic Mode, any end-of-game condition results in exiting to the postview screen. This is partly to keep it old school, but also to keep it simple.

In Modern Mode, the game will exit to postview if any of the following conditions are met:

  • The save requirement is met and no lemmings remain (this only includes zombies iff there is no Kill All Zombies talisman).
  • The save requirement is met and time has run out.
  • The nuke has been activated at any time (this also acts like a killswitch if the game has frozen).

:lemming: Freeze Game & Display Minimap Message

The game will freeze and display the "No lemmings remain" message in the minimap area only if the save requirement is not met and no lemmings remain (this only includes zombies iff there is no Kill All Zombies talisman).

:lemming: Overtime

The game will continue into overtime only if the save requirement has not been met.

:lemming: Zombies-only

The game will continue into a "zombies only" state only if zombies remain and there is a Kill All Zombies talisman. If time runs out during this state, the game will exit to postview.




Essentially, it closely resembles the option "Exit To Postview if Save Requirement Met" from the proposed NeoLemmix version of this feature, albeit with a few subtle differences to line up with how I personally think end-of-game behaviour should work for each of the specified conditions.

If people think it's worth it, I'd be happy to also implement a check for a "Save 100%" talisman, to keep gameplay active beyond the save requirement being met in the event of this talisman existing in the current level. Either that, or perhaps a single "Never End Gameplay" bool which ignores all conditions (possibly even including Classic Mode) - again, if people think it's worth doing.

For now though, the above is standard across the engine as I believe it to be the best possible behaviour in all conditions.