Page 1 of 1

50/60Hz Speed Differences

Posted: Thu Dec 08, 2016 3:33 am
by themrcul
Hi peeps,
I have genuinely searched/scoured the forums to try to find the answer, but I haven't yet, and would really appreciate some advice before delving into my first MD SGDK project!

I live in a PAL region, so getting the PAL version of a game running at the correct speed as the NTSC version is close to my heart.

My question is, how to do you get the PAL version of a MD game to run at (relatively) the same speed as the NTSC version? Especially in terms of sprite/tile animations, and all of the object movement speeds.

I would love for there to be one version of the cartridge that detects the region on startup and does H40 V28 60Hz for NTSC and H40 V30 50Hz for PAL with the speed corrected for the difference. And before writing a ton of code I would like to know how to best go about getting the speed right first, rather than having to fix it all up later.

How do you guys do movement speeds and animation speeds for the 20% difference in speed each region has?

Thanks everyone!

TheMrCul

Re: 50/60Hz Speed Differences

Posted: Thu Dec 08, 2016 11:21 am
by cero
I don't bother, since modern TVs support 60Hz, and Mega Drive wasn't that popular in PAL 50Hz territories. Many of the still active fans have modded consoles that can run at 60Hz.

Re: 50/60Hz Speed Differences

Posted: Thu Dec 08, 2016 2:48 pm
by Stef
You "just" have to consider animation to be *time* based instead of *frame* based and that is ;)
For instance if your walking animation is 15 FPS:

Code: Select all

// 15 FPS animation speed
const fix16 animSpeed = FIX16(1d/15d);

fix16 curTime = 0;

// main loop
while(TRUE)
{
  ...
  
  // add frame time
  if (IS_PALSYSTEM) curTime += FIX16(1d/50d)
  else curTime += FIX16(1d/60d)

  if (curTime >= animSpeed)
  {
    curTime -= animSpeed;
    // pass to next animation frame
    nextAnimationFrame();
  }
  
  ...
  
  VDP_waitVSych();
}
that is the basic idea.

Re: 50/60Hz Speed Differences

Posted: Fri Dec 09, 2016 12:16 pm
by themrcul
Thanks guys, that's really helpful. I'll post again when I have something to share!