MV Why is SceneManager.renderScene() called on every requested frame?

I dont even think 30 fps -> 60fps would help me play better,
That's because you also have to fuel yourself with 500mg of caffeine every play session, and warm up with a few jokes about doing the other team's mom.

How else do you think I'm popping quads with a positive k/d?
Only when I'm tweaking out on a lethal dose of gamer fuel while popping a quad on your mom last night.
I actually don't believe that this was an oversight by the developers. Although they rewrote all this particular code in MZ, they still did it essentially the same way (where it calls the render function outside of the time-corrected part of the loop), so I am leaning toward the assumption that it's intentional.

Graphics stuff isn't really my forte, but if I were to venture a guess as to why they would choose to do this, I'd say that it could be because they wanted to reduce the chances of screen tearing. Although screen tearing most commonly happens when the game renders faster than your monitor's refresh rate, it can also still happen (albeit less noticeably) when the reverse is true, because the graphics card might try to push a new frame to the monitor during the middle of a refresh cycle.

Even if it means re-rendering unchanged frames, synchronizing the game's frame rate with the monitor's refresh rate will help align frame buffer updates with the monitor's refresh intervals, which should help prevent that tearing.

I don't think that this is particularly unusual. Many games that I've played seem to have the game logic and input processing decoupled from the rendering.

Just tested MZ, and my assumption was correct, because it is in a ticker, it seems this issue is not there in MZ, I ran my monitor in both 144 hz, and 60 hz, and there is never an instance where it renders needlessly.
You are correct that MZ use's Pixi's ticker, whereas MV implements its own ticker using requestAnimationFrame. However, Pixi's ticker is also driven by requestAnimationFrame, and (to my understanding) both implementations will generally match the ticks to the display's refresh rate.

Here is the relevant function in MZ:
JavaScript:
Graphics._onTick = function(deltaTime) {
    this._fpsCounter.startTick();
    if (this._tickHandler) {
        this._tickHandler(deltaTime); // Graphics._tickHandler holds a reference to SceneManager.update
    }
    if (this._canRender()) {
        this._app.render();
    }
    this._fpsCounter.endTick();
};
This function calls SceneManager.update, which then uses deltaTime (the time elapsed since the last frame) to call SceneManager.updateMain approximately 60 times per second. But as you can see, the render function is called outside of that--every tick.
@Arthran based on my understanding of v-sync, this would make sense, actually.

