Lemmings Forums

NeoLemmix => NeoLemmix Main => Archived Bugs & Suggestions => Topic started by: Simon on February 14, 2016, 02:32:21 AM

Title: [bug] [player] LMB advances physics before cancelling replay
Post by: Simon on February 14, 2016, 02:32:21 AM
BitBucket: https://bitbucket.org/namida42/neolemmixplayer/issues/40/left-click-advances-frame-before-updating

Status: This appears to be two different things being reported together:

1. Left-click cancels replay *and* advances a frame. This is very unlikely to be changed; as there are keys for both functions alone (C to cancel replay without frame advance; N to advance frame without replay cancel; assuming the user hasn't re-customized them).

2. When using said left-click, a skill assignment in the replay is prioritized over one the user tried to assign with the given left-click. This is more likely to be changed.




Steps to reproduce:
Computer does:
Expected instead:
Reason: When I click a lemming, it should receive an assignment. This should not depend on whether there's an assignment queued for the very next update. During frame n, I don't see yet whether anything is queued for n+1.

-- Simon
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: namida on February 14, 2016, 07:11:13 AM
Left-click essentially has the function of "advance physics one frame" and "cancel replay" at the same time. There are keys for both of these functions alone (by default, N and C respectively).

Chances are this change is not going to happen, but if enough people are in support of it I'll consider it.

The whole "next frame assignment in replay takes priority over the manual one" is perhaps more justifiable in changing, but I'm not sure how major the changes needed to implement this may be. I'll take a look at it at some point.
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: IchoTolot on February 14, 2016, 11:49:01 AM
I often want to "one-frame-advance" the replay to precisely get to a certain frame, so it's a clear no to a change for me here (as I naturally use the mouse-button rather than n). For canceling I mostly just change the skill on the skillbar, or click when the game isn't paused.
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: Simon on February 14, 2016, 12:50:23 PM
Quote1. Left-click cancels replay *and* advances a frame. This is very unlikely to be changed; as there are keys for both functions alone

I agree with this design. Indeed, in my "expected instead" section, the replay is both cancelled, and physics advance.

I am suggesting that LMB does exactly what you have written in the quote -- cancel the replay, then advance a frame. :lix-evil:

Quote2. When using said left-click, a skill assignment in the replay is prioritized over one the user tried to assign with the given left-click. This is more likely to be changed.

Yes, this is the issue.

-- Simon
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: namida on February 20, 2016, 11:00:52 PM
Okay, by looking at the code, cancelling the replay is done first, but this doesn't allow overriding the assignment in the current frame (which is put into effect in the next frame, thus causing the appearance of it updating physics first).

    if (Button = mbLeft) and (not Game.CtrlButtonHeldDown)
    and not (Game.Replaying and GameParams.ExplicitCancel) then
    begin
      Game.RegainControl;
      HandleClick := true; //{not Game.Paused and} not Game.FastForward{ or UseClicksWhenPaused};
      if HandleClick then
      begin
        if Game.fAssignEnabled then
        Game.ProcessSkillAssignment;
        if Game.Paused then
            ForceUpdateOneFrame := True;
      end;
    end;


So, I'll have to look into TLemmingGame.ProcessSkillAssignment. I have a feeling the current behaviour was implemented as a fix to something else, so I can't promise anything - if something bigger would break by fixing this, then (at least for now) I'll probably leave it the way it currently is.
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: namida on February 21, 2016, 09:21:49 AM
Yeah, it would look like more significant changes are needed to implement this. So for now, this will have to remain as it is. I'll leave this open though so that at some point I can come back to it.
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: Simon on June 07, 2016, 01:27:31 PM
My understanding from observing the game alone:
Assignments are super important, they're the most important thing in the entire game. Yet they irritate and obscure what's happening.

Sure, the entire physics depend on the bug. Doesn't matter: The bug seems 100 % predictable. In old replays, you can move on-the-fly the assignment from n to n+1. This can't be the showstopper.

Why does NL write to the ostensibly-wrong physics update in the first place?

-- Simon
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: namida on June 07, 2016, 01:38:18 PM
Off the top of my head, I recall it being something to do with when skill assignments are processed vs when release rate changes need to be processed (remember that bug where every so often, an RR change would lead to a replay desync?). I forget the exact details.
Title: Re: [bug] [player] LMB advances physics before cancelling replay
Post by: Simon on June 21, 2016, 04:20:57 PM
LMB-advances-before-cancelling does not manifest in 1.44-no-fading with highlight-assignments. A highlight-assignment is when you highlight a lemming (arrow over its head), then hold the highlight key, and while you hold that key, click the skill in the panel.

In detail:
1. Highlight lemming.
2. Highlight-assign exploder. Observe how the game shows the explosion picture.
3. Go back exactly 1 frame.
4. Regular-assign floater. (Click floater in the panel, click the lemming.)

Observe how the lemming won't explode, as I would expect.

-- Simon