LemmixPlayer ccexplore updates

Started by ccexplore, November 10, 2009, 03:21:25 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Clam

I tried it already in the editor playtest and it only works in replays. As soon as you take over from the replay, it won't let you frame advance any more. Can someone who actually has the Lemmix Player test this please?

ccexplore

http://www.lemmingsforums.com/index.php?topic=271.msg7383#msg7383">Quote from: Clam Spammer on 2009-11-11 23:17:24
I tried it already in the editor playtest and it only works in replays. As soon as you take over from the replay, it won't let you frame advance any more. Can someone who actually has the Lemmix Player test this please?

 http://www.lemmingsforums.com/Smileys/lemmings/huh.gif" alt="???" title="Huh?" class="smiley" /> I've been attaching my updates to the EXE in this thread, can't you just download it and try it?  Remember, LemmixPlayer is completely standalone since all the necessary graphics sets etc. are embedded in the EXE, so you don't need to set up LemmixStyles.ini like you would with the editor.

The editor playtest differs quite a bit from LemmixPlayer's capabilities (eg. no savestates), so I really won't use that as a model of what LemmixPlayer supports.

And yes, at some later point I'll update Lemmix editor as well--right now I think I'm still missing some files so it doesn't even compile as-is yet.

namida

cc is right, it's there in the player.
My 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)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Clam

OK, thanks.


http://www.lemmingsforums.com/index.php?topic=271.msg7384#msg7384">Quote from: ccexplore on 2009-11-11 23:50:41
http://www.lemmingsforums.com/Smileys/lemmings/huh.gif" alt="???" title="Huh?" class="smiley" /> I've been attaching my updates to the EXE in this thread, can't you just download it and try it?  Remember, LemmixPlayer is completely standalone since all the necessary graphics sets etc. are embedded in the EXE, so you don't need to set up LemmixStyles.ini like you would with the editor.

Ah, I wasn't aware of that. I thought it was another messy setup job like the editor... My bad for not looking into it, I guess.

When (if?) you get assignment while paused implemented, I'll download it and start running some levels. Anything beyond that would just be icing. (Sweet, sweet icing... http://www.lemmingsforums.com/Smileys/lemmings/laugh.gif" alt=":D" title="Laugh" class="smiley" />)

ccexplore

http://www.lemmingsforums.com/index.php?topic=271.msg7388#msg7388">Quote from: Clam Spammer on 2009-11-12 02:04:08
When (if?) you get assignment while paused implemented, I'll download it and start running some levels.

Here you go.  Summary of updates done so far:

1) fix the 3-entrance ordering for non-original-DOS-Lemmings mechanics
2) added support for the steel-digging glitch (and similar) in replays
3) added support for nuke glitch
4) added a form of support for the time pause glitch--press 'z' to toggle the glitch on/off.  When active, the game resets the timer whenever entrance trapdoors start to open; you don't even have to actually pause or anything.*
5) LemmixPlayer.exe now supports all 9 graphics sets.
6) you can assign skills even when paused**

*I still can't guarantee that the amount of time gained from the time pause glitch will match the real game exactly, mainly because it's close to impossible to test it out in the real game, as it refuses to register the F11 key until the level has fully faded in, so you're almost guaranteed to pause later than theoretically allowed.  I'll probably need to disassemble quite a bit more of the game's code to determine for sure the exact amount of maximum time gained.  That said, LemmixPlayer should be quite close enough for most purposes.

**I've made it so that the game automatically advances one frame when you assign skills while paused (actually, the way it is right now, clicking with the left-mouse button anywhere on the level area will advance by one frame when paused, which isn't my intention but seems harmless enough).  I did this because there's no clear evidence right now that it's possible to do multiple skill assignments within one frame in the real game.  So I feel that until more of the game has been disassembled and analyzed to determine the verdict for sure, it makes sense to err on the safe side and not support it.  Skill assignments on consecutive frames on the other hand are confirmed possible (via actually doing it) on the real game and definitely supported in LemmixPlayer (in fact easier now that you can assign skills when paused).

===============

For those who haven't used LemmixPlayer a lot, note that some of the keyboard commands are slightly different from Lemmix editor playtest mode.  See the http://ericenzwaan.nl/eric/lemmings/lemmix.htm" class="bbc_link" target="_blank">Lemmix website for details.  I think LemmixPlayer should support all the features in the playtest mode + more, but if there's something supported in playtest mode that seems to be missing in LemmixPlayer, let me know and I'll make sure to get it back in.  Oh, and replays made in either one can be used in the other, as long as the game mechanics match.

