Limit Refresh Rate? (Solved)

0 favourites
From the Asset Store
Solve the mathematical equations as fast as you can!
  • 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.

    I would advise against doing that - very small times in 'Every X seconds' can still actually be framerate-dependent, as noted in the manual. For example if the game dips to 30 FPS on a slower machine, "Every 0.016 seconds" will actually be running every 0.033 seconds, and hence the game slows down in a framerate-dependent way. Also at higher framerates like 120 FPS, you'll have a janky appearance from moving things at a lower framerate than the game is actually rendering at.

    The correct solution is, as before, to use dt. There is probably some movement happening in "Every tick" that isn't using dt and ought to be using it.

  • > 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.

    I would advise against doing that - very small times in 'Every X seconds' can still actually be framerate-dependent, as noted in the manual. For example if the game dips to 30 FPS on a slower machine, "Every 0.016 seconds" will actually be running every 0.033 seconds, and hence the game slows down in a framerate-dependent way. Also at higher framerates like 120 FPS, you'll have a janky appearance from moving things at a lower framerate than the game is actually rendering at.

    The correct solution is, as before, to use dt. There is probably some movement happening in "Every tick" that isn't using dt and ought to be using it.

    Thanks for the heads up. I've been sick, and fighting something the past few days(all signs of Covid, but can't get a test anywhere...). Was laid up on the couch yesterday, just seeing your post tonight.

    Is there any simple way to check "dt" for an entire event? Or is it done in each action within the event? Everything I did the other day to move the objects based on delta time broke everything.

  • Anywhere you have a fixed number that runs every tick (that isn't a behavior), multiply that number times dt times your expected framerate (normally 60, but could be higher if you're used to working at 120 or 144 or whatever refresh rate your computer runs at.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your response, as always oosyrag. I really appreciate the support. I'm more concerned about people playing a commercial game on various mobile devices, and it not playing the same on every device. I'm still a bit confused on how accomplish incorporating delta time in all my Events, and Actions. This is what my Every Tick Group currently looks like: https://i.ibb.co/Fqt0XrW/everytick.png

    What I just tested, was changing it up to something like Set position to Enemy1.X, Enemy1.Y+900*dt for that first enemy, and it feels right about the speed I'd like it to be at. Does that seem like a proper way to go about it?

    EDIT & SIDE NOTE: So the "Every X seconds" condition is not ideal for times below 1 second, but should be okay to utilize for Events that run every 1 or more seconds? If not, I'm going to have to rethink this entire Event Sheet.

  • To be precise, like I said before, you would take all of the fixed values and multiply them with dt and your testing environment framerate.

    If enemy.y+7 feels right at your framerate and your framerate is 60, you would do enemy.y+(7*dt*60). If your framerate is 185 when testing, you would use enemy.y+(7*dt*185). It would then move the same distance/time across a screen at any framerate.

    Every x seconds is fine for anything as long as x is greater than the expected time of any given frame. I think it's safe to say anything over 0.1 would not cause any problems with framerate as long as you don't need absolute precision. If your ticks are taking longer than 0.1 seconds you've got other issues.

  • Thank you so much for all of your help and insight oosyrag, and thanks again for your knowledge Ashley, and calminthenight!

    I had tested the enemy.y+(7*dt*60) the other day, but it had broken everything. The problem was... I was missing the parenthesis around the "x*dt*60". I just tested it real quick at multiple refresh rates, and it works perfectly now.

    I really appreciate the deeper insight into "Every X Seconds" as well. I'm making a mental note of everything in this thread, for all my current and future projects. So I can design them properly for any refresh rate.

    With all of that I think this issue is now solved. I'll work on redoing my Event Sheet to take dt into account asap. For now, I'm off to get some rest.

    Thanks again everyone. All the help, and deeper knowledge is much appreciated :)

  • > 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.

    I would advise against doing that - very small times in 'Every X seconds' can still actually be framerate-dependent, as noted in the manual. For example if the game dips to 30 FPS on a slower machine, "Every 0.016 seconds" will actually be running every 0.033 seconds, and hence the game slows down in a framerate-dependent way. Also at higher framerates like 120 FPS, you'll have a janky appearance from moving things at a lower framerate than the game is actually rendering at.

    The correct solution is, as before, to use dt. There is probably some movement happening in "Every tick" that isn't using dt and ought to be using it.

    Sorry for the necroposting.

    If there are a lot of mathematical calculations in the events, then on 240 hertz monitors the game will simply increase the CPU calculations by 4 times? And then what happens in a game where the processor is 80% busy? Wouldn't it be more correct to use "Every 0.016" then?

    Movement is done through behaviors, but the game has a lot of isometric and perspective calculations.

    As I understand it, behaviors with dt and distance/collision checks with "Every 0.016" will not work correctly together?

  • Do not use "every" with small times. As I noted, it will actually be framerate-dependent and break in some circumstances.

    A display that runs at 240 Hz will usually have a powerful gaming-grade computer to drive it - after all there's no point having a 240 Hz display if your CPU can't keep up. So usually such devices are specced to be able to handle the extra workload. Even if not, you should guide your optimisations based on profiling measurements, not wild guesses about what the problem might be.

  • I test on different PCs, including a gaming 240 hertz, and the result changes. Apparently, it is necessary to underestimate the upper limit of CPU load. Thanks for the reply, it helped a lot!

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