Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Automatic Frameskipping

Reply to topic
Author Message
Consolemu
  • Guest
Reply with quote
Automatic Frameskipping
Post Posted: Sat May 20, 2000 4:02 pm
This is something that's been bugging for a number of years and it's not going to stop until I learn it. At school, my buddy was writing a fairly nice bowling game for our programming class (Hence, why I wrote Wurm) and he was trying to explain his technique for autoframeskip but I just didn't understand what in the hell he was talking about. The only thing I could decifer was that the graphics were to be updated in certain increments but I already knew that. I also know the old school technique of waiting for vsync by the monitor but that's still sucks for older systems. I do understand plain frameskipping though. Like, if it's set to all, then show all frames. If it's set to 2, then skip one frame and show the next...and so on. But who wants to keep switching back an fourth the frames everytime the game demands heavy update and when it doesn't?

Chris :o)
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Post Posted: Sat May 20, 2000 6:56 pm
My suggestion is that you should even bother about it.
Optimize your algorythms first.
You shouldn't be doing anything CPU intensive, right?
  View user's profile Send private message Visit poster's website
Consolemu
  • Guest
Reply with quote
Post Posted: Sat May 20, 2000 9:16 pm
Quote
> My suggestion is that you should even bother about it.
> Optimize your algorythms first.
> You shouldn't be doing anything CPU intensive, right?


True, but some times the demos and games I create either run way too fast or too slow. That's why with auto frameskip there's no worry. My game, Wurm, uses a Windows-based timer control that's not constant. Some times my game will lag or others it will run too fast and a game like Nibbles is very time extensive, especially with the controls. It's not a major problem but it's something I would like to fix. Mabye autoframeskip would help, mabye it wouldn't. I think it would though.
 
vecna
  • Guest
Reply with quote
Hmmm....
Post Posted: Sun May 21, 2000 2:14 am
Quote
> True, but some times the demos and games I create either run way too fast or too slow. That's why with auto frameskip there's no worry. My game, Wurm, uses a Windows-based timer control that's not constant. Some times my game will lag or others it will run too fast and a game like Nibbles is very time extensive, especially with the controls. It's not a major problem but it's something I would like to fix. Mabye autoframeskip would help, mabye it wouldn't. I think it would though.



Well, I think you're confusing terms. 'autoframeskip' is an emulation term, specifically.. I guess it's pretty much the same thing, but what you basically want is a system-independent timer-driven speed throttle sort of thing.

I always set up a timer at 100hz (of course, you can change the frequency) in the background of my games (non-emu) and all the timer does is update a counter. The basic loop I use, then is this:

while (true) // game loop
{
while (timer)
{
timer--;
GameLogic();
}
RenderGameScreen();
}

This way, your game logic will ALWAYS execute at 100 ticks per second, constantly, regardless of what fps you get.

- vecna
 
Limbs a Flyin'
  • Guest
Reply with quote
Re: Hmmm....
Post Posted: Sun May 21, 2000 2:12 pm


Quote
> Well, I think you're confusing terms. 'autoframeskip' is an emulation term, specifically..

no, i'm pretty sure that almost all pc games made in the last 7 years were 'autoframeskipping'
 
Jose Manuel Delgado
  • Guest
Reply with quote
Post Posted: Mon May 22, 2000 10:31 pm
Hello :)

I may to try to explain how to implement frameskipping. The method i use is taken from Snes9X. I learn it from the code and put it on Calypso.

The basic idea is to have a callback function, with the period the FPS you want: if you want 50 FPS you have a funcion that should be called 50 Herzts, or 20 milliseconds of period.

Next, you have to make a function capable of waste time. The code I use is like that:

void CallBack(void)
{
++Times;
}

int ShouldIRenderThisFrame(void)
{
if(Times >= 1)
{
// We have to accelerate
return 0;
}
else
{
// We have to stop. Emulation are very fast
while(!Times)
waste_time();
return 1;
}
}

void waste_time(void)
{
static int a;

++a; --a; ++a; --a;
}

This is the basic idea. If you want to add manual frameskipping you have to write some more code, but the idea is the same.

I want this help you.

Saludos,

Jose Manuel
 
Reply to topic



Back to the top of this page

Back to SMS Power!