[edit: see latest post for most update version to download]

Clam

Quote
*I still can't guarantee that the amount of time gained from the time pause glitch will match the real game exactly, mainly because it's close to impossible to test it out in the real game, as it refuses to register the F11 key until the level has fully faded in, so you're almost guaranteed to pause later than theoretically allowed.  I'll probably need to disassemble quite a bit more of the game's code to determine for sure the exact amount of maximum time gained.

How much time can you gain with the current setup? I know that in DOS it's possible to gain just over 2 seconds (2s = 34 frames), but I don't know exactly how much over. Maybe instead of going through the code again, you could run DOSBox frame by frame (by setting CPU cycles low) and count the frames?


Quote
**I've made it so that the game automatically advances one frame when you assign skills while paused

Despite my best efforts, I can't seem to assign two skills at the same time in DOS. When I assign a skill and pause at the same time, it appears to advance a frame (and begin execution of the skill) before play stops. This shouldn't be an issue at all - if anything it simplifies matters by reducing the number of possibilities.

And the hotkey "n" for frame advance seems rather appropriate - by pressing it you're saying "no" to skill assignment on the current frame.

GuyPerfect

http://www.lemmingsforums.com/index.php?topic=271.msg7394#msg7394">Quote from: ccexplore on 2009-11-12 05:48:40
I still can't guarantee that the amount of time gained from the time pause glitch will match the real game exactly, mainly because it's close to impossible to test it out in the real game, as it refuses to register the F11 key until the level has fully faded in, so you're almost guaranteed to pause later than theoretically allowed.  I'll probably need to disassemble quite a bit more of the game's code to determine for sure the exact amount of maximum time gained.  That said, LemmixPlayer should be quite close enough for most purposes.

This may sound like a roundabout approach, but I had a similar encounter with Paper Mario a few years ago. I had the game run in an emulator at the maximum speed in order to brute force all the recipe combinations in the game with a mixture of user input and GameShark codes. What I ended up doing was writing a program that took a peek at what was currently in the emulator window, and if it was at a user-input prompt, it would provide the user input.

You may be able to set up a similar watcher for Lemmings. Windows can programatically inject mouse and keyboard events into the input queue without actually receiving any mouse or keyboard input, so the process can be automated.

ccexplore

Interesting idea.  Unfortunately, because we need to measure exact timing for this case, your proposed method might lack the precision needed to do so.  The main difficulty right now is this:

1) While the game fades-in the screen to the level, keypresses to pause the game are ignored.
2) The problem with repeatedly pressing F11, whether by hand or by program, is that the same key both pause and unpauses.  So pressing F11 too many times can also lead to inaccurate results.
3) It might be possible to try to detect the end of the fade-in.  This still assumes though that the game starts accepting F11 keypresses exactly starting at when the pixel has reached the target brightness, which may or may not be the case.

There are still many things I could consider/try, so I won't say it's an impossible task, just that it'll take more effort for something that probably doesn't matter that much 99% of the time--the current implementation shouldn't be off by more than a few frames.

GuyPerfect

Is it possible to click the Pause button manually before the screen fades in all the way?

Clam

I've finally downloaded it to try it out, and found a serious problem. Sometimes when I restart the level, commands are delayed slightly or missed altogether, and after one command is missed any subsequent ones don't register. I'm not sure what causes it, but I know it isn't just because I clicked on the screen with the intention of advancing a frame through the replay (which, of course, would cause it to stop replaying).
EDIT: Saved replays have the same problem http://www.lemmingsforums.com/Smileys/lemmings/sad.gif" alt=":(" title="Sad" class="smiley" />


Quote
There are still many things I could consider/try, so I won't say it's an impossible task, just that it'll take more effort for something that probably doesn't matter that much 99% of the time--the current implementation shouldn't be off by more than a few frames.

It "doesn't matter" only 94% of the time. On average, one frame of difference is going to affect the results in one level out of every 17 (i.e, 6%). I really think this is worth getting right.

ccexplore

http://www.lemmingsforums.com/index.php?topic=271.msg7409#msg7409">Quote from: Clam Spammer on 2009-11-12 16:03:41
I've finally downloaded it to try it out, and found a serious problem. Sometimes when I restart the level, commands are delayed slightly or missed altogether, and after one command is missed any subsequent ones don't register. I'm not sure what causes it, but I know it isn't just because I clicked on the screen with the intention of advancing a frame through the replay (which, of course, would cause it to stop replaying).
EDIT: Saved replays have the same problem http://www.lemmingsforums.com/Smileys/lemmings/sad.gif" alt=":(" title="Sad" class="smiley" />

