Author Topic: LemmixPlayer ccexplore updates  (Read 10344 times)

0 Members and 1 Guest are viewing this topic.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
LemmixPlayer ccexplore updates
« on: November 10, 2009, 03:21:25 pm »
This is less exciting than what namida did, but now that I got help from him and Eric in getting LemmixPlayer to compile, I'm finally able to make fixes to some of the game-mechanics-related issues, in particular:

1) the incorrect entrance ordering for 3 entrances for any styles besides original DOS Lemmings
2) inability to replay ClamSpammer's steel-digging glitch correctly

I've attached the LemmixPlayer.exe I've compiled with the fixes, which I've also taken the liberty to update the version number from 0.8.0.0 to 0.8.0.1.  Bug #1 is N/A for this though, since it's only original DOS Lemmings; I'll try compiling the other LemmixPlayers, and the editor, later.  That said, the fix for #1 is a one-line fix so I'm pretty confident I didn't screw anything up.

Bug #2 on the other hand turned out to be a little trickier to fix than I originally thought.  The basic issue is that while the replays record the mouse cursor position when skill assignments are made, it doesn't record whether the right mouse button is held down, although it does record the exact lemming that receives the skill assignment.  The approach I ended up using for the fix is to basically have the game first "test" the skill assigment using the recorded cursor position, assuming the right mouse button wasn't down, and if the lemming it would've assigned the skill to doesn't match with the replay record, it will try again assuming right mouse button was down.

I believe I've handled the code changes correctly for this, but I would definitely appreciate some extra testing on this:

1) Make sure when NOT in replays, skill assignment are working as expected for all 8 skills, and for both with and without holding down the right mouse button.

2) Pick a bunch of your favorite replays and make sure they still play correctly.  Try to cover all 8 skills and to include ones that use the right mouse button.

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

I've also attached my changes to LemGame.pas that fixes the two bugs noted above, in case other people are working on compiling their special versions of LemmixPlayer and would like to incorporate my fixes.  That said, it might not be a bad idea to first wait for some additional testing from other people to make sure that my fix for #2 doesn't break anything.

[edit: removed attachment, new update available in later post]

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #1 on: November 10, 2009, 07:36:25 pm »
From reading that, it seems like you've fixed the right-click bug and not "my" steel-digging glitch. This steel glitch doesn't require the right mouse button to be used at all (it just depends on the cursor position). Or have you done both at once?

If you and Eric are in the mood for fixing Lemmix right now, I have some ideas for changes that would really help with the least time challenge. Pausing for time and the nuke glitch are the two main ones, but there are a few others as well.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #2 on: November 10, 2009, 08:54:30 pm »
From reading that, it seems like you've fixed the right-click bug and not "my" steel-digging glitch. This steel glitch doesn't require the right mouse button to be used at all (it just depends on the cursor position).

No, it is the fix for the steel-digging glitch.  I guess it's a little unclear, and it's hard to explain without pointing to the actual changes in source code.  Let me try again.  Also, note that I'm trying to fix it such that existing replays already recorded containing usages of the steel-digging glitch will play back correctly w/o needing to be re-recorded.

Now, the steel-digging glitch requires a prioritized and a non-priortized lemming being considered in the digger skill-assignment code.  However, the replay mechanism only records the lemming the skill is assigned to.  If there's a choice of 2 lemmings being considered in the skill assignment, the replay does not record the information regarding which lemming is the "other" lemming.  Also, the replay records the mouse cursor position, but not whether the right-mouse button has been pressed.

Because of the missing information, to fix the problem means I need to recover the full prioritized/non-prioritized information from what's available in the replay records.  The mouse cursor position is a big help because I can pass that in to the prioritize hit-testing code to recover which lemming (if any) is the prioritized lemming, and which is the non-prioritized lemming.  At first I thought that is sufficient, but then my replay for the 1-builder Mayhem 14 solution failed to play back correctly at a move completely unrelated to the glitch.  Turns out one of the recorded moves actually make use of holding down the right mouse button to select the non-prioritized lemming under the cursor.  Unfortunately, this right-mouse button information is not being captured anywhere in the replay, except for the fact that the assigned lemming (which is saved in the replay) would be different from the prioritized lemming based on normal prioritization calculations.

