JS call to return current framerate?

I'd like to be able to know what the current framerate is as it's sadly going to be the only method I can find that will allow me to set correct wait timers on any device not running at 60FPS.
What are you gonna do with those wait timers? Do you need something to happen after X frames or X seconds?
i dont quite understand but if u r looking for the button that shows the fps it's F2
i dont quite understand but if u r looking for the button that shows the fps it's F2



Running it on an iPad in this case.

What are you gonna do with those wait timers? Do you need something to happen after X frames or X seconds?



Either one would work, but the problem is that both of these values are inaccurate on some mobile hardware.


I need to wait for a 13 second audio file to finish before moving onto the next event, and even though I have an plugin that will do that (and works fine on a PC) it adds another 8 seconds of wait time when running on an iPad. I assume this is because the plugin is calculating the length of the sound clip and converting it into frames behind the scenes.


The problem is that RMMV doesn't seem to internally acknowledge when it's running below 60 FPS, meaning that while it takes 240 frames for 4 seconds to pass on a PC, it takes roughly 40% longer for it to do so on certain mobile devices.


If I could know the current framerate, I could have events determine the # of frames to wait dynamically.


It's far from ideal, but it's probably the only way I'd be able to create an executable that will function in the same manner across different types of iOS hardware of different power levels.
If you just need to execute something in exactly 13 seconds, you can do it like this:


First, create a common event with the stuff you want to execute after the audio file is over. Then, immediatelly after playing the audio file, add the following script call:


setTimeout(function(){$gameTemp.reserveCommonEvent(COMMON_EVENT_ID);}, 13000);


Make sure to replace COMMON_EVENT_ID by the number of the common event you created.


This will cause the common event to run after 13 seconds. Also make sure to preload the audio file with a preload manager, so that it doesn't take too long to start playing.


You can also tweak the wait time (13000) to match the exact length of the audio file if you need to.


This is also not 100% guaranteed, but it's the best you'll get. Calculating the current FPS wouldn't work because FPS isn't stable.
I tried it and no such luck: whatever slowdown the engine is experiencing on the iPad2 is literally slowing the engine's ability to accurately know how much time has passed.


Thanks for trying, though. I appreciate it. 🙂
Calculating the current FPS wouldn't work because FPS isn't stable.



Is there a means of returning the FPS at that moment anyway?


Even that would be a tremendous help...


EDIT: Never mind, Hudell got it for me. 🙂
Code:
Graphics._fpsMeter.fps
Graphics._fpsMeter.fps



PERFECT!


All I have to do now is wait until the game has fully loaded everything, take a sample of the "resting" framerate, and I have a pretty solid idea of what kind of hardware the game is running on.


This should hopefully solve an age old problem for me... 😀

Original thread: https://forums.rpgmakerweb.com/threads/js-call-to-return-current-framerate.72818/