force 60 fps all time.

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

force 60 fps all time.

Postby fabiitch » Thu Jan 25, 2018 10:23 pm

Hello i use ligbgdx often, and i got a new screen with 30hz now (yes i dont see it when i buy).

And i see that my programm turn in 30fps on this screen . ok normal. And if i change the window on my second screen, the program up to 60 fps.
i use
Code: Select all
Gdx.graphics.setTitle("FPS : " + Gdx.graphics.getFramesPerSecond());


But my box2D simultation follow this speed. So on my screen with 30 fps the simulation is 2x slow.

How i can force to got 60 update ? i should get 2 threads, one for update and one for render ? or a option to fix it.

My program got one loop, render for screen implements, and inside i call
Code: Select all
world.step(1 / 60f, 20, 20);


thanks for reading.
fabiitch
 
Posts: 14
Joined: Thu May 14, 2015 11:59 pm

Re: force 60 fps all time.

Postby evilentity » Fri Jan 26, 2018 10:57 am

You can buy a screen with 30hz refresh these days?
Well, the solution is to fix your time step. You do call world.step(1/60f,...); but the number of times you do that depends on the framerate you are running.
This is a classic read about the topic.
https://gafferongames.com/post/fix_your_timestep/
Looking for a freelancer? PM me!
evilentity
 
Posts: 4461
Joined: Wed Aug 24, 2011 11:37 am

Re: force 60 fps all time.

Postby fabiitch » Fri Jan 26, 2018 6:10 pm

thanks you !

Yes i buy a 30 hz screen ^^, it was very large for 200€ (24 inch).
And this liar overwatch show 60 fps in his hud. :D
fabiitch
 
Posts: 14
Joined: Thu May 14, 2015 11:59 pm

Re: force 60 fps all time.

Postby Magnesus » Mon Jan 29, 2018 7:42 am

What type of screen is it? Could you post the name? It's weird that such screens are available unless you are running it at 4k 30Hz (then it's old HDMI limit)?

And if you plan on releasing the game on mobile you need to fix your timestep (per the article posted above) so it works properly at 30Hz because some phones lower the refresh rate to 30FPS in power saving modes.
Magnesus
 
Posts: 1632
Joined: Sun Sep 25, 2011 3:50 pm

Re: force 60 fps all time.

Postby fabiitch » Fri Feb 02, 2018 4:50 pm

Re, my screen is a Samsung U28E590. And on the NVIDIA panel i can change the Hz frequency (30 ,29,25,24 ,23) On my second screen its 60 Hz.
fabiitch
 
Posts: 14
Joined: Thu May 14, 2015 11:59 pm

Re: force 60 fps all time.

Postby evilentity » Fri Feb 02, 2018 9:02 pm

You sure its 24 inch? It should be 28, its in the model number. It also is 60hz, you sure you didnt mess up the setup? Like using single hdmi cable?
Looking for a freelancer? PM me!
evilentity
 
Posts: 4461
Joined: Wed Aug 24, 2011 11:37 am


Return to General Development

Who is online

Users browsing this forum: No registered users and 1 guest