Author Topic: Mike! I want to ask you...  (Read 34057 times)

0 Members and 1 Guest are viewing this topic.

Offline Proxima

  • Posts: 4572
    • View Profile
Re: Mike! I want to ask you...
« Reply #105 on: June 23, 2005, 02:47:56 PM »
Quote from: Mike  link=1105852459/90#101 date=1119534386
The 3 pixels that a lemming "walks" down, are included in the 60 pixel drop. so it's 60, not 63.

Yet something fishy is clearly going on, because that would make 3 Crazy (Many lemmings make level work) impossible..... though I guess if there was a mistake it would be spotted in playtesting and they'd make sure the fall was the right distance that it could be done.

Offline Mike

  • Posts: 105
    • View Profile
Re: Mike! I want to ask you...
« Reply #106 on: June 23, 2005, 03:53:07 PM »
Well, perhaps not. Your forgetting that as levels are put together and order+difficulty tuned, the harder ones might be dropped altogehter, so the "odd" table version might be the only one left. So this doesnt mean that there IS a duplicate, just that the level info+skills are different from the level stored on disk.

Yes, for the most part, all levels were hard versions, with the exception of (around) the first 7, which were made to be introductionary ones.

The reason for tha +3, is optimisation. Its faster to "inc bp" 3 times, rather than add to a memory location. So, for walkers/fallers, collision was checked "quickly", and only once it knew it was still falling, were the 3 pixels its already checked added on to the fall memory location.

Memory is slow in computers, registers are fast. So you use registers whenever you can.

Believe me.... its 60 pixels.  :mikelaugh:

Offline Mike

  • Posts: 105
    • View Profile
Re: Mike! I want to ask you...
« Reply #107 on: June 23, 2005, 03:59:37 PM »
Quote
Yet something fishy is clearly going on, because that would make 3 Crazy (Many lemmings make level work) impossible..... though I guess if there was a mistake it would be spotted in playtesting and they'd make sure the fall was the right distance that it could be done.


I haven't played "oh no!" levels, but Im guessing that you bomb just as he drops off the ladder so that he blasts a hole in the ground allowing the rest to survive the fall?

Theres always the chance that in On No! they changed it, and my source is out of date.... but I dont think so. It has DataDisk code in it, so it looks final.

Offline Proxima

  • Posts: 4572
    • View Profile
Re: Mike! I want to ask you...
« Reply #108 on: June 23, 2005, 05:07:22 PM »
Gaah. Sorry, that was very stupid of me. Of course it would be possible that way; it doesn't prove anything one way or the other about whether it was intended.

guest

  • Guest
Re: Mike! I want to ask you...
« Reply #109 on: June 23, 2005, 05:07:39 PM »
Can't you just show a few more lines of source code before the stuff you did show?

All I need to know is how the 3 other previous lines involving si.lemming.fallcount fits in.

I've measured it again and it is definitely a cliff of 63 pixels on Fun 11 (ie. you dig down five times at the edge from the top to make a survivable fall, and four is not enough).  Since I also did found the 60 in my copy of lemmings, clearly the 63 results from other lines of code at play, whether intentionally or accidentally.  I already mention that if fallcount is only incremented by 3 and not by smaller amounts, it's conceivably possible to fall 62 pixels and have fallcount still be at 60.

Offline Mike

  • Posts: 105
    • View Profile
Re: Mike! I want to ask you...
« Reply #110 on: June 23, 2005, 08:41:13 PM »
Quote
Gaah. Sorry, that was very stupid of me. Of course it would be possible that way; it doesn't prove anything one way or the other about whether it was intended.


Hay! We're all allowed to be stupid!! It keeps us honest! And I'm about to prove that!


