Author Topic: Lemmings 2 Physics Research  (Read 11490 times)

0 Members and 1 Guest are viewing this topic.

Offline RavenNine

  • Moderator
  • Posts: 58
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #15 on: March 23, 2022, 07:04:42 PM »
Sorry for the late reply. I will take a look and let you know how the integration goes. There will be no skill, lemming or projectile hard limits as per the original game as they had to deal with tight memory constraints. It's why you could only select certain skill combinations in practice levels for example. L2Player will let you fill all of the skill slots with any combination for practice levels. Been busy IRL last month or so, but hoping to get back into the flow very soon and get some more skills implemented. As always, thanks for your efforts and help.

Online Simon

  • Administrator
  • Posts: 3860
    • View Profile
    • Lix
Re: Lemmings 2 Physics Research
« Reply #16 on: March 24, 2022, 11:05:34 PM »
Excellent research by both of you! Wonderful level of precision and thoroughness. I've followed the thread in detail since the beginning. :laugh:

The projectiles have felt like they share code, e.g., all projectiles have strong air resistance. But I wouldn't have guessed that even the Superlem reuses projectile code. Hmm, it makes sense for aiming. I'm really looking forward to more such surprising theory, and of course to L2Player.

Yes, ditching the memory restrictions in practice mode is a good idea, even if you're aiming at 100 % bug-compatible physics. IIRC, the L2 blocker also fails on vertically-scrolling levels, that might be another candidate to allow in L2Player.

-- Simon

Offline Ste Woz Ere

  • Lemmings 2 fan
  • Posts: 73
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #17 on: March 25, 2022, 11:14:20 PM »
Another candidate I'd like to see retained is the ice physics - where the lemmings slowly slip & slide their way across. (every back & forth cycle sees them end up 1 pixel further forward, in the direction they were facing when they first went onto the ice)

I found this very useful for designing Polar levels with, as it lets you auto-contain the crowd for a fixed amount of time.
Tribes of Steel - a whole new Lemmings 2 game! (120-level pack)
Currently a WIP - all tribes are complete, testing and feedback is welcome!

Offline RavenNine

  • Moderator
  • Posts: 58
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #18 on: March 28, 2022, 12:27:03 PM »
@Simon - It's definitely a fun research project with many interesting aspects :laugh: Blockers work on any level in L2Player currently. So I can tick that one off the list.
@Ste Woz Ere - It's a good one to maintain when it's relied on for timing. I've not fully investigated ice physics yet. But I will add it to my list.

I temporarily paused development on skills to implement state rewinding. I'm getting to a point where it would be very beneficial for debugging new skills as I add them. Anything to speed up the iteration loop.

It's looking promising so far. Binary serialisation is working as expected, with the state snapshots stored in a queue structure. Well, three queues. Seconds, tens of seconds and minutes. New snapshots are pushed into the seconds queue every second, then the snapshots are then popped/pushed automatically into the tens/minutes queues to consolidate and discard snapshots as necessary. This should hopefully simplify rewinding by either 1 second, 10 seconds or 1 minute at a time.

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: Lemmings 2 Physics Research
« Reply #19 on: March 28, 2022, 06:21:37 PM »
Is serialisation necessary? In Loap (which I feel implements this much more tidily than NeoLemmix - it should be noted that Loap was designed from the start with this capability in mind, whereas NeoLemmix it was hacked in much much later), I store all game state data in an instance of a GameState class. To create save states, I simply create another GameState with the same contents (and similarly, reverse this to restore one). I haven't tested both approaches, but I feel like compared to this, serialisation would both have more overhead and be easier to have oversights as you add new features.
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline RavenNine

  • Moderator
  • Posts: 58
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #20 on: March 29, 2022, 11:22:55 AM »
I agree storing clones of objects in another class is perfectly valid. The main motivation for binary serialisation was to have the option for fast serialisation to disk if needed. It's currently implemented with a base class which can be inherited from to override its Read/Write methods. I have a set of BinaryReader/BinaryWriter extensions which have support for my low levels types like Vector2, Rect etc.

As you say, it has the potential for more bugs this way. But necessary for storing to disk.

To be honest, my method feels over engineered as disk serialisation is not really needed for rewind states as it only needs to persist for the current level. I don't really even need it to persist between debug sessions. It could be nice as a "Quit and finish playing this level later" feature maybe.

Hmm, now I'm torn between binary serialisation and object cloning... :laugh:

Offline RavenNine

  • Moderator
  • Posts: 58
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #21 on: April 16, 2022, 04:27:11 PM »
@exit - The Super Lemming implementation is coming along nicely. The counter you mentioned seems to be used for both general state timing and determining the frame to use. I have updated the sprite structures to handle animation segments based on an angle. There is now a single interface for determining which frame of an animation to use based on a direction. It supports an arbitrary number of frames with a starting angle offset and a min/max angle. This is to support various animations which have directional frames. The frame totals for these animations vary from 16-64 frames with varying start/end angles.

Super Lemming has 32 directional frames and these are used to lookup acceleration and collision offsets. The offset point appears to be the top of the lemmings head.

See attached test gif (Red dot is origin, pink dot is collision offset)

Next step is to finish flight and landing states :)

Offline RavenNine

  • Moderator
  • Posts: 58
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #22 on: April 17, 2022, 03:41:00 AM »
A quick preview of Super Lemming in action. Just in the process of comparing to DOSBox for accuracy.

A wall collision and a water collision bug has been corrected from the DOS version.

Video Link: https://youtu.be/ED1RIVn7DpI

Offline RavenNine

  • Moderator
  • Posts: 58
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #23 on: April 18, 2022, 06:42:00 PM »
Super Lemmings now working as expected. This leaves Jetpack and Projectiles to finish.

I took the opportunity to do some clean-up, refactor level object rendering, fix some trigger issues and implement triggered traps.

I attached some gifs of some of them working. (Clicking image starts the animation)

Offline exit

  • Posts: 197
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #24 on: April 20, 2022, 03:30:31 PM »
Looks great. I'm happy that you've been able to get the SuperLemming working so quickly.

I've started to look at the projectiles, and I'll give an update when I have a full analysis.

Offline RavenNine

  • Moderator
  • Posts: 58
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #25 on: April 20, 2022, 09:10:03 PM »
Great stuff! Looking forward to it :)

Offline Ron_Stard

  • Posts: 312
    • View Profile
Re: Lemmings 2 Physics Research
« Reply #26 on: April 21, 2022, 11:20:20 AM »
Thank you all for this enormous effort! Lemmings 2 has always been my favourite game of all Lemmings saga. The possibility of playing some day an updated port of this game is innefable! :thumbsup: