Lock game to 60 fps?

0 favourites
  • 13 posts
From the Asset Store
Set of 60 cursors. All icons are of a high quality. A good choice for RPG game.
  • So I've made more tests with 144hz monitors, and it doesn't look good for my game. Most of the framerate independent event's movement use an expression similar to this "Self.Y + (5*(MonitorHz*dt))". I've made sure the monitorHz works, so in this instance it would report 144 and the dt be 0,006944. It should still all add up to 1, but it doesn't in practice. It's still obviously uses 60 as the reference, breaking my game. I'm wondering if there's any way to lock the game to 60? Some kind of vsync?

  • I think your maths is incorrect, which is probably the cause of you seeing what you're not expecting.

    For example, if you run the following event every tick:

    Object.Y = Object.Y + dt * 5

    Then, after one second, the Object will have moved down 5 pixels (which is, I think, what you want to happen in your example).

    In your equation, by multiplying dt by 1/dt (ie MonitorHz = 1/dt) then your movement becomes framerate dependent because the Object will move 5 pixels per tick.

  • Oh... Yeah I just realized how that's kinda silly... Works fine for everything sub 60 fps though. Didn't think this one through, at least I know what to do now. Thanks!

  • We've all been there! Glad it seems to work now.

  • Colludium Tinimations

    Sorry, my following question might sound stupid:

    Is it required to make these changes to each one of my movement based events, to get my games to work fine on high HZ monitors?

    I honestly thought that things like these would be handled by the engine itself and not by the user, if that's the case.

  • TheRealDannyyy All behaviours and scirra made tools works just fine (with maybe an exception of the wait x seconds action). It's just how I did my dt based movement that was off. How Colludium mentioned my formula was made to move an object a given distance per tick if the framerate was at peak. It didn't care wether it was 60 or 144 fps. I tweaked it though I still haven't made up my mind if every x seconds feels off or not. Haven't had the chance to make enough tests.

  • TheRealDannyyy All behaviours and scirra made tools works just fine (with maybe an exception of the wait x seconds action). It's just how I did my dt based movement that was off. How Colludium mentioned my formula was made to move an object a given distance per tick if the framerate was at peak. It didn't care wether it was 60 or 144 fps. I tweaked it though I still haven't made up my mind if every x seconds feels off or not. Haven't had the chance to make enough tests.

    Sorry this whole dt thing is very confusing to me. (Yes, I read the well written tutorial but it didn't help me that much. I wanted to state that, just in case.)

    So far I've only considered compensation of lower framerates by using the "Minimum Framerate" action, does this mean that I now also have to worry about higher framerates essentially, running the game faster than normal and breaking my games mechanics?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you don't incorporate dt into your code a faster framerate will make everything run faster, and a slower framerate will make anything run slower. That's only viable on a console release you'll know it's gonna run at an exact framerate.

    Stuff like this is the reason why Dark Souls was locked to 30fps on the PC release. The developers knew that parts of the game would potentially break if they raised it to 60. That's why they were probably intentionally leaving it to modders to fix it, at least then it would be their fault if anything broke.

  • System-> Set time scale(2.0)

    Text->Set Text(fps)

    You will notice now that your game will lock on 60 FPS

  • Is it required to make these changes to each one of my movement based events, to get my games to work fine on high HZ monitors?

    I honestly thought that things like these would be handled by the engine itself and not by the user, if that's the case.

    This depends on how your movement bases events work. If you're using Custom Movement, Physics or the Bullet behaviour then you probably don't need to change any of your events. However, if you are setting speed changes over a number of ticks then you will need to consider how many of those ticks will happen in a second (ie use dt) so that the player experiences the same effect on different monitors.

  • This depends on how your movement bases events work. If you're using Custom Movement, Physics or the Bullet behaviour then you probably don't need to change any of your events. However, if you are setting speed changes over a number of ticks then you will need to consider how many of those ticks will happen in a second (ie use dt) so that the player experiences the same effect on different monitors.

    Everything official, no 3rd party behaviors.

    I guess I only have to modify my "Wait For X seconds" actions with dt, if yes how would that look like?

  • Don't modify the Wait action, TheRealDannyyy, because it doesn't make an incremental transformation over time.

  • Don't modify the Wait action, TheRealDannyyy, because it doesn't make an incremental transformation over time.

    Alright I get it now, sorry for the mass of questions I just want to make sure that everything I do is correct.

    Thanks to you guys!

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