But it gets worse.  Just because the non-prioritized lemming gets selected doesn't necessarily mean the right-mouse button is down.  In particular, as you've noted, the steel-digging glitch is a case where you actually cannot have the right-mouse button down, even though it's the non-prioritized lemming that gets assigned the digger.

So the only way to fix it is to basically first test to see which lemming the skill assignment would've chosen, assuming the right-mouse button isn't down.  Only when that leads to the "wrong" lemming being chosen (as we can check against the lemming in the replay records) do we redo the skill assignment assuming right-mouse button is down.

The skill assignment code originally does not have this separation of "just test out which lemming gets chosen" and "do the actual skill assignment on the lemming chosen--decrease number of skills, change the status of the lemming, etc.".  So to implement my fix, I have to change the code for all 8 types of skill assignment, to support a usage specific for replays, where we merely wants to know which lemming gets chosen, without actually going through with the skill assignment.  Now, I'm fairly confident that I've made the changes correctly, but since the code for all skill assignments are affected, it seems prudent to have more thorough testing of skill assignment in all possible scenarios, whether in replays or not.

Quote
Or have you done both at once?

I can't fix the right-click glitch until I fully understand what's going on, which I don't at the moment.  I'll first need to find the relevant code in the original game responsible for the behavior, in order to make sure that I can correctly emulate the behavior in all cases in Lemmix.

It's likely that to fix the right-click glitch, I'd need to expand the replay format to record more information related to the mouse.  Fortunately since there are currently no replays that make use of the glitch (since the glitch doesn't work in Lemmix outside of replays to begin with), it would be acceptable to require changing the replay format to support it in replays.  Of course, once you do that, you need to have the code being able to handle both the old and new replay formats, which can lead to a lot of messy code.

Quote
If you and Eric are in the mood for fixing Lemmix ri fght now, I have some ideas for changes that would really help with the least time challenge. Pausing for time and the nuke glitch are the two main ones, but there are a few others as well.

Thanks.  I'll take a look at that thread and see.  The nuke glitch in particular should be pretty easy to fix.  Pausing for time may take some work to fix though, we'll see.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #3 on: November 10, 2009, 09:10:21 pm »
For the steel-digging glitch, would it not be sufficient to just force the skill to be used in the replay regardless of whether the lemming is on steel? If it's saved in a replay, it must have been done while actually playing the level.

Remember, there's an equivalent glitch with builders near the top of the map.



Quote
Thanks.  I'll take a look at that thread and see.  The nuke glitch in particular should be pretty easy to fix.  Pausing for time may take some work to fix though, we'll see.

I didn't post them in that thread. Here's what I have thought of. I know I'm asking a bit much here, but anyway...

- pausing for time and nuke glitch
- frame advance and reverse during play (currently frame advance only functions in replay mode)
- rewind
- ability to assign skills while paused
- frame counter (ticks over once per frame, may be useful for reference)
- option to remove the "blink" on assigned lemmings in replays (would make them nicer to watch eg. on Youtube)
- option to stop the timer when the required percentage is reached
- option to view steel, triggers and terrain-detection pixels during play (where the game checks for terrain/steel on builders, diggers etc)
- double-click to switch to min/max rate
- display distance to exit on lemmings under cursor (to help with timing release when the worker is a long way from the crowd)

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #4 on: November 10, 2009, 10:22:06 pm »
For the steel-digging glitch, would it not be sufficient to just force the skill to be used in the replay regardless of whether the lemming is on steel? If it's saved in a replay, it must have been done while actually playing the level.

Remember, there's an equivalent glitch with builders near the top of the map.

That sounds logical, except again, the original code has no separation between determining which lemming (possibly none) gets the skill, and the actual skill assignment to a specific lemming.  The original code handles assignments in replay by basically setting the priortiized and non-prioritized lemming both to the lemming in the replay record, and passing that to the assignment-handling code.

So even the logical change you suggest will still require basically the same code changes as my current approach, to separate out the two things so they can be done independently of each other.  Plus, the "force skill on lemming stored in replay" approach can lead to abuse, where by hex-editing the replay file, someone can assign skills to lemmings they normally can't.  My change effectively prevents this as well.

And yes, the fix should allow the equivalent builder glitch to be played back in replays as well.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #5 on: November 10, 2009, 10:28:23 pm »
I didn't post them in that thread. Here's what I have thought of. I know I'm asking a bit much here, but anyway...

 :o Yeah, "a bit much" sound about right. ;)  I'll take a more careful look at the list later tonight and try to rank them by amount of effort, to see which ones to tackle first.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #6 on: November 10, 2009, 11:58:14 pm »
