Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Consistent frame rate regarding android devices

Author
Message
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 22nd Oct 2012 21:01
Since there are different android devices (some have more powerful specs than others), what is the best way to make the game consistent speed regardless of the devices?

1) Assuming if there's no performance issues setting frame rate at 30, does setting frame rate at 30 for each device means they all will run at the same speed?

2) If using the set frame rate is not consistent for all devices, I guess the best thing to do is to set a time increment process to move sprites in the game?

I'm just curious as to what approach do you take to make the game speed consistent across all devices.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Oct 2012 21:33
1. Yes.

I would imagine most devices could keep to 30fps for all but the most intense apps, so setting it to that is probably a good idea. 60 fps is difficult to achieve on lower end devices unless the app is fairly simple and low memory useage. You can try using the getframetime command for a timer based approach also, but I have not really liked the results when I have tried in the past. Some swear by them and always incorporate one into the game loop. There are posts in the DB forums about different methods.
Setting the sync rate to 0 and syncing the screen yourself using the timer is normally as far as I go with that sort of thing.

The Zoq2
14
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 23rd Oct 2012 21:48
I would suggest using timers. Personaly I have a variable which is 1 when the FPS is at 60, and 2 when its 30 ect. Then I just multiply all movment with that variable and it gives me a constant speed
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 24th Oct 2012 00:05
agk have a frame timmer built in .

I think its called GetFrameTime().

40.0*GetFrameTime() will move your sprite at the same speed on almost all framerates.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
The Zoq2
14
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 24th Oct 2012 00:26
That's the command you want to be using.

Login to post a reply

Server time is: 2024-04-27 21:11:06
Your offset time is: 2024-04-27 21:11:06