Author Topic: [Bug][Player] Double assignments are still possible via replay file editing  (Read 4027 times)

0 Members and 1 Guest are viewing this topic.

Offline IchoTolot

  • Global Moderator
  • Posts: 3608
    • View Profile
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.

Offline Nepster

  • Posts: 1829
    • View Profile
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

Offline IchoTolot

  • Global Moderator
  • Posts: 3608
    • View Profile
Quote
While only the first assignment should be applied, the others should be queued instead of being ignored.

Totally fine with that. :)

Offline IchoTolot

  • Global Moderator
  • Posts: 3608
    • View Profile
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.

Offline nin10doadict

  • Posts: 329
  • Guy who constantly misses the obvious
    • View Profile
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...

Offline IchoTolot

  • Global Moderator
  • Posts: 3608
    • View Profile
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!

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
There is already such a level!


Now I'm curious as to how that would even work.

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
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.
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 IchoTolot

  • Global Moderator
  • Posts: 3608
    • View Profile
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.

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Will check if this issue still exists, and fix it if so.
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 namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
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.
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)