Running Your Game at it's Best...

Not sure if this goes here or not, and sorry if it doesn't. I don't wanna think what I'm about to say is an idea or anything particularly specific to my project so much as me being curious about overall tips and tricks for the following... oh the only specific thing I'd say is this is mostly aimed at MV.

How does one keep their game running at a good (and constant) 60 FPS... I will say on note of my own project, it's been a GIGANTIC problem for a host of reasons. battles general just can't do it lol. and maps have spikes at points. but to stay general, I'm curious about these things...

A. what are some of the biggest contributors to lag/framerate drops? I know I've read a lot about (and have my own issues) with battle animations. also a parallel common event gone wrong will do it. learned that one first hand too. oh and resolution... but I keep reading conflicting things about that one.

B. How much of it is the engine vs. your computer/laptop etc... I hear things about, in this case, MV being poorly optimized. but I also know in some cases (maybe even mines), that you're just running things on toaster or something of the sort. How do you distinguish how much of it is the engine and how much of it is on your end?

lastly, is 30 FPS THAT bad? especially for a 2D turn based Rpg? right now I definitely experience less dips when I just run things at 30 myself. but I know that has a bit of stigma attached to it. that's enough outta me tho. I guess I'm curious what are other's experience with trying to optimize their game and whatnot and what might help others do the same.
A.) Parallel events are huge factor in lag. As is parallax mapping.

B.) 99% of if it is the engine. Running rpg maker games are really light weight, the engine is just very poorly optimized. When you play an rpg maker game, the package is actually just running an html5 browser window.

30fps is pretty bad. I'm very curious how you are able to get that low of fps. My game is running 3-5 parallax mapping layers at once, with many parallel events taking place on screen at once, AND weather, fog, and shadow layers and I still get 50-60fps on both systems I test on.

The biggest fps increase will be to update your your NW.JS, you can follow this guide.

This should give you a HUGE performance increase.
I have never encountered a frame drop with rpg maker games. Or well, not mine at least. I hear updating the NW.js helps a lot.
Lag:
if X Button Pressed - Change Actor Graphic
else - Change Actor Graphic

This will help you get lots and lots of Lag Spikes as soon the Engine needs performance reserves for something else.
This will change the Actor Graphic all the Time again and again and executing that command uses tons more fuel than a simple if statement or most other commands. Its a very performance hungry one.

No Lag:

if X Button Pressed - if Switch1 is Off - Turn Switch1 On and Change Actor Graphic
else - if Switch1 is On - Turn Switch1 Off and Change Actor Graphic

The change Actor Graphic Command is only executed one time when realy needed.
Asking If statements status all the Time is no Problem.

Iam bad in explaining, hope this helps.
That updating nwjs is a very good thing, but it has its downside effects, more specifically some methods and functions are re-written and not all methods inside RPG Core files are compatible with the latest nwjs updates, for example, if you update nwjs inside RPG Maker MV/MZ and you run a battle in test mode, after battle nwjs won't close, an only black screen will remain. Another thing with updating PIXI... Dunno exactly what or where the problem is located, but an attempt to run the game with PIXI 5+ will throw an error that WebAudio.initialize is not a function. But I agree with @KawaiiKid - poor optimization of engine, a JS specialist which I prefer not to mention his name told me, that PIXI is not fully utilized by the engine and it is used as merely a renderer.

So from my personal experience to avoid FPS Spikes, low framerate is to review your entire project and remove unnecessary elements, reduce maps size (split them into smaller sections), verify the plugins you are using, a lot of them inherit methods and functions from core files and remove those you are not using. Finally, as last resort you can try to optimize PNG files with TinyPNG online tool, the smaller size means fewer data to process by hardware. I'm sorry I cannot help more, but I'm also still in process of learning MV and its core files, how it works and where to find help if I can't manage on my own to solve them.
MV is very badly optimised.

I don't get lag per sé, but I do get random stuttering. Even transferring from a standard map with no parallel events, going through a door to another standard map with no parallel events, sometimes the second map (regardless of direction) will be smooth, sometimes it will stutter as I move left to right. I have no idea why. Using a resolution compatible with the 48 tile size doesn't change it - nothing does.

It's really weird, and annoying!
This is the main reason why I got MZ. MV never felt smooth to me, regardless of what I did.
A.) Parallel events are huge factor in lag. As is parallax mapping.

B.) 99% of if it is the engine. Running rpg maker games are really light weight, the engine is just very poorly optimized. When you play an rpg maker game, the package is actually just running an html5 browser window.

30fps is pretty bad. I'm very curious how you are able to get that low of fps. My game is running 3-5 parallax mapping layers at once, with many parallel events taking place on screen at once, AND weather, fog, and shadow layers and I still get 50-60fps on both systems I test on.

The biggest fps increase will be to update your your NW.JS, you can follow this guide.

This should give you a HUGE performance increase.
I actually have done the NW.JS thing. I actually was using something that limits FPS cause I kept seeing the least amount of dips when I ran at a steady 30 FPS. which is why I was considering just running at 30 overall. but I know people wouldn't be ok with that, even tho myself don't have a huge problem with it for a 2D turned based rpg.

in general tho, this has all been useful info. some of which I knew, but was further elaborated on.
I actually have done the NW.JS thing. I actually was using something that limits FPS cause I kept seeing the least amount of dips when I ran at a steady 30 FPS. which is why I was considering just running at 30 overall. but I know people wouldn't be ok with that, even tho myself don't have a huge problem with it for a 2D turned based rpg.

in general tho, this has all been useful info. some of which I knew, but was further elaborated on.
I think kawaiikid just got your questioning wrong, he answered as if you had a 60fps game that dropped to 30fps, that is indeed REALLY bad. Now having a game that has the Graphics updated fixed at 30 fps and the game runs at 30fps, then it isn't that much of a problem. Yes, some things are not as smooth, but the variation of fps is what really really kills it, a fixed 30 fps game is MUCH better than a game that floats around 40fps~60fps, because you don't fell that "laggy" situation of the framerate drops.
I think kawaiikid just got your questioning wrong, he answered as if you had a 60fps game that dropped to 30fps, that is indeed REALLY bad. Now having a game that has the Graphics updated fixed at 30 fps and the game runs at 30fps, then it isn't that much of a problem. Yes, some things are not as smooth, but the variation of fps is what really really kills it, a fixed 30 fps game is MUCH better than a game that floats around 40fps~60fps, because you don't fell that "laggy" situation of the framerate drops.
that's why I was considering just running at 30 FPS since it's not dipping as much. especially in battle. but yeah I probably worded everything weird so I can understand the confusion.

Original thread: https://forums.rpgmakerweb.com/threads/running-your-game-at-its-best.147005/