MV Would this plugin be possible?

(Apologies for the vague title. I could not think of a name for the plugin I want.)

Would it be possible to make a plugin that allows one to slow down the game by the frame and show the number of frames in the corner of the screen?

Like, you activate a switch, and then it counts the frames passing by until the switch is closed, like "1, 2, 3 . . . 129, 130, 131 . . . and so on?"

The reason why I want a plugin like this is purely for utility, as I have systems right now that require a lot of very specific lining up of wait frames and the likes. Mainly with sound effects needing to be lined up. It is getting sort of annoying having to manually test the timing to fine-tune it and having to jump all over the place between huge events to reference things. I want to be able to load this plugin in another project, manually feel out the timing there, and then copy it in.

I imagine that a variable could control the speed of the game, and a switch whether or not the slowdown occurs, and the count resets when the switch is turned off. Also, I'd prefer whether or not the framecount shows to be able to be toggled on and off incase I decide to use it as more than a utility.

If anyone can create this plugin, many thanks~
I think it would be easier to record yourself playing through that portion of the game, then a video editor could do what you're looking for. But I may be wrong and you'll find someone willing to take on such a request.
There are slowdown plugins and speedup plugins which theoretically you could "speed up" by 0.5x or whatever. Then you could just have a parallel process increment a frame count variable and show it on the screen with HUDMaker or whatever.
I think it would be easier to record yourself playing through that portion of the game, then a video editor could do what you're looking for. But I may be wrong and you'll find someone willing to take on such a request.
Not sure that would really accomplish what I'm looking for.

The main thing I'm aiming to accomplish with this is to discover the exact framecount of sounds I am using to better line them up in accordance with each other. I've made an evented battle system in my game, and for every enemy skill, I have to line up different sounds for their attacks for multiple instances, like for when they're blocked or parried, etc.

EDIT: I just realized that it may be complicated if the sound itself isn't slowed down. I didn't consider that angle.
I have something in a similar vein I've made for my game (one of these days I should just make a huge plugin will all of my devtools). It allows you to freeze the game, and then advance it frame by frame. So not quite the fluid speed control you're looking for, but it might help.
I had to make a few tweaks to make sure it can still live outside of my project, but it should work.
JavaScript:
SceneManager.update = function (force) {
    if ($gameSwitches && $gameSwitches.value(4) && force !== true) return;
    try {
        this.tickStart();
        if (Utils.isMobileSafari()) {
            this.updateInputData();
        }
        this.updateManagers();
        this.updateMain();
        this.tickEnd();
    } catch (e) {
        this.catchException(e);
    }
};

SceneManager.updateMain = function () {
    if (Utils.isMobileSafari()) {
        this.changeScene();
        this.updateScene();
    } else {
        var newTime = this._getTimeInMsWithoutMobileSafari();
        var fTime = (newTime - this._currentTime) / 1000;
        if (fTime > 0.25) fTime = 0.25;
        this._currentTime = newTime;
        this._accumulator += fTime;
        while (this._accumulator >= this._deltaTime) {
            this.updateInputData();
            this.changeScene();
            this.updateScene();
            this._accumulator -= this._deltaTime;
            if ($gameSwitches && $gameSwitches.value(4)) break;
        }
    }
    this.renderScene();
    this.requestUpdate();
};

proccessKeyDown = function (event) {
    switch (event.key) {
        case 'f': SceneManager.update(true); break;
        case 'g':
            console.log("Toggling game freeze");
            $gameSwitches.setValue(4, !$gameSwitches.value(4));
            if (!$gameSwitches.value(4)) SceneManager.requestUpdate();
            break;
    }
}

document.addEventListener('keydown', proccessKeyDown);

You can freeze/unfreeze the game by pressing 'g', and advance one frame by pressing 'f'. You can also toggle the freeze by changing switch 4. You can replace the 4 in this script with something else, as well as 'f' and 'g' in the proccessKeyDown function.

As for showing the frames, you can open devtools (F12), select console, click on the eye in the top bar and type Graphics.frameCount - this will continuously show you what frame the game is on.

Note that this script does not affect sounds - once they're started, they're not synced to game's logic in any way. Some hack to affect them might be possible, though I don't think playing 1/60 of a second of a sound would be that useful.