In which case, it might be nice to change this into an options menu option plugin to enable/disable v-sync (not to be confused with Yanfly's questionably named Video Synch plugin).
Graphics stuff isn't really my forte, but if I were to venture a guess as to why they would choose to do this, I'd say that it could be because they wanted to reduce the chances of screen tearing. Although screen tearing most commonly happens when the game renders faster than your monitor's refresh rate, it can also still happen (albeit less noticeably) when the reverse is true, because the graphics card might try to push a new frame to the monitor during the middle of a refresh cycle.
Hmm.. I would have to disagree here.. if the scene is already rendered... re-rendering it when nothing has changed doesn't really change anything. it's like... having a sprite sheet where the first frame, and second frame are identical... nothing has changed from frame A -> frame B. Also this wouldn't necessarily mitigate screen tearing.. cause as before frame A -> frame B are the same.

Screen tearing occurs when the monitor begins drawing the contents of the game, BUT it's already finished drawing frame A but in the middle of drawing frame B... but again, if frame A and B are identical there's really nothing to tear to begin with...

Also the only way ensure screen tearing doesn't occur, is to ensure that the GPU is finished drawing the next frame, before the screen displays it, which this doesn't really do.. because it's simply rendering at the same rate as usual.. E.G. roughly every 16.6666666667 ms, so it's not really attempting to sync the gpu to the monitor in any way here. it's just rendering at the usual intervals, and if the GPU is rendering at the same set intervals, which are out of sync with the screens refresh rate, which is also at the same set intervals( whatever frame rate your monitor can display at ), then nothing is changing, and no attempt is made to "sync" the display 😛

Anyone correct me if I'm wrong here on this ^^; I've not delved TOO heavily into vsync/gsync/freesync, but I have done.. a bit of research into it.

Also this is most definitely not an interpretation of vsync, vsync CAN be applied to an rpg maker game.. Actually again, correct me if I'm wrong again here, I believe vsync is enabled by default here via nwjs/chromium. It can be disabled via a special chromium flag "--disable-gpu-vsync"

You are correct that MZ use's Pixi's ticker, whereas MV implements its own ticker using requestAnimationFrame. However, Pixi's ticker is also driven by requestAnimationFrame, and (to my understanding) both implementations should generally match the display's refresh rate.

You are correct here ^^ as for the MZ implementation though, it seems to incur any unecessary draws, at least as far as I tested in both 60, and 144 hz. ^^ unfortunately these are the only two rates my monitor can reach :c so I can't test anything other than these, but the scene update seems to fire at every interval of the ticker, as does the render, even at 144 hz, there unecessary renders that I could find. ^^

Another neat thing about the pixi ticker object as well, is that you can set a max fps as well, somewhat related 😛 therefore, you could easily set a game to target 60 fps on all hardware, by setting the "maxFPS" value of the ticker.
Theoretically, you COULD add a 30 fps/60 fps toggle for your game, but due to the way rpg maker handles movement, and animations, and several other things if you set it to 30 fps, things will run at half speed( at least some things, not all ), lol.
Hmm.. I would have to disagree here.. if the scene is already rendered... re-rendering it when nothing has changed doesn't really change anything. it's like... having a sprite sheet where the first frame, and second frame are identical... nothing has changed from frame A -> frame B. Also this wouldn't necessarily mitigate screen tearing.. cause as before frame A -> frame B are the same.

Screen tearing occurs when the monitor begins drawing the contents of the game, BUT it's already finished drawing frame A but in the middle of drawing frame B... but again, if frame A and B are identical there's really nothing to tear to begin with...

Also the only way ensure screen tearing doesn't occur, is to ensure that the GPU is finished drawing the next frame, before the screen displays it, which this doesn't really do.. because it's simply rendering at the same rate as usual.. E.G. roughly every 16.6666666667 ms, so it's not really attempting to sync the gpu to the monitor in any way here. it's just rendering at the usual intervals, and if the GPU is rendering at the same set intervals, which are out of sync with the screens refresh rate, which is also at the same set intervals( whatever frame rate your monitor can display at ), then nothing is changing, and no attempt is made to "sync" the display
Maybe I didn't explain myself well, or maybe I'm misunderstanding you, but I feel like you might be under the impression that I said the opposite of what I did (or what I intended to atleast).

I was not saying that re-rendering an identical frame could cause screen tearing--I was saying the opposite of that. I was saying that rendering a *changed* frame while the monitor is still in the process of drawing the previous frame could cause screen tearing.

My suggestion was that maybe the engine devs' thinking, when they chose to force a render every tick (instead of only after the game state has potentially changed), was that it could help prevent the chances of the rendering becoming misaligned with the monitor's refresh cycle, since it would then be rendering at the same rate that your monitor refreshes.

But all that being said, after having thought about it a bit more, I don't believe that it would really make a difference in this case. To my understanding, requestAnimationFrame is designed to synchronize with the monitor's refresh, so even when using Mac's modification, I think that the chances of misalignment occurring are probably pretty slim.
Graphics stuff isn't really my forte, but if I were to venture a guess as to why they would choose to do this, I'd say that it could be because they wanted to reduce the chances of screen tearing.
Screen tearing is the opposite of a screen lag - you're rendering the frames faster than your monitor can do it.
That being said, there's no way this is even remotely possible in MV's game loop.
MV is single-threaded and frame-capped at monitor's refresh rate. As such, there is never a situation where you'd be rendering two frames simultaneously. Because regardless when you push the new frame, the previous one will already have finished rendering.
I'd agree that there doesn't seem to be a way for this change to cause screen tearing. Since we're still only drawing frames from a function synced with requestAnimationFrame, they will always be synchronised with the refresh rate, regardless of if we skip rendering some of them or not.
I was not saying that re-rendering an identical frame could cause screen tearing--I was saying the opposite of that. I was saying that rendering a *changed* frame while the monitor is still in the process of drawing the previous frame could cause screen tearing.

My suggestion was that maybe the engine devs' thinking, when they chose to force a render every tick (instead of only after the game state has potentially changed), was that it could help prevent the chances of the rendering becoming misaligned with the monitor's refresh cycle, since it would then be rendering at the same rate that your monitor refreshes.

Correct, I understood this, what I was saying is that re-rendering an unchanged scene would not stop screen tearing, nor would it cause it, as again if your rendering the exact same data, at the exact same intervals, so nothing is really changed in this case. Sorry If I was unclear :x but I was simply saying if frame A is the same as frame B, then no data has changed since frame A was rendered, so re-rendering frame B which would end up exactly the same as frame B, wouldn't really fix, nor cause any additional screen tearing.

Also these ticks occur at ( roughly ) the same intervals regardless, as the ticks occur at set intervals, so if the rendering was ALREADY misaligned to begin with, then when you re-render the frame, when nothing has changed, it would STILL be rendering in this misaligned loop, this this would really not do anything for tearing.
I'd agree that there doesn't seem to be a way for this change to cause screen tearing. Since we're still only drawing frames from a function synced with requestAnimationFrame, they will always be synchronised with the refresh rate, regardless of if we skip rendering some of them or not.

This was what I was trying to say lol, it's still synced to the same invervals of requestAnimationFrame, which if it was ALREAADY misaligned with the screens refresh rate, does not fix any tearing which may occur :x

This was what i was trying to state ^^; apologies, haha, I'm terrible at explaining things, lol, this is why I suck at documenting code i work on Q__Q lol. But yeah, just at a glance, this is my take on the matter, again if I'm wrong someone correct me, as I am not SUPER knowledgable on the topic of syncing gpu with monitor refresh rates. I have done some studies on the matter, as well as some studies on physics, the process of 3D rendering, and several other topics, but I am not confident in saying I am an expert in any ^^; lol

But regardless, it's always nice to have more opinions, as it helps widen any given persons perspective on the matter, So i apologize @Arthran, I wasn't trying to insult you or anything if I came off that way, I was just posting my take on the matter, and I would like to say thanks for your insight into this as well 😀 again it's always helpful to get many takes on a topic! ^^
At this point I've collected so many high refresh rate-related fixes that I'll probably bundle them all into a plugin if this one turns out not to have any unforeseen problems
Well, this took a while, since I took a bit of break from RM, but that plugin is ready. So for anyone who's still watching this thread for it: here it is.

Original thread: https://forums.rpgmakerweb.com/threads/why-is-scenemanager-renderscene-called-on-every-requested-frame.169623/