Support our Sponsors:
Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2012, 04:28 AM
jlauener jlauener is offline
Member
 
Join Date: Jul 2011
Posts: 42
Default What's your FPS?

What frame per sec do you aim at for your games?

I do believe it's better to stay at 60fps most of the time. But maybe I'm too optimistic and newb in iPhone dev.

If I put down my game to 30-40fps by loading the GPU I really see and feel the difference. The game is not fluid anymore. Funny thing is I always though the human eye cannot see more than 24 image per sec. So why is it so noticable even at 40 fps?
Reply With Quote
  #2  
Old 10-10-2012, 07:08 AM
MarkFromBitmenStudios's Avatar
MarkFromBitmenStudios MarkFromBitmenStudios is offline
Developer
iPad (4th Gen), iOS 6.x
 
Join Date: Apr 2011
Location: Austria, Europe
Posts: 130
Send a message via AIM to MarkFromBitmenStudios
Default

It's hard to troubleshoot this without any details.

This may be due to temporal aliasing depending on your physics/simulation implementation. Did you fix your timestep in your game simulation? Do you interpolate your rendering between fixed timesteps?

Or do you even work with a fixed delta time for your simulation? If so, do you understand the implications?

In some recent Animation WWDC conference, Apple said that everything below 60fps is noticeable but generally, you shouldn't have any issues as long as you stay above 25fps. However, the underlying implementation can make a difference. CPU spikes (you do a complex calculation in one frame) or a overly simple simulation strategy can also have an impact even if you consistently maintain a high (average) fps.

It's also worth checking out in how far it feels non-fluid. Is it simulation slowing down with the frame rate? Is the movement getting jerky? This helps track down the reason.

I'm not sure how much experience you bring to the table but since you said you are a newb, maybe it's worthwhile to check out some basics, like Glen Fiedler's article on timesteps. It pretty much explains everything you need to know.

Following that advice, you may be able to sort out your problems.

On a different note, make sure you get familiar with Instruments as it can help track down reasons for fps drops and generally identify bottlenecks in your game. There's many instruments in its library for both CPU and GPU profiling.

There's also another tool in Xcode in some subfolder that helps you analyze whether you are GPU or CPU bound (forgot the name of the tool).

Good luck!
Reply With Quote
  #3  
Old 10-10-2012, 05:10 PM
jlauener jlauener is offline
Member
 
Join Date: Jul 2011
Posts: 42
Default

Mark, thanks for this very informative answer!

Actually I'm trying to implement a glow shader for a 2D game I'm working on. I was using full size texture for the blurring (iPhone4, using 320x480) and this put down the FPS down to like 30. Scaling the texture down 4 times and using 1 pass of blurring is giving good result in terms of performance (steady 60fps) however visually speaking it is not that good (but ok though). Now I'm wondering about retina display and old devices. This is going a bit out of subject but maybe somebody can give me some pointers here. Is glow shader a good idea on mobile or is it wiser to use pre-rendered sprites?

To go back on the subject I'm using a delta everywhere (graphics+physics). Thanks for pointing me the article I didn't know about the concept of semi fixed timesteps.

Putting back the full size shader I run my game to look carefully what's not fluid and actually the physics seems fine, objects move correctly and are fluid. The only thing that looks jerky is the moving background (a simple repeated texture) which for the moment is a simple grid (hello placeholder graphics). I think such pattern makes lags/low fps more apparent than with other free moving objects.
Reply With Quote
  #4  
Old 10-11-2012, 06:10 AM
bluescrn bluescrn is offline
Member
iPhone 5, iOS 6.x
 
Join Date: Dec 2011
Posts: 51
Default

I always aim for 60fps, it makes an immense difference to the feel of a game.

But how achieveable it is depends massively on the device...

The iPad 1 and iPhone 4 are by far the hardest to keep the framerate up on - lots of pixels and a comparitively weak GPU.

For our first game, Little Acorns, we managed to get it running at 60fps on everything 3GS and above (a bit of slowdown on iPad 1 though). 60fps is essential to make a 2D scrolling platformer feel good. While the game did support older devices, it was a fair bit slower, and didn't feel nearly as good.

For my new project, Skyriders, performance has been much more of a challenge. It's locked to 30fps on 3GS/iPad1, but manages 60fps most of the time on an iPhone 4, and on newer devices, it does a solid 60 with antialiasing too.

Basically, on iPhone4/iPad1, you can't use pixel shaders if you want to run at 60fps. They just cost too much. And you've got to be very careful with how much alpha blending you use. Vertex shaders are fairly OK, though.

Both games use variable timesteps, so they can handle more varied framerates if needed (e.g. on PC or Android), and if the timestep gets much bigger than 1/60th of a second, I start to do two or more updates per render, to avoid an update with a large timestep, which could potentially start to cause collision/physics bugs.

We're getting closer to the point where iPhone4/iPad1 can be considered 'old, low-spec devices', though - and if we're targetting primarily iPhone4S/iPad2 and above, there's a lot more potential for shadery fun whilst maintaining a good framerate!

