stable FPS / delay

Monkey Forums/Monkey Programming/stable FPS / delay

teremochek(Posted 2012) [#1]
Good day,
My FPS is not stable. It changes all the time. That more or less.()
Maybe stupid question .. Is it possible to overcome the instability, with a delay?
Each cycle of waiting for a number of milliseconds.
I think if each cycle lasts the same time, the FPS will be stable and will not be mini jerks.
DeltaTime() I'm not interested.


teremochek(Posted 2012) [#2]
I'm not sure, maybe I is not all right with your computer.
in the example - "DeltaTime" I have 15-30 ms (in flash)


GC-Martijn(Posted 2012) [#3]
I think that you have to use DeltaTime, or a faster computer ?


anawiki(Posted 2012) [#4]
@teremochek: Are you talking to yourself here?

Anyway, just use delta time, because while "waiting enough ms" is possible to achieve on various platforms, it's probably harder to do than using delta time.


teremochek(Posted 2012) [#5]
> @teremochek: Are you talking to yourself here?
Yes of course. Inattention.

> I think that you have to use DeltaTime, or a faster computer ?
Lacked the power of the computer, make stable fps.
(AMD955 3.2GHz, 4GB DIMM, GTS255)

I know. Just better not to pay attention ;)


Rixarn(Posted 2012) [#6]
What target are you compiling for?

There is an occasional delay, or stuttering inherent to Monkey in some platforms due to the automatic system used to manage Frame Updating, this has been discussed before:

http://www.monkeycoder.co.nz/Community/posts.php?topic=1436#15371

You can do some things to lessen it, but as far as I left the issue, it wont go away completely.


teremochek(Posted 2012) [#7]
Thanks,
(html5,flash,glfw,xna)I also have a little-stuttering on my device (3Q Qoo! Surf Tablet PC TS1004T).


Rixarn(Posted 2012) [#8]
You can "skip" monkey's inherent frame rate management system by putting all your game logic in the Render() method, as suggested in the topic I just linked.
Sounds weird, because your Update() method will be empty but as far as I know, it's one of your best options.


Shinkiro1(Posted 2012) [#9]
Will putting all logic in OnRender() will somehow slow it down?
(I don't think so just asking to sure)


muddy_shoes(Posted 2012) [#10]
Depends what you mean by "slow it down".

For any given update+render the same work would be done whether the logic was in the OnUpdate or the OnRender, so there's no slow down in that sense.

However, what it does is ensure that an update cannot take place without drawing the result. This means that if you're not meeting the update rate that you set then you will see the game slow down rather than the standard Monkey behaviour of skipping frames and getting a slideshow. The benefit is that you also get rid of the intermittent frame jump that the standard update mechanism causes on some platforms.


Samah(Posted 2012) [#11]
@Rixam: You can "skip" monkey's inherent frame rate management system by putting all your game logic in the Render() method, as suggested in the topic I just linked.

This is how libGDX handles delta timing, and I prefer it.


teremochek(Posted 2012) [#12]
I moved the game logic in OnRender Method (). And it seemed to be it's all good.
But I noticed that the Android was not a stable FPS.
I had 30 FPS in the game. Now I put the 60 FPS.
And use the Update () method of half time.
And it works. The game runs smoothly.
...
Field FPS:Int = 60
...
FPS_time+=1 If FPS_time>1 FPS_time=0
If FPS_time=0 OnUpdate2()
...


For better optimization, I want to use the method OnRender every two cycles.
But then the screen will flash ... Android and XNA automatically blanks the screen.