Too fast?!

I’m using the gage timer for an animation loop. Everything starts out fine with the animation limited to the framerate I set, but once the hotspot compiler does its optimizations, everything speeds up the maximum rate possible on my computer…

Have other people seen this issue or have suggestions? I can post my timing code if necessary.

Thanks,
Brian.

A few questions to help diagnose the problem:

  1. How many FPS are you targetting?

  2. Are you testing on Windows, Mac, or Linux?

  3. Is this an Applet or an Application?

  4. If it’s an application, is the DLL loading and/or is this JDK 1.5?

hi,

i experienced the same problem in two different games:

game 1: racing applet, target framerate 30fps, no gage timer
game 2: football game, target framerate 50fps, webstart application, gage timer used

i have the timer dll’s installed on my windows machine.
i use j2sdk1.4.2_04.

it’s strange, most of the time everything works fine, but then suddenly the fps jumps up dramatically (100-300 fps) which makes the games unplayable and racing time measurement becomes worthless.

any hints would be appreciated …

Sorry, for taking so long to get back, but I’ve been distracted by life stuff…

JBanes, answers to your questions:

  1. i usually target about 30 fps
  2. windows
  3. application
  4. java 1.4.2_06 and the dll must be loading or else I can’t see how the gage timer would be working.

I might try to work up a small test case later, but for now I’m stumped.

if it doesn’t find the dll, it falls back to the crappy currentTimeMillis().

[quote]Sorry, for taking so long to get back, but I’ve been distracted by life stuff…
[/quote]
My apologies as well. A few of these posts seemed to have slipped my attention.

Number 4 can be checked by looking at the console on startup. If you see a stacktrace, the DLL is not loading. Would you be able to post your timing code? It should look something like this:

AdvancedTimer timer = new AdvancedTimer();
long frameTicks = timer.getTicksPerSecond()/30;
long time = 0;

timer.start();

while(running)
{
  //draw stuff
  at.sleepUntil(time + frameTicks);
  time += frameTicks;
}

Let me know if that helps. :slight_smile: