Max FPS - Is it possible?

0 favourites
From the Asset Store
Support AdType ( AppOpenAd, Banner Ad, Interstitial Ad Rewarded Ad, MREC Ad) support c3 build service
  • Unfortunately accurately scheduling frames at half or quarter V-sync rate (e.g. 30 FPS on a 60 Hz display) isn't currently possible in browsers. This Chrome issue could address that - it's pretty old but some more people starring the issue will show support for it.

    Setting a maximum framerate and ignoring V-sync is something that could be done differently for different reasons. However JavaScript timers are pretty restricted these days so even that isn't as straightforward as it sounds - for example Chrome is moving to a model where all JavaScript timers run at 8ms intervals, in order to save battery. So the fastest you can go with timers in that case would be 125 FPS. It's not much more than a 120 Hz display, and is in fact less than some high-end gaming displays. So that doesn't sound like it would help much.

    Besides, do many people complain about input latency for Construct games? I've seen more mentions of smoothness, which would be to do with v-sync, and could be made worse by using timers instead. Construct already uses things like high-frequency raw pointer events in Chrome for low latency mouse/touch input. Either way though, we're pretty limited by what browsers provide at the moment, which is the main limitation (and I would emphasise, that is absolutely nothing to do with Construct Animate).

  • So what other reasons are there for a fixed framerate? Perhaps there are some, but I don't see "achieving perfect smoothness" as one of them.

    Collision checking changes considerably at a rate higher than 60fps. This has already made me face situations where the character makes a "higher" jump in a very specific situation, which depended on the collision check with an object.

    Despite that, at the moment I'm experiencing big problems in the physics behavior where the maximum FPS limit would be of great help. The framerate independent mode changes the strength of the object according to the processing, while the fixed mode, despite its equal path, changes its speed. Object speed can get very fast at high framerates.

  • The collision checks problem is a great point, I agree!

    This is likely bottom of the consideration list, having control over FPS would be a great design tool. Certain games/genres/styles feel more appropriate at 30 FPS (retro games for example).

  • For me it is also the physics. While it is mostly fine, in more complicated scenarios (multiple joints, constant forces like wind) it is hard to ensure that everything works (especially if the contraptions are more complicated). Often, it can be ensured that the target devices are able to do 60fps, but fixed mode is still not an option, because 90hz/120hz devices exist. In these cases it would be awesome to ensure that the maximum is 60fps.

  • I also have no idea what this has to do with Construct Animate or why anyone even mentioned that.

    and I would emphasise, that is absolutely nothing to do with Construct Animate

    Since you are curious:

    From past discussions, it has already been pointed out (by others) that whenever someone complains about something and it goes on for a while, at the end of a long discussion you always end up saying you have a small team and it is not feasible to implement. However, you were still able to create an ambitious project like Animate that no one ever suggested.

    Just a suggestion, no need to get defensive. I didn't say the technicalities involve Animate, I said the potential workload is probably better risked here where your majority of users reside, compared to a future sighted project like Animate.

    This feature already exists in other free HTML5 game engines like Phaser and GDevelop.

  • Nothing in this thread relates to workload. It's about technical complications I mentioned. I could do this very quickly if the necessary browser technology was in place. So I don't see how that has anything to do with this thread whatsoever. I would in fact point to the parts of the Forum & Community guidelines around unnecessarily bringing up controversial topics.

    Further, Construct Animate is an effort to grow the company, get more users, increase sales, hire more developers and advance Construct even further. If it goes well, it could significantly increase our ability to develop Construct. But some people seem to resist the idea anyway, even though they are asking us to do more. I guess you can't please everyone.

  • It is understandable that this is a technical limitation in browsers at the moment.

    The only final curiosity I have, is, if GDevelop and I guess Phaser can have max FPS, then is there something underlying that disallows C3 to have the same feature?

    Would it be correct to say that these products achieve a max FPS cap in a "hacky" way, rather than a more stable way due to browsers not having this?

    I wonder if there are ANY cons to having a max FPS cap implementation similar to GDevelop or Phaser.

    Beyond this, I think there's not much else to discuss about this topic until browsers allow this.

  • Browser makers are emphatic that game-like content should be v-synced (i.e. scheduled with requestAnimationFrame). They are clear that normal JavaScript timers are not suitable for scheduling rendering and preferably shouldn't be used for that. So on this basis alone I think using JavaScript timers counts as hacky.

    It looks like Chrome 107 just shipped 8ms aligned timers, which could have broken existing uses of fixed FPS. It would be interesting to know if Gdevelop/Phaser still work with that implemented.

    Further if you can only rely on JS timers running every 8ms, then you can only achieve a regular 62.5 FPS, which doesn't match common display refresh rates. So I'm not sure how this could be implemented without causing some degree of jank. And then browser makers may well further tighten timer restrictions in future breaking any content trying to use timers for rendering, which they are reserving the right to by saying rendering content shouldn't be done on timers. So it seems like maintenance could be difficult too.

    I don't think a fixed framerate is a magic bullet that will solve everyone's cases, although it might throw in an extra tool to the toolbox if you want to make a tradeoff like accepting janky display for a more predictable physics simulation. But even a fixed FPS isn't guaranteed - if the system can't keep up with the performance, then the FPS will drop anyway. So I still generally think the best approach is to put effort in to figuring out any problems that happen with v-sync and trying to fix it so v-sync works in more cases.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for the detailed explanation, very informative.

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