• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Get users screen refresh rate

F

FeNniX

Guest
Hey! I am using physics engine. Decided to implement vsync. One problem arose. Vsync locks refresh rate of game, and because I am using physics engine, it's not possible to use delta time. In the end if I enable vsync and room speed doesn't match screen refresh rate, game slows (or goes faster). So is there any way to determine monitor refresh rate so I could match room_speed with it? Thanks.
 

kupo15

Member
Hey! I am using physics engine. Decided to implement vsync. One problem arose. Vsync locks refresh rate of game, and because I am using physics engine, it's not possible to use delta time. In the end if I enable vsync and room speed doesn't match screen refresh rate, game slows (or goes faster). So is there any way to determine monitor refresh rate so I could match room_speed with it? Thanks.
I don't understand why you want to do that or what you think you will achieve by that. Dynamically matching up the room speed to the persons monitor is the same thing as using vsync to lock the frame rate or provides the fluctuations you described. If your game is built at 60fps and they have a 30hz refresh rate and you change the room speed to be 30, the game will run half as fast as what you intended it would which won't solve the problem.

The only thing you could do is develop the game with a room speed of 30 and not use vsync. This way the crappy monitors can run it fine and any monitor with a higher refresh rate will be throttled down to 30 to achieve the same experience. Depending on the game this would work or not work. Fast paced action games this is a bad approach but if your game is slow paced enough where you can have half as much input response as what's standard and it feels fine then go for it. It all depends what you are trying to do and go for with your game. You would need to elaborate on that more
 
Last edited:
F

FeNniX

Guest
I don't understand why you want to do that or what you think you will achieve by that. Dynamically matching up the room speed to the persons monitor is the same thing as using vsync to lock the frame rate or provides the fluctuations you described. If your game is built at 60fps and they have a 30hz refresh rate and you change the room speed to be 30, the game will run half as fast as what you intended it would which won't solve the problem.

The only thing you could do is develop the game with a room speed of 30 and not use vsync. This way the crappy monitors can run it fine and any monitor with a higher refresh rate will be throttled down to 30 to achieve the same experience. Depending on the game this would work or not work. Fast paced action games this is a bad approach but if your game is slow paced enough where you can have half as much input response as what's standard and it feels fine then go for it. It all depends what you are trying to do and go for with your game. You would need to elaborate on that more
The reason I want vsync in my game to stop screen tearing. It looks really ugly sometimes. But vsync slows down game. For example if room_speed is 120 but refresh rate is 60hrz game will run in slow motion (twice as slow 60/120). So I want to match room_speed with monitor's refresh rate to eliminate slowness it causes
 

kupo15

Member
The reason I want vsync in my game to stop screen tearing. It looks really ugly sometimes. But vsync slows down game. For example if room_speed is 120 but refresh rate is 60hrz game will run in slow motion (twice as slow 60/120). So I want to match room_speed with monitor's refresh rate to eliminate slowness it causes
What room speed are you developing at and what kind of game is it? Why not just develop at 60 and throw vsync on? I doubt there are any monitors less than 60hz
 
F

FeNniX

Guest
What room speed are you developing at and what kind of game is it? Why not just develop at 60 and throw vsync on? I doubt there are any monitors less than 60hz
I also don't think monitors less than 60hz exist nowadays. Game I am working on depends on input a lot, something like platformer. I have 60hz screen and won't benefit from more fps that much but I think there are lot of people who have 120 or 144hz. higher fps also means less input lag. I think I should sacrifice something.
 

kupo15

Member
I also don't think monitors less than 60hz exist nowadays. Game I am working on depends on input a lot, something like platformer. I have 60hz screen and won't benefit from more fps that much but I think there are lot of people who have 120 or 144hz. higher fps also means less input lag. I think I should sacrifice something.
Ok, well I think sticking with 60 fps is the way to go, but if you really want to change the game speed maybe just provide a setting for 60, 120 and 144 and use game_set_speed for it. Not sure if that'll do what you want
 
F

FeNniX

Guest
Ok, well I think sticking with 60 fps is the way to go, but if you really want to change the game speed maybe just provide a setting for 60, 120 and 144 and use game_set_speed for it. Not sure if that'll do what you want
That's what I was going to do but then I found this. One awesome person wrote small free dll file specifically for gamemaker to get some basic screen information, including current monitor refresh rate. So my problem is solved.
 

Bruchpilot

Member
I also don't think monitors less than 60hz exist nowadays.
Some people run a 4K/UHD screen on a setup and/or connection that is unsuitable for it, resulting in a framerate capped at 30Hz. Just mentioning it, because I recently ran into that in a support call with a customer.
 
Top