- option to remove the "blink" on assigned lemmings in replays (would make them nicer to watch eg. on Youtube)

I'm not entirely sure I agree.  The blink is intended to help you identify which lemmings a skill gets assigned to.  It's true that for most skills you can tell from what the lemming starts doing afterwards, but then there are skills like climbers and floaters that aren't the case.

Moreover, in my opinion the current approach may not be entirely sufficient for a Youtube video.  To make the video match the actual playing experience more closely, I believe it should actually show the pausing/unpausing, screen scrolling, and mouse cursor movement as well, or at least an abbreviated form of them.  Sometimes where you position the mouse cursor is actually critical for a solution to work.

Nevertheless, to test out the resulting experience, I could look into implementing a form of your proposal, where non-permanent-skill assignments are shown w/o the highlighting, but permanent-skill assigments are still shown with it.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #7 on: November 11, 2009, 03:17:37 am »
the "force skill on lemming stored in replay" approach can lead to abuse, where by hex-editing the replay file, someone can assign skills to lemmings they normally can't.

I know. :P Probably not the way to go, if you can avoid it.


Quote
Yeah, "a bit much" sound about right.

If there's no interest in speedrunning levels (which apparently there isn't right now) then none of this is really necessary. Then again, build it and they will come...


Quote
The blink is intended to help you identify which lemmings a skill gets assigned to.  It's true that for most skills you can tell from what the lemming starts doing afterwards, but then there are skills like climbers and floaters that aren't the case.

Even in the case of climbers and floaters, I think it's enough to see the result of the assignment rather than worrying about where it took place. In most cases, there's a sizeable window in which to assign the skill, and the exact position doesn't matter.


Quote
To make the video match the actual playing experience more closely, I believe it should actually show the pausing/unpausing, screen scrolling, and mouse cursor movement as well, or at least an abbreviated form of them.  Sometimes where you position the mouse cursor is actually critical for a solution to work.

This will just make the video longer and less fun to watch. To me, it just looks more impressive in real time, and the details don't matter. I'd rather refer to a set of explanatory notes when needed than have the action slowed down. And I'd be happy to provide such explanations if I were to make a video.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #8 on: November 11, 2009, 03:44:30 am »
This will just make the video longer and less fun to watch. To me, it just looks more impressive in real time, and the details don't matter.

Hmm, I see.  Yeah, I'm aware that speedruns of other games often employ interesting tricks that are theoretically possible but ridiculous for human execution, such as certain combinations of rapid button presses or something.

So I guess I see your point about looking more impressive.  On the other hand, aren't the speedrun videos you see for SNES include the cursor movements and such?  Or do they edit and cut out those stuff before posting the video?

I guess in this case, since it'd be relatively easy to do so, I can just provide options to hide all highlights, hide highlights for non-permanent skills, and show all highlights.  This gives people the full range of configuration on how they want to see the replay.  I'll probably skip the "more realistic" playback for now since it'd definitely take more work and not appropriate for speedrun videos, although I can still see certain uses for it, like the playback of a multi-tasking level where you might want the view to switch back and forth between the two lemmings you are assigning skills to, without having to manually pause and jump the screen yourself during playback.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #9 on: November 11, 2009, 04:29:38 am »
aren't the speedrun videos you see for SNES include the cursor movements and such?

The SNES Lemmings TAS I mentioned does show the cursor. But I should draw a distinction here between playing for fastest in real time (which is the goal of a TAS) and fastest in game time (which is the goal of the challenge thread). I think cursor visibility is appropriate for the former, but not the latter. Real-time playing has the added element of limited cursor movement (although I don't know exactly how relevant this is with a mouse), and thus slightly more limited skill assignment possibilities, and so it's important when you watch the video that you can see the cursor and verify that the actions performed are indeed possible in real time. For a "least game time" run, this isn't the case, and having the cursor flicking across the screen all the time would just be distracting. I think the most effective video would come from playing back the replay at full speed and keeping the screen view in a good position for viewing.

Again, I don't mean to create heaps of work for you and Eric. I just wanted to get those ideas out there...

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #10 on: November 11, 2009, 05:29:14 am »
Again, I don't mean to create heaps of work for you and Eric. I just wanted to get those ideas out there...

Oh don't worry, we'll simply put off the harder stuff until eternity. ;) And actually, I think it's just me at the moment making these sorts of changes.  I'm just slightly surprised how many things are on your wishlist, ;) although a lot of it makes sense when you're trying to do a speedrun type of thing.

