RPG Maker MV

RPG Maker MV

ocean pollen Oct 24, 2015 @ 9:07am
FPSLimit.js
A fellow in the RPG Maker MV discussion group has a 144Hz monitor and isn't able to test his games because he zips around like crazy, the refresh is all off. This is the case of normal games and uploaded games as well, on his monitor. This plugin resolved the issue for him. You can test it youself on a normal monitor by changing the FPS to 15 or 5 or like.

BTW, to quickly and temporarily change plugin variables of an uploaded game, just edit the js/plugins.js file.

Also, note that caching might prevent you from seeing updates to games. He had to clear his cache to see the FPS-limited version of my test game.

//============================================================================= // FPSLimit.js //============================================================================= /*: * @plugindesc Limits game refresh rate * @author ocean pollen * * @param FPS Limit * @desc For a 20FPS limit, set this to 20, etc. * Default: 60 * @default 60 * * @help This plugin does not provide plugin commands. */ ;(function() { var desiredFPS = Number(PluginManager.parameters('FPSLimit')['FPS Limit']), frameLimit = 1000/desiredFPS, nextUpdate = 0, timeout = null SceneManager.requestUpdate = function() { if (!this._stopped) { var now = Date.now() if (now >= nextUpdate) { if (timeout) { clearTimeout(timeout); timeout = null } nextUpdate = now + frameLimit requestAnimationFrame(this.update.bind(this)) } else { var that = this timeout = setTimeout(function() { nextUpdate = Date.now() + frameLimit; requestAnimationFrame(that.update.bind(that)) }, nextUpdate - now) } } } })()

You're free to do whatever you want with this code. If more convenient, you can grab it from my test game at http://meow.minimaltype.com/js/plugins/FPSLimit.js

** UPDATED: previous version would fluctuate from 50-60FPS constantly when nothing's going on. This version is a bit better. It would still be wise to have a menu option or something to turn this plugin off entirely for users who don't need it. **
Last edited by ocean pollen; Oct 24, 2015 @ 9:53am
< >
Showing 1-8 of 8 comments
Fern Oct 24, 2015 @ 3:18pm 
I'm the guy they made this for, it looks like it's causing issues with music, will do some more testing but it seems pretty conclusive so far.
Last edited by Fern; Oct 24, 2015 @ 3:19pm
Resi ♥ Oct 24, 2015 @ 9:01pm 
Originally posted by rskingoresama:
I'm the guy they made this for, it looks like it's causing issues with music, will do some more testing but it seems pretty conclusive so far.
I haven't noticed any audio issues while using this, but I tend to turn the music off while testing things.
Lvl1. Slime Oct 27, 2015 @ 1:13pm 
Thanks for the plugin. I've yet to come across audio issues, but I'll update you if I should run into any.
RumikoTheFox Oct 29, 2015 @ 4:22am 
Was looking for something like this. My games keep fluctuating between 30-60 fps in a cycle, so I wanted to limit to 30 fps. Only issue now is that my characters are moving at half speed since I guess your movement speed across maps is based on fps. Don't suppose there's a way to fix that?
ocean pollen Oct 29, 2015 @ 8:48am 
Originally posted by -=~Rumiko the Fox~=-:
Was looking for something like this. My games keep fluctuating between 30-60 fps in a cycle, so I wanted to limit to 30 fps. Only issue now is that my characters are moving at half speed since I guess your movement speed across maps is based on fps. Don't suppose there's a way to fix that?

for 30 FPS, and for move speed, yes. The following plugin does this for you.

Other animations may still noticeably move at half speed. An expansive generalization on this idea would probably be better targeted at Pixi.js itself rather than at the RPG engine.

//============================================================================= // 30FPS.js //============================================================================= /*: * @plugindesc Limits game refresh rate to 30FPS * @author ocean pollen * * @help This plugin does not provide plugin commands. */ ;(function() { function extend(obj, name, func) { var orig = obj.prototype[name] obj.prototype[name] = function() { orig.call(this) func.call(this) } } extend(Game_CharacterBase, 'initialize', function() { this._moveSpeed++ }) var frameLimit = 1000/30, nextUpdate = 0, timeout = null SceneManager.requestUpdate = function() { if (!this._stopped) { var now = Date.now() if (now >= nextUpdate) { if (timeout) { clearTimeout(timeout); timeout = null } nextUpdate = now + frameLimit requestAnimationFrame(this.update.bind(this)) } else { timeout = setTimeout((function() { nextUpdate = Date.now() + frameLimit requestAnimationFrame(this.update.bind(this)) }).bind(this), nextUpdate - now) } } } /* test code; switch FPS and moveSpeed every 10 seconds var is30 = true setInterval(function() { if (is30) { is30 = false; frameLimit = 1000/60; $gamePlayer._moveSpeed-- } else { is30 = true; frameLimit = 1000/30; $gamePlayer._moveSpeed++ } }, 10000) */ })()
Last edited by ocean pollen; Oct 29, 2015 @ 8:48am
This Plugin does not limit the FPS, this does slow down the whole Game....
Resi ♥ Nov 16, 2015 @ 1:47pm 
If you're using a 144hz monitor your game runs at 2.2x speed compared to how the game should be running at a normal speed of 60fps.
Last edited by Resi ♥; Nov 16, 2015 @ 1:48pm
.shroomy_rxcks. Oct 13, 2024 @ 7:19pm 
why did you remove the website?
< >
Showing 1-8 of 8 comments
Per page: 1530 50