Author Topic: [BUG] Timebomber skill count not resetting after Restart/Backskip  (Read 1672 times)

0 Members and 1 Guest are viewing this topic.

Offline ericderkovits

  • Posts: 912
    • View Profile
Here's something I stumbled across when trying out the new timebomber. Definitely a bug.

1) Timebomber count doesn't reset to value before placed when restarting.

https://www.youtube.com/watch?v=8aeZoJBEW-8

2) Timebomber count reduces in number when backwards framestepping even going back to 0 even when just using 1 Timebomber.

https://www.youtube.com/watch?v=cuNCAPpwNIM

This happens even when cloning the Timebomber.

No other skills(including Frezzer, Spearer or Grenader) have this issue.
« Last Edit: April 21, 2023, 12:49:28 PM by WillLem »

Offline WillLem

  • Moderator
  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
Hmm. Tricky one, this. I'm not 100% sure why it's happening, but I'll take a look at it and see if I can find a fix.

Offline WillLem

  • Moderator
  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
Done a little bit of testing, and there is even more to the bug than has been reported. I'll list the issues here for easy reference:

- Timebombers can be repeatedly assigned to the same lemming, deducting 1 from the skill count with each click (although the skill itself will only be performed once) - FIXED, this behaviour no longer occurs
- Each backwards framestep up to the original point of assignment subtracts 1 Timebomber skill from the total count - FIXED, this behaviour no longer occurs
- Restarting the level doesn't reset the count to its original amount - FIXED, this behaviour no longer occurs
- Bombers can be assigned to Timebombers during countdown - FIXED, this behaviour no longer occurs
- when highlighting a Timebomber, the display doesn't read TIMEBOMBER, it reads WALKER during countdown and then BOMBER during ohno/explosion phase - FIXED, this behaviour no longer occurs

So, the Timebomber is still not quite independent from the Bomber.

---

My inital thoughts are that this might be something to do with the fact that the Timebomber skill "borrows" code from the untimed-Bomber skill (which, it turns out, is actually a Timed Bomber with the countdown timer hidden and the timer count set to 1 frame instead of 85).

I'm expanding the code to separate out these skills as much as possible...
« Last Edit: March 08, 2023, 09:18:17 PM by WillLem »

Offline WillLem

  • Moderator
  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
Spent a few hours on this tonight, separated out as much of the Timebomber/Bomber code as I could and only managed 1 fix:

:tal-gold: Bombers/Freezers can no longer be assigned to a Timebomber during countdown phase :)
~ However, I needed to create a new "L.LemIsTimebomber" state to achieve this, using "baTimebombing" didn't work; this tells me that the Timebomber is not yet being seen as a skill in its own right, but rather a different trigger for the Bomber - EDIT: The L.LemIsTimebomber code has now been replaced with code which checks whether the countdown is > 0

EDIT: L.LemIsTimebomber eventually came in handy for directing the ExplosionTimer function specifically to Timebomber-specific code, thus fixing the issue of it not displaying the correct graphics or panel display.

However, the program is still not seeing baTimebombing as a legitimate state in its own right - EDIT: not a problem, as it turns out. This is because baTimebombing is the "OhNo!" phase, not the countdown phase; the only way to not allow certain skills to be assigned during countdown phase is to use the (countdown > 0) check.

It is still the case that, when highlighting a Timebomber, the display doesn't read TIMEBOMBER, it reads WALKER during countdown and then BOMBER during ohno/explosion phase, so I clearly need to further separate the two skills out. - EDIT: Fixed this using L.LemIsTimebomber

Meanwhile, the code for skill count isn't dependent on individual skills, nor is the code for framestepping, so I have no idea why it isn't working for this skill. - EDIT: This fixed itself during the skill separation process.

One things that's clear, though, is that "baTimebombing" is incomplete. I'm just not sure why/where/how.

I might have to start again from scratch in terms of making this a new skill
:forehead:
« Last Edit: March 08, 2023, 09:13:50 PM by WillLem »

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
You could also just check if the lemming's countdown timer is nonzero, rather than a special state. This would also prevent assignment of a timebomber to a lemming who is counting down due to the nuke (but still allow it for one the nuke has not yet reached).
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline WillLem

  • Moderator
  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
You could also just check if the lemming's countdown timer is nonzero, rather than a special state. This would also prevent assignment of a timebomber to a lemming who is counting down due to the nuke (but still allow it for one the nuke has not yet reached).

Great idea, and I'll probably do this as well, but the method I've used highlights that SLX is currently, for whatever reason, not fully recognising "baTimebombing" as a valid skill state.

I'm going to start from scratch, and this time follow the Stoner/Freezer template rather than simply borrowing the Bomber code; I'm thinking that the Timebomber will needs its own graphic, mask and sections of code which reference it independently, as the Freezer does.

The only slightly confusing thing here is that the Freezer seemingly borrows the "OhNo!" state and calls it "baFreezing", where the explosion and post-explosion Freezer mask is called "baFreezeFinish". I'm not sure exactly how the code specifies that "baFreezing" actually means "baOhNoing", but I'm hoping it will become clear soon...

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
The countdown is not a state. It's a seperate property. When the countdown reaches zero, they transition to baExploding or baStoning as appropriate (a seperate flag is used to determine which). Until then, they remain in baWalking or whatever else.

