RPG Maker MV is designed to run generally at 60 fps. As such, it keeps track of the total amount of play time a player has been playing by monitoring the total number of frames that have been run. This is all fine and dandy if the game is always running at 60 fps. If, however, the player is on a machine that is older and cannot run MV games at 60 fps, the accuracy of the total play time way off. If the game is running at 30 fps on average, then the play time recorded by MV will be HALF of the play time played in reality. The inverse is also true if the game was running at higher frame rates, which can happen on 144hz monitors.
This simple plug-n-play plugin addresses this issue by using real-time to keep track of the total play time played by the player instead of the total number of frames.
You can also reset the playtime as well, useful for those with games that start a little bit after the new game is launched. You can also pause and resume the playtime if you wish to avoid the game ticking up during cutscenes.
To use: Simply copy/paste the plugin code below into a text editor and save it as AccuratePlaytime.js (you can call it whatever you want actually as long as you include the .js). To reset the play time, type ResetPlaytime in a plugin command window. To pause the play time, type PausePlaytime and to resume the play time, type ResumePlaytime. Pausing will not persist if the game is saved then reloaded.
Terms: Use as you like. Free or commercial. Modify or extend as needed. Credit isn't even necessary though you are welcome to.
Code:
/*:
* @plugindesc Counts total playtime accurately regardless of framerate
* @help This plugin is plug-n-play and requires no parameters to set.
* To reset the play time, type ResetPlaytime in a plugin command window
* Version 1.3: Pause and ResumePlaytime commands added, also addressed a bug with doubling playtime
* Version 1.2: ResetPlaytime command
* Version 1.1: Addresses bug fix to saves not storing time correctly after multiple saves
*/
(function()
{
var startTime = 0;
var pausedTime = 0;
var paused = false;
var _DataManager_setupNewGame = DataManager.setupNewGame;
var _GameSystem_initialize = Game_System.prototype.initialize;
var _GameSystem_onBeforeSave = Game_System.prototype.onBeforeSave;
var _GameSystem_onAfterLoad = Game_System.prototype.onAfterLoad;
var _GameInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;