I just barely started looking at the code, so things will probably start off slowly at this point. ;)

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #11 on: November 11, 2009, 06:23:13 am »
I think the major one is just fixing the nuke glitch and time pause, plus the ones you've already done - and you should probably combine it with my idea of adding ONML styles as well, rather than forcing people to choose one or the other.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #12 on: November 11, 2009, 01:43:03 pm »
Okay, I've attached LemmixPlayer.exe and LemmixPlayerOhNo.exe with the following updates:

1) fix the 3-entrance ordering for non-original-DOS-Lemmings mechanics
2) added support for the steel-digging glitch in replays
3) added support for nuke glitch
4) added a form of support for the time pause glitch
5) per namida's suggestion, LemmixPlayer.exe will support all 9 graphics sets (ie. 5-8 for ONML and 9 for Xmas) instead of just the 5 from original Lemmings.

#4 needs further explanation, because right now I'm supporting it a little differently from how you'd do it in the actual game, for simplicity.  Instead of making it happen through pausing, you can press 'z' (lowercase) to toggle the glitch on and off (defaults to off when you run the program).  If you toggle the glitch on, the next time you play or replay a level/replay, the game will reset the timer back to the level maximum time when the entrances start to open.

I might redo this later to support it more like the way it works in the game, but for now, what I've done is the simplest way to support the bug, while keeping existing replays compatible (as well as giving you the option to run a replay either with or without the glitch as you so choose).

I've also attached the source files I've changed, at least the ones I remember changing.  The change in GameWindow.pas is solely for checking the pressing of the 'z' key.

[edit: oops, I think there's one more time-related variable I forgot to reset, so you might still end up losing a few frames despite the time reset.  I need to head out of home soon, I'll fix it later when I'm back]

[edit2: another update posted, go to latest post for downloads]

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #13 on: November 11, 2009, 10:13:24 pm »
I don't know what sort of priority order you have in mind, but I think frame advance and assignment while paused should be next on the list. I would consider these to be absolutely necessary for the least time challenge, my other suggestions much less so. Frame advance has already been implemented for replays, so surely it can't be that difficult to get working. (Can it?)

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer (original) with minor game mechanics bug fixes
« Reply #14 on: November 12, 2009, 04:57:19 am »
I think frame advance and assignment while paused should be next on the list.

I looked through more of the code just now and it looks like, at least with the code I'm working off from, frame advance seems to be already there.  You can press 'n' (lowercase) while paused and it should advance the game by one frame.  It shouldn't matter whether it's replay or normal play.  Give it a try and let me know whether it works or not.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #15 on: November 12, 2009, 05:17:24 am »
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?

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #16 on: November 12, 2009, 05:50:41 am »
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?

 ??? 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.

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #17 on: November 12, 2009, 06:00:01 am »
cc is right, it's there in the player.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #18 on: November 12, 2009, 08:04:08 am »
OK, thanks.


??? 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... :D)

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #19 on: November 12, 2009, 11:48:40 am »
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 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]

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #20 on: November 12, 2009, 07:47:58 pm »
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.

Offline GuyPerfect

  • Posts: 363
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #21 on: November 12, 2009, 08:40:43 pm »
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.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #22 on: November 12, 2009, 09:07:59 pm »
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.

