Frame rate (also known as Frames Per Second or (FPS) is one of the best metrics you can capture to quantify the visual fluidity of a game. In most scenarios, the higher the frame rate, the better the experience for the gamer. In this blog, we will look at the definition of FPS and the best methods to retrieve frame rates for games on both Android and iOS.
Please note that this blog is intended for fresh gaming fans or anyone who wants to know some of the basic metrics to quantify game performance.
In simple terms, FPS is the number of frames rendered by the game in one second. When this value is plotted over the duration of game-play, this can reveal interesting insights into the fluidity of the game. There are some caveats with using just FPS as a sole yardstick for performance, but I will reserve that topic for the next blog. In many cases, FPS values are enough to get the gist of animation fluidity, so we will focus on that.
You've probably heard of the vaunted “60fps” target, as it's repeated many times across the mobile gaming world (not to mention in PC and console gaming too). But why is 60 the magic number? This is because most mobile devices that ship today have displays that refresh at 60Hz (there are some with 90Hz or 120Hz displays, but we will ignore them for now). This means that the displays are capable of showing 60 new frames a second (60 Hertz). Breaking this down a bit more, the display hardware can update a frame once every 16 milliseconds (this 16ms number is obtained because the display can show 60 frames in 1 second or 1000ms, so the time between two refreshes is 1000/60 ~ 16.6ms). This is sometimes called the Vsync pulse rate. You get one pulse every 16ms to refresh the display.
Ideally, a game should aim to render 60 frames in one second to provide the best experience for users. But you can also choose to send a new frame to the display once every 32ms. You may ask why? If the game is complex and requires more CPU/GPU processing you might want to allow additional time for that. If we take 32ms for every frame (instead of 16ms), our frame rate comes down to 30 instead of 60.
It's worth bearing in mind that 30fps (and other sub-60 frame rates) can be perfectly sufficient for an average gamer playing certain types of the game -- it really depends on the genre and the gamer's expectations. (There are some more insights in this blog.)
There is often a good argument to render at a lower frame rate. This is especially relevant for mobile devices with a battery. Drawing 60 frames a second makes for great visuals but also means you use more of the computing power in your device and hence more battery.
As a result, if a game doesn’t demand 60 FPS, then it's probably better to keep more users happy with better battery life. Alternatively, a developer can allow a game to run at 30fps during static moments and then switch to 60fps whenever there's a user interaction or animation. In a future blog, we will talk about how you can measure the impact of your game on the battery.
In this section, we will talk about the various ways in which you can measure FPS in both Android and iOS.
Measuring FPS in Android is hard out of the box unless you're a developer who can instrument a game (i.e. add code) to capture and display FPS. That said, there are some developer-grade tools that all you to get frame stats. Click here for more information provided by Android's own Developer Wiki. .
By far, the simplest and easiest way to measure FPS on Android is to use the GameBench Android or Desktop App. GameBench takes care of querying the correct OS services and returns the FPS value. The FPS metrics returned by GameBench have been validated by a number of our partners including Google and phone manufacturers. So you can be rest assured to get accurate values with minimal setup.
Measuring FPS in iOS is slightly easier with the instruments provided in the Xcode tool suite. This still assumes that you are a developer with access to the source code and you are set up with Xcode on a Mac OSX machine.
If you would like a simpler and much easier option to get FPS from an iOS Device, even from a production build of a game (without being a developer), then you can use the GameBench Desktop App. You can sign up for a trial to try out GameBench tools. For instructions on using the GameBench Desktop App look at this video. GameBench tools use the same frameworks as the Core Animation instrument to retrieve the FPS values so you can be assured about the accuracy of the values reported in the tool.
In the next blog, we will cover some of the metrics we use at GameBench to quickly capture the performance of a gaming session and how we can improve our ability to spot performance issues by using frame-times.