How to cap FPS/make game run at a constant speed?

  • Hi all!

    I'm new to Construct and I've been struggling with something for quite some time now.

    In my current (and first) project, I have a player moving around using WASD. The player walks around on a grid of 16x16 pixels. Pretty simple and works fine.

    The thing that bothers me is this:

    I have two screens. When I run my project, on one screen the FPS sets to 120 FPS and goes to 60 FPS when I start walking around. The walking speed of the player looks pretty good at 60 FPS.

    When I move the browser to the other screen however, the game's FPS is a constant 120 FPS, which makes the player moves twice as fast, which is way too fast.

    The thing I'm trying to accomplish is to get a constant speed, no matter on what screen I run it, say 30 or 60 FPS all the time. I've looked around to find an answer, but I've been unsuccesful in achieving what I want. I've been experimenting with DeltaTime (dt) but I'm not quite sure how to use it correctly or if this is the answer to my question.

    So basically where it comes down to, I think, is; Is there a way to set your game speed to a constant speed for all screens?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See the tutorial on delta-time and framerate independence. It covers this exact problem.

    Note the built-in behaviors automatically handle varying framerates so you don't need to use dt with them.

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