[Genesis] Lemmings (Genesis Port) TAS (WIP)

Started by Gronkling, January 27, 2016, 04:59:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ccexplore

Hmm, reviewing the Genesis version of Fun levels in Lemmix editor, seems like Fun 8 and Fun 10 should benefit from a single build step like it would for Fun 28 and 30.  Yet you reported that it didn't help on Fun 10.  Perhaps the abnormally positioned exit-trigger part is specific to the Hell exit after all?

Fun 1, thanks to the uneven terrain near the exit trigger, might work for the inverse case (which admittedly haven't even been tested to work on any levels yet, so it's all speculation at this time).  If it works at all, you'd need to have a second lemming following very closely (4 pixels or less behind the lemming that would first reach exit), and have that second lemming dig once to erase most or all of that tiny bump leading right to the exit trigger.  The hope is remove the bump will expose a portion of the trigger area, positioned closer to you as you approach exit from the left.

I guess what would really help is to find out where in memory the trigger map may be stored, so that the exact configuration of trigger areas in a level can be determined directly.

Gronkling

Yes, building in Fun 8 and 10 definitely doesn't have an effect. Possibly in this port trigger areas are defined for each object separately, rather than a trigger area being assigned to a set exit class, so the fire exit has a slightly different trigger area to other exits...

Digging near Fun 1's exit also didn't have an effect.

Now I'm going to dig around in the memory to see if I can find anything

Gronkling

#122
OK, so the trigger map is around the memory locations between 7800 and 8200.
Fun 1 has exit triggers on values 802D & 806D
Fun 30 has exit triggers on values 811C/D & 815C. It seems a lot like a typo actually that wasn't noticed as it doesn't have an effect on normal gameplay.
it looks like this:

          C   D
802-  01 10
806-  11 00

so yes the trigger for the fire exit is slightly diagonal

The crystal tileset's exit trigger also is diagonal. This is what each tileset's exit's trigger area looks like (each pink square is 4x4 pixels)



Exit trigger value is 1, other values being triggers for different things.

Here's what each trigger value means:
0 - Nothing
1 - Exit
2 - Left side of a blocker
3 - Right side of a blocker
4 - Water
5 - Constant trap
6 - Left one-way arrows
7 - Right one-way arrows
8 - Steel (This may come in useful too)
9 - Middle of a blocker
A,B,C,D,E,F - Tied to specific distinct traps in a level


ccexplore

Okay, finally successfully worked through some of the kinks in my earlier Fun 30 solution, now it's down to 928F.

One interesting technique to note:  it may be rare, but there are times when it can be better to select a skill using the cursor rather than B+left/right.  Particularly at the beginning when your frames are typically tied up with increasing the RR, while the cursor has little to do since no lemmings are out yet.  Since cursor movement, unlike all other actions in the game, can occur every frame instead of every PUC, at the beginning you can basically interleave cursor movement with RR increase to reach the skills toolbar.  The actual clicking on the skill icon will still need to take one frame away from RR increment, but that's still better than multiple B+left/right (where each press will take a frame away from RR increment) to reach the same skill.  And since an even RR is equivalent to the next odd RR, it's possible in some cases to take a frame or two away from RR increment without actually changing the timing of when lemmings come out.

ccexplore

Here's a quick and dirty script to print out the trigger map as ASCII art.  I realize it's not sufficient as it's difficult using it alone to tell where the triggers are located in relation to the terrain, but at least it'll help identify any other unusually shaped triggers for now.

To use:  once you're inside a level, go to LUA console, then open and run the script (but first, you might want to right-click on the console output box and select the "clear" context-menu command to erase any previous output).  The script will immediately produce the ASCII output in the console output box, although it probably won't look correct there due to insufficient line width.  Just copy and paste it to Notepad or some other text editor with a line width of at least 128 characters (and use a fixed-width font of course) for proper viewing.  You'll need to reopen the script each time you want an output of the map.

Sidenote: I intentionally include one extra row of cells above and below the proper boundaries of the map, which is why you'll see some garbage for the first and last line of the ASCII map; those two lines are actually outside the 512x160 level area, and the script's just interpreting whatever's in the memory there as part of the trigger map.  This is on the (very) off-chance that we discover some glitch that tries to read or write values from/to trigger map for locations outside the 512x160 level area.  It's quite possible there's no glitch and the game will do the proper checks before trying to read/write (or that you can never get a lemming to a location in the level area that could lead to such read/writes), but you never know.

Legend:

X  -- exit
L  -- blocker left
R  -- blocker right
^  -- water
#  -- constant trap
<  -- one-way wall left
>  -- one-way wall right
S  -- steel
B  -- blocker middle
!  -- triggered trap

Gronkling

#125
Excellent script! I'm going to save the trigger maps of each of the Fun levels.

Good idea showing extra cells, the data above appears to be another map interestingly, I really wish Bizhawk would let you adjust the number of values shown on each line but I guess nothing's perfect. Poking values in it messed with the graphics of terrain  so I'm guessing that it's to do with terrain drawing.
Have no idea what the data below is. Something to do with terrain graphic loading at the start of the level.