Offline GuyPerfect

  • Posts: 363
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #23 on: November 12, 2009, 09:45:19 pm »
Is it possible to click the Pause button manually before the screen fades in all the way?

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #24 on: November 12, 2009, 10:03:41 pm »
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 :(


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.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #25 on: November 12, 2009, 11:13:43 pm »
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 :(

Yikes.  :XD: 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.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #26 on: November 12, 2009, 11:55:18 pm »
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?

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #27 on: November 13, 2009, 02:26:50 am »
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! :thumbsup:

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

One thing at at time. :P

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #28 on: November 13, 2009, 02:33:44 am »
By the way, is it possible to play in windowed mode?

One thing at at time. :P

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 :D

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #29 on: November 13, 2009, 10:24:53 am »
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.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #30 on: November 13, 2009, 10:53:43 am »
- 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.


You'll be pleased to know that I caught this one some time ago:

the 10-second skip takes off slightly too much - maybe just one frame. It's more noticeable if you hold it down.

In theory, if you hold down the spacebar while playing, the last digit of the timer should tick over at the same rate as normal, but it actually counts down more than twice as fast. This seems to suggest that it's advancing one frame too many. And I just checked this in the Player and the same happens.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #31 on: November 13, 2009, 09:47:46 pm »
Thanks for the reminder on the Lemmix glitch thread.  Going through that thread, I see the following list of things to fix.  I've ordered them in terms of importance (my ranking):

- fix fake object support (Lemmix doesn't pay exact attention to object indices)
- make frameskip more accurate
- fix missing trapdoors inert trigger areas
- changing difficulty ranking should reset level no. to 1
- fix emulation of glitch related to left edge of map

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #32 on: November 14, 2009, 06:38:13 am »
While not too important, the difficulty level change reset one should be by far the easiest to fix, so shouldn't that be first on the list?

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #33 on: November 15, 2009, 08:44:34 am »
I found a couple of problems with explosion particles:

1) If you fast-forward through the explosion, sometimes the particles stay on the screen until you scroll across. For some reason though, it doesn't happen when you frameskip up to the point when the explosion occurs. If you play my 3-minute solution to Mayhem 23 from the start in fast forward, the explosion about 40 seconds into the replay leaves particles on the screen.
2) Using frameskip while there are particles on the screen causes massive slowdown. Which is odd, because it works fine if there aren't any particles at the time when the frameskip is used, even if there is an explosion during the skipped period.

I also noticed that skills can't be selected or assigned in fast-forward mode, and using frameskip while in fast-forward drops you back to normal speed. The editor playtest doesn't have these limitations.

And while the one-second reverse is good, I would prefer one-frame reverse. This makes it easier to go back if you advance too far - and when you're trying to push things to the limit, that's going to happen quite a lot. (I recommend "b" as the hotkey for this, since it's next to the key for frame advance.)

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #34 on: November 15, 2009, 10:19:15 am »
I found a couple of problems with explosion particles:

Strange.  If I figure out what's going on I'll fix them of course; that said, it doesn't actually affect the level solution or replay, correct?

and using frameskip while in fast-forward drops you back to normal speed. The editor playtest doesn't have these limitations.

I believe this was by design--not by me, but it was requested from someone back in the old old forums (tseug perhaps?).  More simply, unpausing always put you back to normal speed (doesn't matter if you frame advance or not), perhaps because it's easy to forget that you were in fast forward, and such a mistake may require you to replay some moves.

I don't really know what people prefer.  I can probably put it back the way it is in the editor if that's what people want.  Ultimately I'd like to create a UI for you to set options for various miscellaneous things like this, but that'll take a little time.

I also noticed that skills can't be selected or assigned in fast-forward mode

Don't know about this one.  Possibly an attempt at mistake prevention in a similar light to above, though I can't come up with a good rationale myself.  I can probably fix this.

And while the one-second reverse is good, I would prefer one-frame reverse. This makes it easier to go back if you advance too far - and when you're trying to push things to the limit, that's going to happen quite a lot. (I recommend "b" as the hotkey for this, since it's next to the key for frame advance.)

Okay.  Just keep in mind that reverse can be a bit more processing intensive than frame advance, since there's no true reversal--the game actually has to replay the whole thing from the beginning at hyperspeed up to the frame you want.  So if you're towards the end of a relatively long solution, you may find that it might actually be quicker to jump back once and then frame advance a few times, rather than one-frame reverse a few times, depending on computer speed etc.

Still, one-frame reverse certainly do come in handy now and then.  I'll add it in.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #35 on: November 17, 2009, 07:59:01 am »
Just want to note that I haven't forgotten about this topic, just that real life busy-ness has intruded again and I don't have as much time to deal with all these changes and things to investigate right now.  I still hope to post an update within 2-3 days, maybe earlier.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #36 on: November 17, 2009, 11:29:50 am »
Okay, I've gathered enough information now from the game's code and Lemmix's code to understand all the timer-related differences, and unfortunately it doesn't make my job very easy:

A) It turns out that right now, the entrances are being opened in Lemmix a frame earlier than in the actual game.  However, Lemmix also cuts off a frame earlier than the actual game when you run out of time.  So the total number of frames given, not using the pause trick, is the same, but nonetheless, this discrepency obviously affects what you see in the game timer (a solution that seems to just make it before going from 4:30 to 4:29 would, in the actual game, hit 4:29, because of how the entrances are being opened a frame too early in Lemmix).

B) There's a further twist though with the actual game.  When the game decides it's "done", as a result of either no lemmings left, no time left, or the user pressing ESC to abort, it doesn't immediately declare "abort".  Instead:

1) it sets a flag signaling that it's now in the "fade-out" phase
2) Then in the next iteration, it starts carrying out the fade-out
3) then it continues to do one frame of lemmings updating,
4) and then just before running the code for updating the game timer, it checks if you're in the fade-out phase.  If you are, it skips over the updating of the game timer, and either jumps to the post-level screen if the fade-out finishes, or continues on for more iterations of lemmings-updating (ie. back to step #2) if the fade-out is still in progress.