Actually... after tracing through the walker code, as well as faller and splatter, it looks like it is probably 63(!) . The walker checks 4 pixels down before he becomes a faller, then "makefaller" is used (macro). It sets the fall count to 0. This means he has already fallen 3 pixels when he was a walker. (faller code checks the 4th pixel, so in effect he's only fallen 3)

A &#A0;"faller" falls 3 pixels at a time, and hence the "add 3" later. But when he's a walker, hes allowed to fall 4 first, before the counter is even set. But due to the faller checking the current pixel first, and not the one below him, its only 3

So there you go... even us tired old slobs get it wrong when reading others code :) &#A0;
(actually.... I get it wrong all the time.... and the only way to stay normal is to admit it! &#A0;:mikewinktounge: )
Well done! You may now run around feeling smug, and telling everyone how cool you are! &#A0;:mikecool:

Wonder if the Amiga one is the same.... probably.

Offline Mike

  • Posts: 105
    • View Profile
Re: Mike! I want to ask you...
« Reply #111 on: June 23, 2005, 08:48:28 PM »
Now it gets interesting.... The Amiga one is different!!

When a walker falls 4 pixels, he sets the counter to 3 to start with, not 0!

The first thing a faller does, is check the current pixel, so the 4th pixel the faller fell, doesn't matter. It DOES start with 3. In effect, a walker will fall the first 3 pixels, even though he moves down 4, the 4th is tested by the faller code... This allows you to "see" the animation, rather than it happening in a single frame.

This means the PC version does have a bug, and some levels would be easier to complete. ahhh.. knew the Amiga one was better :D

Wonder if Windows Lemmings has the same bug? It was a complete rewrite, but would be based on the x86 code. (I dont have this...)

You should get an emulator and test the Amiga one now.....since your so good at it!  ;)

Offline Mike

  • Posts: 105
    • View Profile
Re: Mike! I want to ask you...
« Reply #112 on: June 23, 2005, 09:55:24 PM »
Russell just had a look at the Windows Lemmings code. It looks like it has the same bug... unless theres a "fix" elsewere in it...he's going to check...

Quite nice actually.. All in C++, even though it was written way back in 94! Ahead of its time!

Although... its funny how ugly "structured" code can look compared to simple assembler. When you don't use goto's in C, nested IF's can look horrible.

Offline Mindless

  • Posts: 722
    • View Profile
    • Lemmings Level Database
Re: Mike! I want to ask you...
« Reply #113 on: June 24, 2005, 12:39:34 AM »
Quote from: Mike  link=1105852459/90#101 date=1119534386
There is an indirection table for levels. So when on level (say 4), it might tell you to load level 15 instead.

Below is the table I have. The numbers have to be divided by 2. If the bottom bit is set, then its a duplicate, and it gets the new skills from an "odd table", which is loaded in from "ODDTABLE.DAT".

These are levels that have new skills to make them easier. So if the indirection table has the bottom bit set, its a duplicate level, with overidden skills. The PD version, doesnt use an indrection table, and while the data disk does(Oh NO!), it doesnt use the odd table.


; Fun Levels
      db      147,155,157,149,151,153,159,14,22,54      
      db      70,16,29,32,38,42,48,72,84,104
      db      138,23,68,96,98,116,78,100,108,134

; Tricky Levels
      db      1,30,36,50,52,56,58,80,102,120
      db      128,130,136,5,148,152,154,156,160,7
      db      11,13,15,17,19,21,25,27,33,31

; Taxing Levels
      db      37,39,41,43,45,47,49,51,53,55
      db      57,59,61,63,3,65,67,69,71,73
      db      75,77,79,81,83,85,87,89,35,111

; Mayhem Levels
      db      91,93,95,97,99,101,103,105,107,109
      db      112,113,115,117,119,121,123,125,127,150
      db      129,9,131,133,135,137,139,141,143,145

So this is hard-coded into the Lemmings executable?

Edit: Also, what is the 'PD version'?

Offline Mike

  • Posts: 105
    • View Profile
Re: Mike! I want to ask you...
« Reply #114 on: June 24, 2005, 11:26:44 AM »
On the PC version yes.... I think the Amiga one loads it.

PD is Public Domain, or "free" demos.

guest

  • Guest
Re: Mike! I want to ask you...
« Reply #115 on: June 27, 2005, 11:19:15 AM »
Quote from: Mike  link=1105852459/105#111 date=1119559708
Now it gets interesting.... The Amiga one is different!!

When a walker falls 4 pixels, he sets the counter to 3 to start with, not 0!

I'm sorry, and I especially hate to re-bring this tired topic up, but I just checked the Amiga version and I don't believe it behaves differently compared with the PC version, in regards to the maximum height of fall.

The smoking gun is the Mayhem-1 test.  As some people here might know, on Mayhem 1, if you have the first lemming build immediately upon landing, that 1 pixel from the build brick is enough to lower the falling distance to become safe for everyone.

