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 / Changing Frame Rate for Iphone

Author
Message
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 15th Jul 2013 22:28
Firstly what happens if I change the frame rate of my program higher then 60 frames per second, are there any problems that may occur when doing this. Also is 30 frames per second the limit for the Iphone? so even if I have 60 frames a second on my program my do loops are going to run twice as slow on the iphone no matter how little or simple my program is
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th Jul 2013 23:05
Higher than 60 is not recommended and not needed. First, you would be likely to run into more devices that cannot handle high speeds than those that can. Second, because 60 FPS is at the high end of what the human eye is going to process.

30 FPS is perfectly adequate for most things. 30 FPS is safe, most devices will handle that.

Having said all that, if you write the code the right way, you can specify 60 fps and then force the app to sort of behave that way even if it is not actually running at 60fps.

I have no difficulty getting my iPod Touch 4th Gen to do better than 30 FPS, but not always at 60 FPS.

A lot depends on what your code is doing.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 16th Jul 2013 00:23
Ok thanks. What I was trying to do is get a small sprite (16x16) to race around a track which at 60 fps and setting the distance for each movement correctly made the sprite move smoothly and lap at the correct time as it does in real life but I want to be able to speed up the motion by x6 when a button is pressed and the only way apart from speeding up the frame rate is to multiply the movements by 6 but this means that when I press the button to change to x6 and then change back to normal speed the number of loops per lap differ and I'm using the number of loops to time the lap so it's making the lap times slightly out.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Jul 2013 00:55
In order to get what appears to be a constant time across devices, you need to adjust the speed or movement of your sprite based on your target time between frames and the actual time between frames.

The command GetFrameTime will tell you how much time elapsed processing the last frame.

There are lots of examples around this forum for how people have done things for a consistent apparent time on devices that don't always operate at the same rate.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 16th Jul 2013 12:12
Ok thanks for your help, I think my main problem is that I'm trying to use the number of loops made in a lap as the time for that lap because 60 fps can give an accurate time to 16 thousands of a second but when I speed up the program by x6 it means that not only will it be accurate to about 1/10 th of a second also because the number of loops are 6 times less I have to times by 6 to get the number of loops it would have been had the program run at normal speed but its not accurate because its in steps of 6, example normal lap is 4923 loops but speed up to x6 and times loop by 6 = 4920 because its in steps of 6 not 4923 like it should.

That's why I asked about frame rate because switching between frame rate would have been perfect, in fact having my program at 10 fps then switching to 60 fps to make game speed x6 would work but 10 fps along with making my sprite go round the track in the correct time would make the sprite seem to jerk along the track more
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 16th Jul 2013 12:28
you could possible give it some motion blur along these lines.
[pseudo code]

while going extra fast{
for k=1 to 6
Set sprite colour alpha (k*42.5) rem will be 255 at last frame
[Move sprite at regular speed]
DrawSprite(spriteID)
next
}

hope that makes sense

I've never tried motion blur this way, but it might work

Login to post a reply

Server time is: 2024-05-08 22:23:10
Your offset time is: 2024-05-08 22:23:10