EDIT after seeing your reply: if you just want the framecount of sounds, why not open them in Audacity (or any other sound editing program) and check there?
I have something in a similar vein I've made for my game (one of these days I should just make a huge plugin will all of my devtools). It allows you to freeze the game, and then advance it frame by frame. So not quite the fluid speed control you're looking for, but it might help.
I had to make a few tweaks to make sure it can still live outside of my project, but it should work.
JavaScript:
SceneManager.update = function (force) {
    if ($gameSwitches && $gameSwitches.value(4) && force !== true) return;
    try {
        this.tickStart();
        if (Utils.isMobileSafari()) {
            this.updateInputData();
        }
        this.updateManagers();
        this.updateMain();
        this.tickEnd();
    } catch (e) {
        this.catchException(e);
    }
};

SceneManager.updateMain = function () {
    if (Utils.isMobileSafari()) {
        this.changeScene();
        this.updateScene();
    } else {
        var newTime = this._getTimeInMsWithoutMobileSafari();
        var fTime = (newTime - this._currentTime) / 1000;
        if (fTime > 0.25) fTime = 0.25;
        this._currentTime = newTime;
        this._accumulator += fTime;
        while (this._accumulator >= this._deltaTime) {
            this.updateInputData();
            this.changeScene();
            this.updateScene();
            this._accumulator -= this._deltaTime;
            if ($gameSwitches && $gameSwitches.value(4)) break;
        }
    }
    this.renderScene();
    this.requestUpdate();
};

proccessKeyDown = function (event) {
    switch (event.key) {
        case 'f': SceneManager.update(true); break;
        case 'g':
            console.log("Toggling game freeze");
            $gameSwitches.setValue(4, !$gameSwitches.value(4));
            if (!$gameSwitches.value(4)) SceneManager.requestUpdate();
            break;
    }
}

document.addEventListener('keydown', proccessKeyDown);

You can freeze/unfreeze the game by pressing 'g', and advance one frame by pressing 'f'. You can also toggle the freeze by changing switch 4. You can replace the 4 in this script with something else, as well as 'f' and 'g' in the proccessKeyDown function.

As for showing the frames, you can open devtools (F12), select console, click on the eye in the top bar and type Graphics.frameCount - this will continuously show you what frame the game is on.

Note that this script does not affect sounds - once they're started, they're not synced to game's logic in any way. Some hack to affect them might be possible, though I don't think playing 1/60 of a second of a sound would be that useful.

EDIT after seeing your reply: if you just want the framecount of sounds, why not open them in Audacity (or any other sound editing program) and check there?
I do have audacity and tried to find the framecount there, but was only able to narrow it down to seconds. I could look a little deeper into it and see if I could figure out if that's possible.
Not sure that would really accomplish what I'm looking for.

The main thing I'm aiming to accomplish with this is to discover the exact framecount of sounds I am using
So you look at the length of the sound file and multiply that by 60 frames per second?

Ninja'd by @Mac15001900 😉
Not sure that would really accomplish what I'm looking for.

The main thing I'm aiming to accomplish with this is to discover the exact framecount of sounds I am using to better line them up in accordance with each other. I've made an evented battle system in my game, and for every enemy skill, I have to line up different sounds for their attacks for multiple instances, like for when they're blocked or parried, etc.

EDIT: I just realized that it may be complicated if the sound itself isn't slowed down. I didn't consider that angle.

1706646664655.png

This is a math problem. You can open up audacity to look at how long different sounds last. This example file I have opened is Shop1. It lasts around 1 second. 1 second multiplied by 60 frames per second should mean it lasts for 60 frames. If you needed to know when the ringing sound is at its maximum, it happens at around the 0.20 mark which 0.20 x 60 is roughly 12 frames.

To account for pitch changes, it's a simple division problem. 110% pitch would mean the sound now lasts for roughly 60 / 1.1 = 55 frames.
Tell me if I understand you correctly.
You're looking for a plugin that allows you to count in seconds in the game?
So, something that doesn't use frames-based seconds, but tick-based?
Tell me if I understand you correctly.
You're looking for a plugin that allows you to count in seconds in the game?
So, something that doesn't use frames-based seconds, but tick-based?
By frames, not just seconds, and it needs to slow down audio, too. I dunno how complex that is to pull off, but that may be the more challenging aspect, lol.

Original thread: https://forums.rpgmakerweb.com/threads/would-this-plugin-be-possible.165300/