If the Amiga version has a shorter safe falling distance than the PC, then one of the following should be true:

1) This trick only works on the PC version and not the Amiga; or

2) This trick works on both versions, but on the PC you wouldn't even need this trick to begin with, since it supposedly have a higher safe falling distance.

Neither are true however.  The trick works on both versions, and on the PC the drop as-is is fatal as intended.

It's possible that maybe the level is layout slightly differently in the two versions, but to rule that out, I measure the distance from entrance to ground for that level, and they are the same on both versions.

------------------

Now I don't want you to go over the code again like you did last time (I was actually rather surprised that you even bothered).  But I think it's safe to conclude that reading code has proven not to be an authoratative way to settle questions regarding Lemmings game mechanics, especially when the code in question is written 10 years ago.  ;P

In other words, next time someone here has a question about game mechanics, please do everyone a favor and figure it out on your own.  Have pity on Mike the old man.  ;P

-----------------

I want to end this by posting the partial disassembly I got from my copy of the PC version of the game.  It matches what Mike said for the most part, but not in certain places.  In particular, fallcount seems to be initialized to 3 as far as I can tell, not 0 as Mike said.

I commented the stuff as best as I could, to show what I managed to gather out of the code.  If you understand my comments, you should understand why I believe the code, in the way it is written, accidentally allowed for the lemming to fall up to 63 pixels even though it probably intended only 60.

Because it is several screens worth of stuff, most of which would be gibberish to most people, I've posted it on my site instead of directly in this post:

http://www.geocities.com/guestlevels/lemmings/disassembly1.txt

Offline DragonsLover

  • Posts: 1234
  • Do you want fire?
    • View Profile
Re: Mike! I want to ask you...
« Reply #116 on: June 27, 2005, 03:53:30 PM »
This is interesting... and crazy too! =8O

But Mike, what about:
a. First level music reappears on other levels when there's a failure
b. Cheat code and Version number code don't work on some versions (sometimes it's only the cheat code that doesn't work and sometimes it's the Version number code).

I guess, still there, that it's still hacking, right?

Then finally, is it possible to get a fully originial lemmings where there's no bugs of whatever on PC only?
I like dragons! They're the center of my life! I'll never forget them...

Offline Mindless

  • Posts: 722
    • View Profile
    • Lemmings Level Database
Re: Mike! I want to ask you...
« Reply #117 on: June 27, 2005, 05:45:28 PM »
Quote from: guest  link=1105852459/105#115 date=1119871155
I want to end this by posting the partial disassembly I got from my copy of the PC version of the game.  It matches what Mike said for the most part, but not in certain places.  In particular, fallcount seems to be initialized to 3 as far as I can tell, not 0 as Mike said.

I commented the stuff as best as I could, to show what I managed to gather out of the code.  If you understand my comments, you should understand why I believe the code, in the way it is written, accidentally allowed for the lemming to fall up to 63 pixels even though it probably intended only 60.

Because it is several screens worth of stuff, most of which would be gibberish to most people, I've posted it on my site instead of directly in this post:

http://www.geocities.com/guestlevels/lemmings/disassembly1.txt

What app did you use to disassemble it?

guest

  • Guest
Re: Mike! I want to ask you...
« Reply #118 on: June 28, 2005, 05:03:06 PM »
Well, the lemmings EXEs are compressed with pklite, so you'll first need to uncompress them.  There's a "pkunlite" program out there that can do this, Google for it.

After that, pretty much any DOS debuggers can give you a disassembly, even the lowly DEBUG.EXE from the days of DOS.  Again, I suggest Googling to find one.

Of course, the entire diassembly has like probably over 10 thousands lines, so...well, have fun. :)  For the purpose right here, since Mike produced some source code, I have an idea what the corresponding assembly code is, so I just do a byte-search in the debugger to find what I'm looking for and go from there.  You'd noticed from my comments in disassembly1.txt that even after confining yourself to a small section, there's still a lot of guessing as to what a lot of the code actually does.

Offline Mindless

  • Posts: 722
    • View Profile
    • Lemmings Level Database
Re: Mike! I want to ask you...
« Reply #119 on: June 28, 2005, 05:36:54 PM »
I'm not planning to disassemble it, I was just wondering what app you used... :P