Currently, to have my game run at a consistent frame (or should I say cycle) rate, I: 1) Determine the Cycles Per Second I need, for this example 40 2) After each cycle is complete, I have the game Sleep for the remainder of time allocated to that cycle.
Problem is, this process seems to create a big performance hit on my game. Even if I jack up the Cycles Per Second, the game still runs slow. However, if I removed this code, the game flys way too fast (in the hundreds of Cycles Per Second). Is there a better way to accomplish this?
As far as increasing the FPS is concerned...I saw a game, which really did not respond well with very high FPS, as developer had used the FPS in an equation of his game, which was giving this negative effect... if you could post the portion of the code that deals with your thread's sleeping for the remaining time, the problem may get sorted out...
Have you considered the use of TimerTask and Timer from the MIDP API? I believe that Timer.scheduleAtFixedRate() can produce the intended behaviour: the TimerTask procedure will run with a fixed time rate. See the MIDP documentation for more details.
[ January 15, 2006: Message edited by: Eduardo Marques ]