Now, on the "PC-compatible" mode with the "fast" fade-out, the fade-out is done within a single iteration--nothing is being updated during the fade out.  (In other words, the complete fade-out sequence happens entirely within step 2, putting the game loop on hold while it's going.)  However, as detailed above, after the fade-out is being carried (ie. the screen is actually black), the remaining portions of the game loop will still update the lemming before going to the post-level screen, but the game timer is not updated.  This means pressing ESC at the right time, you can preven the game timer from going down another game second even though it normally would've.

Of course, the real advantage comes with the "High Performance PC" mode with the "slow" fade-out.  The slow fade-out is done over several frames (I haven't determined yet how many, but it could easily be another game second).  In other words, in that mode, the step #2 above in each iteration just does a little more of the fade-out, and the whole fade-out sequence is spreaded over several iterations.  During all these frames, as noted above, lemmings continue to be updated (and you can even assign skills), but the game timer is not updated.  So instead of holding off the game clock by merely one frame, the ESC abort can actually hold off the game clock around 1 game second or so in the "high performance PC" mode.

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

All of this means I've my work cut out for me in getting Lemmix to a state that supports all these "special effects" related to the game clock.  Even if I ignore high-performance mode, the regular mode is still already off by one frame in terms of the game clock (w/o the pause glitch), and there's the matter of ESC "holding off" the game clock by one frame.  Even if we ignore all these silly "game clock" shenanigans and just go purely with counting number of frames (kinda my preference now actually since it's frankly a more honest indication of time compare with the timer, given all these idiosyncracies), I would still have to at least provide a way to show the frame counter in-game.  I also need to be careful that my changes don't invalidate existing replays--for example, merely making the entrances open one iteration later would cause existing replays to be all off by one frame, which could be disasterous.  So I would also need to compensate by putting an adjustment factor between the iteration number stored in the replay, and the actual iteration counter value in Lemmix.

Frankly, at this point I'm far more likely to get the "easier" stuff out of the way first, like the one-frame reverse, proper fake object, entrance trapdoor inert trigger area support, and resetting level number to 1 on changing difficulty ranking.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #37 on: November 17, 2009, 12:02:16 pm »
I thought some of you might be interested in testing out some of the stuff I've said, especially when I do get around to supporting all that in Lemmix and you want to see how accurate it truly is.

To that end, here's a hacked version of VGA DOS Lemmings that is basically slowed down by a factor of 12.  It's not very usable as far as actual playing goes, because as you quickly realize when you try it, the game updates the mouse cursor at the same rate as the rest of the screen, so moving the mouse cursor will feel pretty sluggish.  You'll also need to hold down any key you want to press by the length of at least one frame for it to take effect (and probably likewise for mouse button presses).

When I test my Lemmix changes, I'll likely use the unhacked version for things I can easily test w/o the slow-down, and use this version for things to test where the slow-down really helps.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #38 on: November 27, 2009, 11:33:30 pm »
Found another problem - nothing major though. Sometimes the game plays music, even though it's turned off. It only happens sometimes, so I'm not sure why it does this. It doesn't seem to happen with sound effects.

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #39 on: December 02, 2009, 06:43:22 am »
Are you turning it off with the hotkey or in the main menu?
Turning off with the hotkey is not permanent, it only lasts until the level ends.

Offline Clam

  • Posts: 2187
  • Smiley: :8():
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #40 on: December 02, 2009, 08:04:44 am »
I turned it off in the menu. When I start it up again it still appears to be off, and most of the time it doesn't play. And I never get sound effects either. ???

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #41 on: July 14, 2010, 06:32:27 am »
Sound effects are sometimes glitchy for me in Windows 7, never had any trouble in XP. It's not a major issue though.

Anyway... cc, if you're still around, any chance you can post the full source (including your updates)? I lost some of the vital files in a reformat...

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #42 on: July 14, 2010, 11:51:55 am »
Here's what I have on the computer right now.  It hasn't been touched in over half a year since I stopped working on it, so I have no idea what state it is in.

Now, let's see if the forum lets me upload a 12+MB zip file...... [edit: guess not, let me try Lemmingswelt instead...]

[edit2: still not working.  Not sure if it's my home's buggy wireless router or just that it's too big (though I see a similarly sized "Lemmix 0.0.10.0 source" zip file on there already?  May try again later at work.

In the meanwhile, maybe you can start off with said zip file on lemmingswelt (it probably doesn't have my updates though).  I can also try uploading a smaller zip file that doesn't have the large music and graphics resources, which you can get from the existing said zip file on lemmingswelt.]

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #43 on: July 14, 2010, 01:22:23 pm »
I wasn't able to upload even the LPDOS Player on there, I think it's got a limit that wasn't previously there (or maybe was bypassed for that file).
If you email it to me, I could upload it to one of my own websites so we've got a permanent download for it. My email is the same as always, namida_verasche[at]hotmail[dot you know what].

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #44 on: July 15, 2010, 12:36:35 am »
I try emailing to your hotmail address but it looks like hotmail is reject my email because the attachment is too big.

I think I'll need to go with the route of removing the big stuff like music and graphics from the attachment.  Use the lemmixplayer source from lemmingswelt file portal to retrieve that stuff.  Too busy to deal with this right now, maybe later tonight or tomorrow.

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #45 on: July 15, 2010, 07:30:29 am »
How 'bout Rapidshare or something similar? (Just to keep the exact structure without any worries of reconfiguration glitches...)

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #46 on: July 15, 2010, 12:29:01 pm »
Okay, try this:

http://www.fileden.com/files/2010/7/15/2915232//LemmixPlayer_ccexplore.zip

[disclaimer: first time trying this.  Forgot who on the forum recommended FileDen.  Don't know how many or what kinds of ads you may get.]

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #47 on: July 16, 2010, 09:05:46 am »
None at all. FileDen links are direct; the only disadvantage is they deactivate your account if you don't sign in often enough. As long as your account is active, the files are safe. I myself probably made the reccomendation.

Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #48 on: July 16, 2010, 09:28:25 am »
Oh ok, good to hear.

I was worried because the registration process felt very sketchy, with it basically forcing me to click thru dozens of ads, some of which won't go away unless you download something (I got around that anyhow), or make you click yes to basically being spammed by telemarketers or something.  Of course I signed up with a classic fake name, address and phone number (hope they enjoy marketing/spamming to El Barto), but it's still a little unnerving.

I guess I'll need to remember to sign in every week then.  Seems like a good thing to keep, and I definitely don't want to go through the sketchy registration process again if I can avoid it. :-\ ;P

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #49 on: July 18, 2010, 01:05:02 am »
I think it's once every two months or so that you need to...


Offline ccexplore

  • Administrator
  • Posts: 5320
    • View Profile
Re: LemmixPlayer ccexplore updates
« Reply #51 on: July 26, 2010, 01:32:45 am »
thanks

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #52 on: May 20, 2011, 07:18:36 am »
Obviously the above link will now be broken, since I never bothered to restore FFXHackers after my no-$ time. Here's a new one that works:

http://www.namiworld.net/LemmixPlayer_ccexplore.zip

If you find it useful, please consider checking out the actual site, it's been very quiet lately and the ads on it may slightly help with keeping that link up. (Mods, feel free to edit that line out if I'm not allowed to post it. =P)

Offline namida

  • Administrator
  • Posts: 10524
    • View Profile
    • NeoLemmix Website
Re: LemmixPlayer ccexplore updates
« Reply #53 on: September 14, 2013, 08:34:58 am »
Fileden's no longer up and my website's long since gone.
I do have a copy of this saved locally if anyone needs it and/or has somewhere to put it.