Lemmings Forums

NeoLemmix => Bugs & Suggestions => Closed => Topic started by: IchoTolot on October 25, 2018, 02:32:20 PM

Title: [Bug][Player] Double assignments are still possible via replay file editing
Post by: IchoTolot on October 25, 2018, 02:32:20 PM
I solved a certain old format contest level exploiting this behavior. ;) This is still possible in new format NL though as the replay format didn't change.

Reproducing:

- Load a level.
- Assign a skill to a lemming.
- Assign a 2nd skill on the very next frame (for simplicity purposes) to another Lemming.
- Save the replay.
- Close NL and open the replay file with a texteditor.
- Look at the 2 skills assigned and change the frame of the 2nd skill to the frame of the first, while updating the 2nd Lemming's position to the position the Lemming had on the frame before:

Example:

Original file:

$ASSIGNMENT
  FRAME 85
  LEM_INDEX 1
  LEM_X 111
  LEM_Y 135
  LEM_DIR left
  ACTION builder
$END

$ASSIGNMENT
  FRAME 86
  LEM_INDEX 0
  LEM_X 209
  LEM_Y 151
  LEM_DIR right
  ACTION basher
$END

After editing:

$ASSIGNMENT
  FRAME 85
  LEM_INDEX 1
  LEM_X 111
  LEM_Y 135
  LEM_DIR left
  ACTION builder
$END

$ASSIGNMENT
  FRAME 85
  LEM_INDEX 0
  LEM_X 208
  LEM_Y 151
  LEM_DIR right
  ACTION basher
$END

(I've attached an example file where the first 2 assignments are a double assign)

NL will accept and load the edited file and assign both skills in the same frame to their respective Lemmings. ;)

Fix proposal:

If we have multiple assignments in the same frame in a replay file: Only execute the first assignment, while all other assignments in the same frame will be ignored.

This fix will therefore trigger no NL error and it won't be noticable. This is only discovered anyways if a user deliberatly edits a replay file to do this, as double assignments are otherwise forbidden in the player.
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: Nepster on October 25, 2018, 07:54:53 PM
Haven't yet tried to reproduce it, but here is already one change to the fix proposal:
While only the first assignment should be applied, the others should be queued instead of being ignored. This is more keeping in line with our desire to try to make the best out of a malformed replay file.

I thought we were already doing that, but perhaps some of the bug-fixes in the last two or three versions have messed with this... or I am just remembering dreams :P
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: IchoTolot on October 25, 2018, 07:57:38 PM
Quote
While only the first assignment should be applied, the others should be queued instead of being ignored.

Totally fine with that. :)
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: IchoTolot on November 10, 2018, 11:55:49 AM
Just came to my mind:

The queued up assignments then need to be checked again if they overlap with future assignments. In that case they must be delayed even further.
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: nin10doadict on November 10, 2018, 11:07:42 PM
I do agree with fixing this. It's not something that's likely to cause issues if not fixed, but imagine if someone were to make a troll level that required manually editing replays to exploit this unintended behavior...
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: IchoTolot on November 10, 2018, 11:09:30 PM
I do agree with fixing this. It's not something that's likely to cause issues if not fixed, but imagine if someone were to make a troll level that required manually editing replays to exploit this unintended behavior...

Well, guess how I found this out. ;)

There is already such a level!
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: Dullstar on November 11, 2018, 05:06:34 AM
There is already such a level!


Now I'm curious as to how that would even work.
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: namida on November 11, 2018, 07:19:41 AM
Alright, that's one case where I wouldn't at all have a problem with a player update breaking the level - after all, it clearly abuses a completely and obviously unintended mechanic. Boo to whoever thought that was a good idea. Boo.
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: IchoTolot on November 11, 2018, 09:17:00 AM
Now I'm curious as to how that would even work.

Basically 2 lemmings are at a position where they MUST be assigned a skill in exactly the same frame. And it has to be in these exact positions for both lems.

Otherwise you will have to assign an extra walker which will make all other attempts come short by a skill.
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: namida on August 11, 2019, 04:46:51 AM
Will check if this issue still exists, and fix it if so.
Title: Re: [Bug][Player] Double assignments are still possible via replay file editing
Post by: namida on August 12, 2019, 07:34:52 AM
Fixed in commit 4d68498.

Specifically - if a replay skill assignment, for any reason, cannot be applied, it gets queued instead. Double-assignments in one frame is just one possible reason that can trigger this.