It's important to note that not all skill assignments immediately translate into the associated state. For example, assigning baClimbing simply turns on the "is a climber" flag, it doesn't change the lemming's current actions. Some may do so only conditionally, eg. baSwimming assignment changes the state immediately for a drowner, but not for any other lemming.
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline WillLem

  • Moderator
  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
OK, well... I'm a step closer.

The backskipping and restart bug are fixed, but the skill can still be repeatedly assigned to a lemming during the countdown phase, reducing the skill count whilst only performing the skill once (incidentally, I tested this with a Freezer as well and the same thing happens).

I'm also still struggling with making the Timebomber its own thing: it's still interwoven with Bomber code (to the extent that "BOMBER" is still displayed during the explosion phase). I've taken steps to prevent this, but obviously not the right ones (yet).

I've bookmarked a few places in the code that I think might need to say "if a Timebomber". I'll try it later, need a break now.

Offline Simon

  • Administrator
  • Posts: 3860
    • View Profile
    • Lix
Yeah, timebomber is unique.

It's mostly like a permanent ability. Assignment of permanent ability merely sets a field, it doesn't change the current activity, and you can't assign the same permanent ability twice.

In addition, timed bomber reacts to its expired countdown regardless of current activity. There will be code particular to timebomber that runs before the regular job code (for the single current activity). Contrast with, e.g., the climber ability: Only walkers or jumpers become climbers, at very specific spots in their job code (walker, jumper). But this part you already know and have gotten right.

I'm mainly surprised that there is so much difficulty in reusing the timebomber code from NL's nuke. I'd imagine that the nuke assigns for free applies one timebomber each physics update. But from how it sounds, the nuke is implemented differently.

Quote from: WillLem
this tells me that the Timebomber is not yet being seen as a skill in its own right, but rather a different trigger for the Bomber
Quote from: namida
not all skill assignments immediately translate into the associated state.

namida explained it well already. There is a difference between the skills in the panel, the single current activity, and the set of permanent abilities. "Skill" colloquially can mean all three.

Timebomber has no current activity.

In the left corner of the panel, when you hover over a walker, L1 and NL like to print the permanent abilities instead of "walker". It's a matter of taste if the timebomber counts towards these here; if you imagine it as a permanent ability, it sure might.

-- Simon
« Last Edit: March 08, 2023, 01:21:28 AM by Simon »

Offline WillLem

  • Moderator
  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
I spent another hour separating out more of the code, so that the Timebomber is now almost completely independent from the Bomber. This fixed all bugs except one:

:tal-bronze: When the Timebomber countdown reaches 0, "BOMBER" is still displayed during the ohno/explosion phase, the Bomber explosion graphic is used, as is the Bomber destruction mask.

My current codework and gfx content wants it to read "TIMEBOMBER", display a different explosion graphic (made purely for testing purposes), and use a much bigger destruction mask (again, made for testing), but something is clearly still amiss.



To further clarify what's currently happening:

As far as I can see, the code is saying: Assign Timebomber > Do Countdown (during which any skill except Timerbomber, Bomber and Freezer can be assigned, and during which the lemming will continue to do any activities they could previously do such as Climb, Swim, Float, Bash, etc) > Enter OhNo! phase (during which no skills can be assigned) and display "TIMEBOMBER" on the skill panel when moused-over > Blow up the lemming, display the "Timebomber" sprite graphic for 1 frame, and leave behind a destruction hole using the Timebomber mask

The actual output is: Assign Timebomber > Do Countdown (during which any skill except Timerbomber, Bomber and Freezer can be assigned, and during which the lemming will continue to do any activities they could previously do such as Climb, Swim, Float, Bash, etc) > Enter OhNo! phase (during which no skills can be assigned) and display "BOMBER" on the skill panel when moused-over > Blow up the lemming, display the "Bomber" sprite graphic for 1 frame, and leave behind a destruction hole using the Bomber mask

So, for all I know the entire Timebomber process is actually just the Bomber but with a timer added, which is not what I want; I need it to be a separate skill so that I can debug it as such. What I don't understand is why the program is seemingly ignoring the Timebomber code, or at what exact point it's no longer reading Timebomber code and is instead reading Bomber code. Need rest and reflection, I'll come back to this another day.

Offline WillLem

  • Moderator
  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
Re: [SLX][BUG] Timebomber skill count not resetting after Restart/Backskip
« Reply #10 on: March 08, 2023, 09:07:25 PM »
Aaaaand FIXED! :lemcat: :lemcat: :lemcat:

- Skill count resets correctly after restart, and doesn't count down whilst backstepping
- Panel now reads TIMEBOMBER upon detonation, and the correct graphics are used (the mask size has been reverted to the same as the usual bomber mask now that testing is complete, but I like the Timebomber's own explosion graphic with the black centre, so that's being kept!)
- Bombers, Freezers and further Timebombers cannot be assigned to a countdown lem; all other countdown behaviours appear normal thus far (haven't yet had a chance to test absolutely everything, but I'm sure it's fine ;P)

Various fixes between commits 8284bfb0c and df529153c (testing code & graphics reverted as of the latter).

The Timebomber now has completely its own independent code-base, and should be much easier to debug in future 8-)
« Last Edit: March 08, 2023, 09:17:39 PM by WillLem »