I'm implem开发者_运维百科enting a game loop with constant FPS. I'm thinking about 25-30 FPS should be enough. Any ideas from your own experience? Should I even restrict FPS at all?
30 to 40 fps is usually good for a fast paced game. Depending on the game and how heavy it is, the platform might not be able to always keep up. It is therefore better to assume that the game can't follow the fps accurately. Instead keep a timer that checks the system clock each frame and figures how much time has elapsed. This way you can calculate the increments to for example physics (an object falling) correctly, even if the game is running at a lower fps.
A good start for game loop : http://wiki.igda.org/Programming_and_Technology/Game_Programming_Patterns_for_Beginners/Game_Loop
There's another treatment of the topic here:
http://dewitters.koonsolo.com/gameloop.html
I notice the other answers address that a game loop should be implemented, in the sense that you should always render your graphics/updates with respect to time offset in milliseconds rather than 'frames', which is true.
I found this page in an attempt to see if there were recommendations on ideal Adnroid framerates, but after Googling around, I'm not finding any facts about optimal FPS usage. Not to say there aren't some 'magic' numbers which are ideal for certain Android chipsets or anything like that. It's just that if there are, it's not a very significant enough point to be well known I suppose.
That said, I'll share my thoughts on ideal Android framerate after not finding any hard and fast answers, for anyone else wondering the same thing I did:
The ideal framerate is as small as possible without compromising user experience. The reason is that the more frames that are rendered per second, the more CPU cycles are used, the more battery is consumed. Certain games (e.g. Chess) don't have as much going on as a fast paced 'endless runner' game for example.
Starting from a low number and increasing the framerate until the user experience feels good is probably a good indicator. It's something one should be able to adjust right near the end of app development prior to release.
精彩评论