Once nice little trick I used - I wanted to render the game, blurred, underneath the pause menu. Blurring it every frame would be very expensive, so I just rendered a single blurred frame to a texture, once, when the pause button is pressed - then can just draw that as the background behind my menus.

Last edited by bluescrn; 10-11-2012 at 06:14 AM..
Reply With Quote
  #5  
Old 10-11-2012, 04:45 PM
antireality antireality is offline
Junior Member
iPhone 4S, iOS 5.x
 
Join Date: Mar 2011
Location: Kingston Upon Thames, UK
Posts: 19
Default

Generally a constant framerate is more important than a higher one - a solid 30fps will look smoother than hitting 60 most of the time and stuttering occasionally.

Do 30 if you think more detail and a busier world is worth the payoff, but try to keep it locked if possible.

I'd have thought that shaders would be fine on an iphone 4 if written carefully and following IMGs guidelines - after all, fixed-function is pretty much just a pre-rolled shader anyway these days...

Last edited by antireality; 10-11-2012 at 04:57 PM..
Reply With Quote
  #6  
Old 10-12-2012, 02:00 AM
seventh's Avatar
seventh seventh is offline
Member
iPhone 4, iOS 5.x
 
Join Date: May 2009
Location: Tampere, Finland
Posts: 35
Default

Quote:
Originally Posted by antireality View Post
Generally a constant framerate is more important than a higher one - a solid 30fps will look smoother than hitting 60 most of the time and stuttering occasionally.
...
I have to agree. For our first game (Shardlands), we capped the framerate to 30 for all devices. Games where framerate varies between 30 and 60 don't feel right to me. We plan on making our next game solid 60fps on newer devices (iPhone 4S, iPad 2 and up), which requires some changes to our visual style.

About using fragment shaders on the low performance-per-pixel devices (iPhone 4, iPod touch 4G and iPad 1), I'd definitely write my own instead of using the fixed pipeline. Your own implementation can't be slower than the generic fixed pipeline approach, if you know what you're doing. Plus you have more room to play with and even add effects that are not possible with the fixed pipeline. Of course, if your shader just passes a single texture color to output, it shouldn't matter if you're using a shader or not.
Reply With Quote
  #7  
Old 10-12-2012, 02:05 AM
jlauener jlauener is offline
Member
 
Join Date: Jul 2011
Posts: 42
Default

Quote:
Originally Posted by bluescrn View Post
Both games use variable timesteps, so they can handle more varied framerates if needed (e.g. on PC or Android), and if the timestep gets much bigger than 1/60th of a second, I start to do two or more updates per render, to avoid an update with a large timestep, which could potentially start to cause collision/physics bugs.
That's the semi-fixed timestamp approach described in the article linked by Mark right?

Fixing the FPS to 30 is a neat idea, will try that just to see if I feel a difference.

Quote:
Originally Posted by antireality
I'd have thought that shaders would be fine on an iphone 4 if written carefully and following IMGs guidelines - after all, fixed-function is pretty much just a pre-rolled shader anyway these days...
In fact with OpenGL ES 2.0 you always use vertex and fragment shader as there is no 'default function'. So full screen fragment shader is completly feasible but if kept very simple though.

http://developer.apple.com/library/i...008793-CH7-SW3

In Apple's guideline they say to avoid dynamic texture lookups which might be the main reason why a blur shader performs so poorly. Indeed each pixel requires 18 dynamic lookups (9 vertical, 9 horizontal)!
Reply With Quote
  #8  
Old 10-12-2012, 02:39 AM
seventh's Avatar
seventh seventh is offline
Member
iPhone 4, iOS 5.x
 
Join Date: May 2009
Location: Tampere, Finland
Posts: 35
Default

Quote:
Originally Posted by jlauener View Post
In Apple's guideline they say to avoid dynamic texture lookups which might be the main reason why a blur shader performs so poorly. Indeed each pixel requires 18 dynamic lookups (9 vertical, 9 horizontal)!
I'd think 18 texture lookups per pixel is pretty overkill for any current iOS device If you are willing to give up some visual quality or make the blur filter smaller, you can calculate up to 8 texture coordinates in the vertex shader, pass them as separate varying parameters and this way avoid the dependent texture reads.
Reply With Quote
  #9  
Old 10-12-2012, 02:43 AM
Connector Connector is offline
In Time-Out
iPad (4th Gen), iOS 7.x
 
Join Date: May 2012
Location: In the Chatroom
Posts: 14,835
Default

Why does everyone mention 60 fps as an upper limit? Can you go higher than this framerate?
Reply With Quote
  #10  
Old 10-12-2012, 02:46 AM
seventh's Avatar
seventh seventh is offline
Member
iPhone 4, iOS 5.x
 
Join Date: May 2009
Location: Tampere, Finland
Posts: 35
Default

Quote:
Originally Posted by Connector View Post
Why does everyone mention 60 fps as an upper limit? Can you go higher than this framerate?
Nope, Apple has fixed the screen refresh rate to 60Hz for all devices.
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 2012, TouchArcade.com, LLC.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Copyright 2008 - 2011, TouchArcade.com. Privacy Policy / DMCA Copyright Agent