Marble's cutter traps are slightly odd, looking like this:
  ######
###### 
######

Fire's fire pit traps look like this:
   #######
#######

Steel areas are also a bit slanted in some places.

I didn't find any extra/missing triggers in the fun rating (other than the two pieces of steel at the very edges of Fun 28 not being steel, but I doubt that will come in useful :P )

AND

Fun 14: 6596F -> 6479F (-117F / 2.35s)
   ^- I used that cursor on the edge for small screen movement trick to save frames quite a bit here

Gronkling

The compilation of the whole Fun rating is here! It's total time as of now is 22 minutes, 11 seconds, though of course improvements still may be made to solutions.

https://youtu.be/tRMrXi3RTNg

In less interesting news, I did a solution to Tricky 1. aka I opened the solution to Fun 13 and put more waiting at the end ;)
Time for that level is 2143F (43s)

ccexplore

Maybe it's just an illusion, but watching the youtube video of the compilation, I feel like some of the transitions from the pre-level screen to the level are of slightly different lengths in different levels, which is somewhat unexpected.  Can you upload the BK2 emulator movie (or perhaps better yet, the TAStudio project) of the compilation in your Google Drive so we can take a closer examination at those?

Gronkling

#128
Yes, some levels take longer to load for whatever reason which appears as hanging on the pre-level information. Especially fun 22 probably because it's a special level. You can see the different loading times in the regular movies too which accounts for most variation in frame count starts. I uploaded the bk2 to the drive (I made the compilation by manually editing the input log in a text editor and savestates so there's no tasproj file, it would be too large.)

ccexplore

Quote from: Gronkling on March 07, 2016, 08:20:03 PMYes, some levels take longer to load for whatever reason which appears as hanging on the pre-level information.

Thanks, that makes sense now, I kept forgetting how underpowered the console can be.  So this is expected after all and not likely anything we can optimize on.

ccexplore

#130
Here's a potential solution for Genesis Fun 14 ("Room with No Exit") that I haven't gotten around to testing on the actual Genesis game, but is worth looking into.  The attached zip file contains the level in LVL format suitable for Lemmix (open with "original DOS Lemmings" style so the game mechanics match the one recorded in the replay file), and associated replay illustrating the basic idea.  Actual implementation on Genesis will vary slightly due to minor differences in a bash stroke's reach, but should otherwise work.  (Just make sure the fall from the 2n-thin-platform-from-top down to the 4th has some sort of stepping stone to break the fall--directly falling from one to the other would be 64 pixels which is 1 higher than the maximum safe-fall distance.)  The idea of course is to reduce one round of back-and-forth walking on the left side to save time.

Cursor placement will likely need to be very exact in order to select those lemmings that need to bash the "wrong way" (instead of incoming lemmings from the crowd getting selected, which will usually be favored due to the default of later-entered lemmings getting priority).  It's quite possible that in some cases the lack of pausing may even become a factor there, though hopefully not.  (And remember that in some cases, if the crowd's interfering with a particular skill assignment, it may be possible to make the interfering lemming air-bash at an earlier time, to effectively shift its position away from one that will later interfere with the skill assignment in question.)  And of course, it's likely that you'll get more lag frames with this solution due to needing to do more work on the left side, so I can't guarantee that even if the solution works out, its gains won't get wiped out by potential increase in lag frames.

[edit: note that the way I handled the bottom-left in the replay using a "backstroke" of the basher, it is obviously suboptimal.  The position I started the backstroke at ends up moving the wall there slightly further to the left (especially with the bash mask in Genesis), a wall that the walking crowd will need to turn around at.  The correct way should be to start the backstroke 1 or 2 pixels further right to avoid changing where the wall's at, or have the trapped crowd there free themselves instead of using the backstroke with a lemming outside that crowd.]

ccexplore

Incidentally, it looks like the compilation video is still using the obsolete solution for Fun 18 instead of the lag-reduced one I provided.  Not that it matters since chances are good we'll find improvements elsewhere anyway.

Gronkling

Good idea! This works in the genesis version and saves quite a lot of time. I don't even need a stepping stone on the 2nd floor here.
Saved 617 frames (so far) or 12.4 seconds. There may be more lag optimisation etc to be done though.
New record is 5862F

Also oops to using an outdated fun 18 solution, but yes that compilation will definitely have outdated solutions anyway, it's more for people to look at quickly.

ccexplore

Here's another short, out-of-order try in Sunsoft, namely 19 ("Let's Go Camping").  I thought this might actually be the shortest for the game, but turns out it's slightly longer than Sunsoft 1 after all (520F vs Sunsoft 1's 505).

Gronkling

Thanks for the solution, another very quick level definitely

I've started on Tricky because I might as well, so here's Tricky 2 in 2387 frames (~48s)

https://youtu.be/45dfY4iySYk

This level has two equally viable solutions, the one shown here involving the sliding glitch which I've been able to get the fastest so far, or using a big basher staircase. They are quite close matched, around 100 frames difference right now.