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

[SOLVED] Adjusting room/game speed relative to lag in real FPS

S

Sam (Deleted User)

Guest
Hello community.

I was wondering what is the best method to "hide" or "mask" the fact my game lags.

To give more background, my Android game runs on my phone like a dream, in both the gameplay and the title screen.

But on the OUYA/ForgeTV it lags a bit on the title screen, as there are large elements animating on the screen. The gameplay on the otherhand, runs smoothly, like on my phone.

So I was wondering, what is the best, hopefully "least choppy" method for detecting lag, in the room/game speed, relative to real frames per second?

Like for example, if the room/game speed is set to 30, but the real frames per second is more like 15 or 20, raise the room/game speed by the difference.

So if it is 30, but real FPS is 15, than change room/game speed to 45 by increasing it 30-15. Make sense?

Is that what I should do, or are there better methods? Again I'd like it to look as smooth as possible so that it looks the same across all platforms and devices.

Thanks in advance.
Samuel
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Make sense?
Not particularly - if the game doesn't run at the desired framerate, chances are that this is because of game code taking too long to compute (therefore not fitting into allowed 33ms at 30FPS, for example). Increasing the framerate will not fix the issue, as it will not make the code take less time to process.

Given that it's only title screen that lags in your case, I would suggest to try running the game in debug mode (and using the profiler) to narrow down what in particular causes the game to take more than it should.

Edit: In current versions of GM:S there's also a "sleep margin" option in Android tab that affects performance on some devices. Tweaking it (e.g. setting to 16 instead of default 4) can sometimes help.
 
S

Sam (Deleted User)

Guest
In current versions of GM:S there's also a "sleep margin" option in Android tab that affects performance on some devices. Tweaking it (e.g. setting to 16 instead of default 4) can sometimes help.
Thanks for that, that'll be the next thing I'll try, and if that doesn't help, I'll try debugging it out and see how that goes.

I'll report my results here in a few.
 

TheouAegis

Member
I don't see why it would be related because the wake is on the title screen and not where I would expect it to be, butt do you have vsync on? It is known to make most things run at your normal monitor refresh rate, but also at times actually run at half the monitor's refresh rate. So if you have this thing turned on, try turning it off, at least on the title screen. Personally I think vsync should be an option for the player to toggle, not something you hard-code into all your projects.
 
S

Sam (Deleted User)

Guest
In current versions of GM:S there's also a "sleep margin" option in Android tab that affects performance on some devices. Tweaking it (e.g. setting to 16 instead of default 4) can sometimes help.
Hey @YellowAfterlife this helped some, enough to have a noticeable improvement. But it's still a tiny bit slower on OUYA/ForgeTV than on my phone, would it help if I raised the sleep margin to 32? Or would that cause some kind of problem (or crash)? I ask because in the global game setting for sleep margin they put beside it "(advanced)" and I'm not sure why that's there. Thanks for the help.

@Lonewolff I don't know how to use delta_time but if I need to I'll try it out. Thanks for the suggestion.

@TheouAegis I don't know what you mean by vsync, so I my guess is that I'm not using that. Thanks for the response.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Or would that cause some kind of problem (or crash)? I ask because in the global game setting for sleep margin they put beside it "(advanced)" and I'm not sure why that's there. Thanks for the help.
Sleep margin determines how long the application needs to wait for before it switches to system-specific sleep-function instead of just using a while-loop until time comes. Lower sleep margin means smaller battery consumption, but devices can be variously inaccurate with how they interpret sleeping, therefore it can result in framerate loss.
 
S

Sam (Deleted User)

Guest
Well for whatever reason my game after a certain update started running at full speed at the title screen so problem solved.
 
Top