Author Topic: Smooth moves  (Read 2633 times)

0 Members and 1 Guest are viewing this topic.

Offline Simon

  • Administrator
  • Posts: 3151
    • View Profile
    • Lix
Smooth moves
« on: September 08, 2016, 06:42:35 AM »
I've dabbled in the Lemmini source on bitbucket, or
git clone https://bitbucket.org/fade0ff/lemmini
Does the Superlemmini source sit somewhere on the web, too? namida pointed me to the zip in the Superlemmini 1.03 release thread.

I've always wondered whether Lemmini is fully hi-res, or lo-res physics with hi-res graphics. The lemmings move very smoothly compared to other games. Is this a purely visual perk, or are the game physics this smooth?

The answer is full hi-res: Builders move 4 pixels ahead during a cycle, that's hi-res. Nonetheless, hi-res isn't obvious: Fallers fall 3 pixels per physics update, that's the same speed as Dos L1 fallers, which would imply lo-res. Hmm.

The solution is that Lemmini performs a physics update every 30 ms, this means 33 frames per second. It updates twice as fast as Dos L1 or Neolemmix at 17 fps, and more than twice as fast as Lix at 15 fps. If we fall at Dos L1 speed, and the distance fallen is half as much as Dos's due to hi-res vs. lo-res, and we fall twice as often, everything fits together again.

But 33 fps isn't obvious from the source either. The source boldly claims:
/** Lemmini runs with 50fps instead of 25fps */
TIME_SCALE = 2;
Bleh? This comment won't digest smoothly with
/** time per frame in microseconds - this is the timing everything else is based on */
MICROSEC_PER_FRAME = 30*1000;

...and this is the code used in the main loop. But doesn't matter, either 25 fps or 33 fps is more than Dos L1, and the thing is definitely hi-res.

Now, if you watch Lemmini closely, you will notice that the lems moonwalk. In detail: Walkers alternately move ahead by a hi-res pixel and animate, and then, in every other physics update, they move ahead by a hi-res pixel, but don't animate. This comes from TIME_SCALE = 2; the lemmings animate only every other physics update.

I conjecture that Windows Lemmings was lo-res physics with hi-res animations, and then Lemmini took the hi-res animations into faster, hi-res physics. Can someone shed light on the Windows Lemmings?

-- Simon
« Last Edit: September 08, 2016, 09:01:23 AM by Simon »

Offline ccexplore

  • Administrator
  • Posts: 5311
    • View Profile
Re: Smooth moves
« Reply #1 on: September 08, 2016, 07:09:46 AM »
Tsuyu can confirm, but from vague memories I believe Lemmini was intended from day one of conception to be hi-res in both physics and graphics.  Using the WinLemm graphics was probably a practicality as there were no other readily available hi-res graphics to borrow.  Your conjecture on WinLemm is probably correct and would explain why Lemmini compromised on the animation given that the source did not have animations at a doubled framerate.

Offline Simon

  • Administrator
  • Posts: 3151
    • View Profile
    • Lix
Re: Smooth moves
« Reply #2 on: September 08, 2016, 10:23:53 AM »
Thanks, these design decisions are good to know. 2006 was before I began to lurk Lemmingsforums. 8-)

-- Simon

Offline Tsyu

  • Moderator
  • Posts: 350
    • View Profile
Re: Smooth moves
« Reply #3 on: September 08, 2016, 07:58:57 PM »
But 33 fps isn't obvious from the source either. The source boldly claims:
/** Lemmini runs with 50fps instead of 25fps */
TIME_SCALE = 2;
Bleh? This comment won't digest smoothly with
/** time per frame in microseconds - this is the timing everything else is based on */
MICROSEC_PER_FRAME = 30*1000;

...and this is the code used in the main loop. But doesn't matter, either 25 fps or 33 fps is more than Dos L1, and the thing is definitely hi-res.
MICROSEC_PER_FRAME (or NANOSEC_PER_FRAME in SuperLemmini) sets the time interval between frames--in this case, 30 ms, which results in a frame rate of about 33.33 FPS. TIME_SCALE only affects lemmings, and it sets how often lemming graphics animate, among other things--in this case, every 2 frames. (By the way, the "50fps instead of 25fps" comment is wrong; neither Lemmini nor SuperLemmini runs at 25 or 50 fps. I'm not sure where the 25 figure came from, but it's definitely wrong for Lemmini, SuperLemmini, and even the Amiga version of Lemmings.)

I conjecture that Windows Lemmings was lo-res physics with hi-res animations, and then Lemmini took the hi-res animations into faster, hi-res physics. Can someone shed light on the Windows Lemmings?
Correct. I'll also add that Windows Lemmings runs a bit slow, with each game second taking longer that it should, but I think it still has 17 frames per game second.

Tsuyu can confirm, but from vague memories I believe Lemmini was intended from day one of conception to be hi-res in both physics and graphics.  Using the WinLemm graphics was probably a practicality as there were no other readily available hi-res graphics to borrow.  Your conjecture on WinLemm is probably correct and would explain why Lemmini compromised on the animation given that the source did not have animations at a doubled framerate.
I'm pretty sure you're correct there.

Offline Simon

  • Administrator
  • Posts: 3151
    • View Profile
    • Lix
Re: Smooth moves
« Reply #4 on: September 09, 2016, 05:59:48 AM »
Awesome, thanks for making this clear.

-- Simon