Limit Refresh Rate? (Solved)

0 favourites
From the Asset Store
Solve the mathematical equations as fast as you can!
  • Is there anyway to limit the refresh rate within a Construct 3 Game? I was just making a video of a game I made a couple months back, and events in the game were bugging out. After a while of tweaking different things within the game, I realized it must be something else causing the issues.

    The only other thing I could think of, was that a few weeks ago I upped the refresh rate on both of my displays to their full 185hz potential in the Windows Display Settings. They had been set to 60hz previously. So I went back in there, and changed them back to 60hz. Now everything is running fine within the game.

    With the displays set to 185hz, the player & enemy movements all felt exactly the same. But the enemies were glitching through invisible objects(tried widening these to no luck), that reverse their movement and image direction. I figure with the higher refresh rate, the event must be running multiple times, and allowing the enemies through the object. I tried running the event under "Trigger Once While True", and still glitches out with the displays at 185hz.

    I'm getting ready to submit a mobile game to the Play Store, and while testing the game on my Galaxy s21, I noticed everything is running much faster. Due to the phone's display running at a 120hz refresh rate.

    So. Is there anyway to cap the refresh rate of a project to 60hz? I've looked through the Project Settings, and the Construct 3 documentation. But, I'm failing to find anything that would allow this. Any help is appreciated.

    Thank You :)

  • Would multiplying everything by Delta Time do the trick?

  • I don't think there is a way to limit the refresh rate afaik.

    However, if you properly used dt everywhere you're supposed to it should not matter. If you're having situations where a high refresh rate is affecting your gameplay, low framerate on a low end device would presumably also result in problems.

    Triggers should still work properly. Collisions for fast moving objects normally have more issues with lower framerates when more pixels are skipped, but that should not be an issue with stepping enabled.

    Note that you don't want to use dt with behaviors. Behaviors (except physics) already use dt, so if you use dt expressions to control behaviors, you'll actually make them framerate dependent again.

  • I don't think there is a way to limit the refresh rate afaik.

    However, if you properly used dt everywhere you're supposed to it should not matter. If you're having situations where a high refresh rate is affecting your gameplay, low framerate on a low end device would presumably also result in problems.

    Triggers should still work properly. Collisions for fast moving objects normally have more issues with lower framerates when more pixels are skipped, but that should not be an issue with stepping enabled.

    Note that you don't want to use dt with behaviors. Behaviors (except physics) already use dt, so if you use dt expressions to control behaviors, you'll actually make them framerate dependent again.

    Interesting. Good to know. I'm having the issue an enemy using the platform behavior. Moving right through an object that alters one instance variable(checking the direction), which then changes the direction, and whether the image is mirrored or not.

    Works fine at 60hz. They move through them pretty often at 185hz. I have not tested it at lower refresh rates though.

    EDIT: The game with the glitching enemy works fine at 120hz. Speeds seem fine, and everything works as it should. That collision just seems to wonk out at 185hz.

    The other game I have just about ready for release, is a never ending vertical scrolling shmup for the Android Play Store. I could make a version for 120hz phones, if needed, just by halving the speeds. I have all the background layers, enemies, and collectibles move a set speed down the screen each tick. I sort of enjoy it more at 120hz, as it's more challenging. I'll make a comment in the games description, and see what players want.

    Either way, thanks for responding to the thread oosyrag

  • Hmm that's a rough one to diagnose, as I don't really have a way to replicate it. Sorry!

  • For your Vertical SHMUP game if you want to keep it framerate independent replace your code that moves the background etc every tick and have it make use of the bullet (or other movement) behaviour. This way you can set the speed the same as what it would equate to with your current events at 60hz and it will remain that speed regardless of the refresh rate.

  • See the tutorial delta-time and framerate independence. If correctly designed, it should not matter what framerate the game runs at - the game will continue to run at a regular speed and work correctly.

    There are two ways you can check this is done correctly:

    1. Set the timescale to 0, and everything should stop. This is a good way to pause the game. If something keeps moving with a timescale of 0, it's not using dt.
    2. Set the framerate mode in project properties to unlimited. On a high-end machine this lets the game run at thousands of frames per second. It should still work the same.

    If anything, higher framerates should make the game more reliable, as it's less likely fast-moving objects will step over obstacles and fail to register a collision.

  • Thanks for all the suggestions, calminthenight, and Ashley. I'm going to take a look into this today. I'll test out the bullet behavior, and see how that works for the SHMUP.

    I'll read through the tutorial linked to as well. The strange thing is, Ashley. Everything seems reliable at 60hz, and 120hz. Once I step up into 185hz, is when things start getting wonky. I have not tested all the frame rates in between, but it might be an interesting test to see how things respond. That game with the enemy glitching through a collision at 185hz is a platformer, and is using entirely built in behaviors.

    Yesterday I tested setting the framerate mode to unlimited, and it yielded the same results with my display running at 185hz.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It probably just means you're not using delta-time correctly. You can take the stock games in Construct like Kiwi Story and run them in unlimited framerate mode, and they work exactly the same. Here Kiwi Story can run at 2500FPS+ and it's pretty much indistinguishable from 60 FPS.

  • It probably just means you're not using delta-time correctly. You can take the stock games in Construct like Kiwi Story and run them in unlimited framerate mode, and they work exactly the same. Here Kiwi Story can run at 2500FPS+ and it's pretty much indistinguishable from 60 FPS.

    Thanks again for sharing your knowledge. I was reading articles about Delta Time Last night. Now I'm reading through the one you linked to here on the Scirra site right at this moment. I'm going to work with both of those two games today. I'll see about implementing Delta Time correctly, and see what the end result is.

    I figured if an object is using platform behavior it should take dt into consideration, and move at the same speed independent of a displays refresh rate(like the article says). Everything moves at the same speeds, except for that collision glitch. That enemy glitching through a collision object, is just using simulate move left/right, etc, with a simple switch direction block. Then at 185hz, I can watch it quickly flip direction twice, and move through the object.

    I'll double check, and make sure all my image points are proper as well. All movement speeds are the same to my eye anyway. Just that pesky collision with a boundary object to flip direction. It's not critical to have it work at 185hz. But, now I am just curious to figure it out.

  • Does it happen if you don't mirror the sprite?

  • Does it happen if you don't mirror the sprite?

    I'm watching it run right now, with the "Set Mirror" blocks disabled, and it seems to be working fine at 185hz. I played with it a couple times, setting it back and forth. Once I mirror the sprite, is when it moves through the boundary object it collides with. Origin Point is completely centered, and bounding box has completely flat lines, and sides(I've had issues with those things in the past, and learned from my mistakes back then).

  • Apologies for the double post. I may have that enemy collision glitch at 185hz worked out. I noticed the Origin Point was not a whole number. Would that for some reason cause an issue? Still reading through the article on DT.

    All I did was widen the collision box by one pixel(double checked on every frame, as "Apply to All Animations" missed it on a collision point or two by a smidge(off by .03-.2 pixels), so I could set the Origin Point centered within the collision box using a whole number, now "60", rather than "59.5".

    I set the blocks in the Event Sheet for mirroring on the boundary object as enabled. And now the enemy is reversing direction, and flipping the sprite as intended. I'm going to get some fuel to my brain, and finish up this Delta Time article. Thanks for all of the assistance, everyone!

    Everyday, I learn something new. I love to learn, so it's all fun to me haha.

    EDIT: Or perhaps it was one of the collision points being barely off by a fraction of a pixel, and I didn't realize it, until I manually checked each one. Either way, it's working now. Been sitting here, reading, and watching this guy bounce back and forth for a while now.

  • When you mirror a sprite, there is a possibility the collision box will shift, as is the case when the origin is not centered. This can potentially cause trigger once to reset as it is no longer colliding.

    The reason it happened in this situation is because the higher frame rate allowed for smaller steps, where your sprite just collided by a fraction of a pixel and it gets mirrored, thus exiting the collision state. Lower framerates would result in the collision being more than a pixel overlap, so even when mirroring it didn't matter as your origin was only off by a fraction of a pixel.

    Common practice for platformers is to use a rectangular invisible helper sprite as your base object for collision purposes, and pin the visible texture/sprite to it. This helps to minimize many potential collision issues.

  • Common practice for platformers is to use a rectangular invisible helper sprite as your base object for collision purposes, and pin the visible texture/sprite to it. This helps to minimize many potential collision issues.

    Great to know oosyrag. Thanks for sharing your knowledge :). That makes sense now that I sit and think about it. This is a game I made a few months back, and was just trying to grab video footage of it for something, when I noticed the glitch.

    Just like you said at the end. My current projects I use a square base sprite, with another sprite objects with all the animations pinned to that base sprite for that player/enemy/whatever. So all my current projects, it hasn't been an issue. Definitely good design practice!

    I'm learning a ton. Love this community. Thanks again everyone, for taking the time to explain this to me. I really appreciate it.

    EDIT: The Vertical Scrolling SHMUP was an even easier fix. I had everything that moves down the screen under an "Every Tick". I just had to change that to "Every 0.016 seconds" to simulate the same speed at any refresh rate. Now I can just tweak the seconds value, to adjust the speed to where it won't be too easy or too difficult.

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