Maximum framerate?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
***** Top down explorer character game sprite *****
  • Is it possible to set a maximum fps, while still allowing for dynamic framerate? I've considered doing the following, but I fear that will have unintended consequences if/when the game taxes the device such that it would drop under the maximum:

    1. Set project default Framerate mode to V-Synced

    2. Watch FPS. If it climbs above 90 (averaged over a short period of time), set Framerate mode to Fixed, 90fps

    I'd like my game to appear to run smoothly, of course, but there is no reason it needs to hit 240hz on the latest high-performance mobile phones. In fact, I feel like most folks would appreciate the battery savings of keeping the framerate at a reasonable level, vs constantly targeting the maximum the device can handle.

    So I guess my question is, given the above, if I set it to Fixed at 90fps, and the game struggles to hit that target, will I notice slowdown and jankiness? (edit: upon reading the docs, it appears that YES I will notice slowdown and jank)

    And if the answer to the above is YES, (it is yes) would I be able to fix this by watching the FPS while in Fixed mode and if it dips below, let's say 80fps (averaged over a short period of time), switch back to V-Synced mode?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Generally I'm of the opinion that you shouldn't meddle with things like this: it's tricky to get right and can easily end up degrading the user experience. I'd advise to just leave it on v-synced mode. Also arguably if someone bought a phone with a 240 Hz display, they may intend for their content to render that fast, and be annoyed if it doesn't for some reason. The manufacturer may well have added extra battery life or power management features to compensate. I've also seen some phones only support the higher refresh rate on an opt-in basis, or they only use the max for smooth scrolling in menus and everything else defaults to a lower rate like 120 Hz.

    You could make the refresh rate a setting in your game so the user just chooses what they want. If you really want an adaptive mode, I don't think it's possible to use v-sync mode at less than v-sync rate. (We experimented with a half-vsync rate in the past, but browsers expect v-sync rate rendering to render every frame, and if you don't do that then it ends up with horrible scheduling in GPU-bottlenecked games as it confuses the GPU scheduler.) So I think what you've outlined already is a reasonable approach, except I'd set as strict a threshold as possible to try to avoid false positives. For example set it to detect a period of 10 seconds with a framerate continually over 110 FPS, and if so set fixed at 90 FPS. Then you more clearly target 120Hz+ devices without potentially having 90Hz devices dropping v-sync mode for no reason.

    Then be aware that fixed framerate mode is not aligned to the display refresh rate so it could still look janky or inconsistent - in particular a 120Hz device rendering at 90 FPS doesn't have a regular way to schedule frames, because 90 does not divide evenly in to 120. It might look better if you dropped to 60, but then that has the same problem for a 90Hz or 144Hz display. It's difficult to establish the actual hardware refresh rate to drop to a half-rate, especially because you don't know if the hardware can actually hit the full display refresh rate - it might be too slow. Hence how this kind of thing is tricky to get right and may make things worse. Maybe a better threshold is to detect a sustained framerate over 150 and drop it to 120 FPS fixed, on the basis that anything running that fast probably won't have any easily visible jankiness anyway.

  • Thanks for the detailed answer Ashley!

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)