Yikes.  http://www.lemmingsforums.com/Smileys/lemmings/XD.gif" alt=":XD:" title="XD" class="smiley" /> Ok, I'll need you to tell me the level and attach the replay (preferably including the text version as well) exhibiting this problem.  Especially surprising when you said commands are delayed, I didn't think that was possible.  Are the delayed commands always the ones where you assigned skills with the game paused?  (Just a wild guess but most likely to be the culprit.)  Also try and see if using the frame-stepping feature may lead to these problems, as it would seem to be another likely culprit.

Clam

I figured out what's causing it. The problem occurs when I change release rates while frame advancing. Attached is a replay (+ text) for Mayhem 12 (which I chose for testing steel digging and the nuke glitch).

What should happen: First lemming builds as soon as possible, RR up to 99 three frames later (when the second lemming hits the ground), second lemming builds on the end of the brick laid by the first.

What really happens: Well, see for yourself. The RR change comes at the right time, but the lemmings don't build.

And in all that frame advancing, I noticed something else - the Player is missing the first frame of the trapdoor opening animation.


By the way, is it possible to play in windowed mode?

ccexplore

Okay, finally figure out what's going on.  The existing code has some optimization to elide replay records when paused, so that for example, insteading of recording every RR change you made while paused, it would just record the most recent one you did, having it overwrite the previous recorded RR change instead of creating a new replay record.

The ability to frame advance however breaks this optimization in obvious ways, since the game isn't truly in pause anymore once you do that, but the current code doesn't recognize this.  In fact, even before I added the new stuff, I believe the frame advance feature already breaks replays in an example like this:  you change the RR, then frame advance until another lemming comes out, and then you change the RR again.  The optimization logic would incorrectly remove the earlier RR change.

I won't be back on a machine with Delphi for a few more hours, so you'll need to wait a little before I can release a fix, but at least I know how to fix it now.  Thanks Clam! http://www.lemmingsforums.com/Smileys/lemmings/thumbsup.gif" alt=":thumbsup:" title="Thumbs Up" class="smiley" />

http://www.lemmingsforums.com/index.php?topic=271.msg7413#msg7413">Quote from: Clam Spammer on 2009-11-12 17:55:18
By the way, is it possible to play in windowed mode?

One thing at at time. http://www.lemmingsforums.com/Smileys/lemmings/tongue.gif" alt=":P" title="Tongue" class="smiley" />

Clam

http://www.lemmingsforums.com/index.php?topic=271.msg7418#msg7418">Quote from: ccexplore on 2009-11-12 20:26:50
http://www.lemmingsforums.com/index.php?topic=271.msg7413#msg7413">Quote from: Clam Spammer on 2009-11-12 17:55:18
By the way, is it possible to play in windowed mode?

One thing at at time. http://www.lemmingsforums.com/Smileys/lemmings/tongue.gif" alt=":P" title="Tongue" class="smiley" />

Oh, sorry, I was asking whether it was implemented already and I just didn't know how to use it. If it's not, then never mind http://www.lemmingsforums.com/Smileys/lemmings/laugh.gif" alt=":D" title="Laugh" class="smiley" />

ccexplore

Okay, I've fixed the replay problem related to frame advance.  I've also added 2 features:

- Pressing the '-' key will now rewind the game back approximately 1 game second.  I said "approximately" because the code should've rewind it 17 frames earlier, but the existing code right now related to savestates (which I borrowed for doing rewinds) is not behaving as expected--passing it the current frame number, and it seems to end up advancing by one frame instead of staying on the same frame.  I did try 18 instead of 17 but that still doesn't match up exactly with the effects of ' ' (space key), which supposedly advances by 10 game seconds (170 frames).  Clearly one or both of the commands isn't behaving exactly as advertised.  Oh well.  If I understand what's going on better in the future I'll make the appropriate changes.

- If you issue one of the "jump" commands (skip forward 10 seconds, rewind 1 second, or rewind to savestate) while paused, these commands will automatically put the game to pause after the jump completes.

I haven't done extensive testing of these new features in conjunction with replays.  So far I'm not seeing any buggy behavior with respect to replays, but most testing is always appreciated.