My game has been very laggy lately on large maps with many events. Lagging on map transition is possibly excusable but when the player closes the main menu and nothing happens, it gives them the impression that the game has frozen. The lag is also noticeable on new maps with no events but to a lesser degree. I've tried turning off a number of Yanfly plugins like autosave but it seems to have no effect. I've also tried updating nw.js but that has surprisingly made the problem slightly worse. Does anyone have any idea what might be causing the problem?
Extreme lag on main menu and map transition
RPG Maker MV Support1) please go to your project folder, then js folder, then use a text editor to open the rpg_core.js
what is the number at the end of the title line (no number means 1.0)
2) please post screenshots of your plugin manager with your complete list of plugins and their order
3) do you have any parallel process common events? if yes how many and what do they do?
what is the number at the end of the title line (no number means 1.0)
2) please post screenshots of your plugin manager with your complete list of plugins and their order
3) do you have any parallel process common events? if yes how many and what do they do?
almost certainly a refresh of the tileset that is not needed.
I see it in Ace as well... it's because of how the engine was set up, that goes from one scene to another when loading the menu.
the menu is not a window, is a new scene, so the engine unloads the map to load the menu, and then reconstructs it when going back.
how large is the map, in tiles?
I too wonder if there is a plugin that moves menus from the menu scene into the map scene.
Thanks for the quick response
- rpg_core.js version number is v1.6.2
- I have a number of parallel processes but I've tried turning them all off and still get the main menu lag. Under normal conditions I get 140+ fps with all my parallel processes on.
- The map size in the video above is 256x128 tiles (One of the biggest). Note that the main menu lag is noticeably less on smaller maps with less content, but it is still present.
sizes!
this is all about numbers of iterations of redraws!
how much RAM has your computer?
Is the display chip shared or on a dedicated display card with its own RAM?
that was another reason why I asked for screenshots, to check the order.
Is the display chip shared or on a dedicated display card with its own RAM?
please check the order of the yanfly plugins. They have to be in exactly the order given on yanfly's website, top to bottom. anything in the wrong position can cause problems from simple errors to display problems and memory leaks
that was another reason why I asked for screenshots, to check the order.
Can you try this plugin I wrote?
It preserves the map scene when go to menu or battle scene so hopefully there'll be less lag?
It preserves the map scene when go to menu or battle scene so hopefully there'll be less lag?
JavaScript:
(function(alias){
SceneManager.clearStack = function() {
alias.call(this);
SceneManager.preserveScene(null);
};
})(SceneManager.clearStack);
SceneManager.preserveScene = function(scene){
if(this._preserved){
this._preserved.stop();
this._preserved.terminate();
this._preserved.detachReservation();
}
if(scene){
this._preserved=scene;
scene._isPreserved=true;
}else delete this._preserved;
};
(function(alias){
SceneManager.changeScene = function() {
if((this._scene&&this._scene._isPreserved)||(this._nextScene&&this._nextScene._isPreserved)) {
if (this.isSceneChanging() && !this.isCurrentSceneBusy()) {
if (this._scene) {
if(!this._scene._isPreserved){
this._scene.terminate();
this._scene.detachReservation();
} else SceneManager.snapForBackground();
this._previousClass = this._scene.constructor;
}
this._scene = this._nextScene;
if (this._scene) {
if(!this._scene._isPreserved){
this._scene.attachReservation();
this._scene.create();
this.onSceneCreate();
}
this._sceneStarted = false;
this._nextScene = null;
delete this._scene._isPreserved;
}
if (this._exiting) {
this.terminate();
}
}
}else {
alias.call(this);
}
};
})(SceneManager.changeScene);
(function(alias){
SceneManager.goto = function(sceneClass) {
//preserve map scene before battle and menu
if(this._scene && this._scene instanceof Scene_Map){
if(sceneClass==Scene_Battle || sceneClass==Scene_Menu){
this.preserveScene(this._scene)
}
}
if(this._preserved){
if (sceneClass) {
if(this._preserved instanceof sceneClass){
this._nextScene = this._preserved;
delete this._preserved;
}else{
this._nextScene = new sceneClass();
}
}
if (this._scene!=this._preserved) {
this._scene.stop();
}
}else alias.call(this,sceneClass);
};
})(SceneManager.goto);
The full plugin list for Akhena
I can't believe it, it actually works. It's silky smooth now. I'm going to have to test this thoroughly of course but it looks like you might have just solved one of my biggest issues. I recommend making a proper plugin from it with a forum post and licensing info. This is super useful, thank you so much @utunnels
@OpenTangent You are welcome. But that code is not really complete because I removed the battle encounter effect.
If you say it works maybe I can try to finish it. Or do you just want the menu part or both?
If you say it works maybe I can try to finish it. Or do you just want the menu part or both?
@utunnels remember that shops and skill windows are also scenes.
the only true "disposal" of the map should happen when going back to the title or game over (or not even game over, if you want to keep the map for any potential rollback on continue)
work in reverse: default to keeping the scene, only check for going to title and then dispose.
shops may only be added on top of the stack, from the map.... there's no way you will ever load a game to the middle of a shop scene.
the only true "disposal" of the map should happen when going back to the title or game over (or not even game over, if you want to keep the map for any potential rollback on continue)
work in reverse: default to keeping the scene, only check for going to title and then dispose.
shops may only be added on top of the stack, from the map.... there's no way you will ever load a game to the middle of a shop scene.
Yeah, I fogot that. So the logic should be:
if(current scene is map && next scene is not map) reserve currentmap
I wonder if another solution that keeps image cache can also work (I believe I saw one cache plugin did that, but it'll make the game use too much RAM if not carefully).
if(current scene is map && next scene is not map) reserve currentmap
I wonder if another solution that keeps image cache can also work (I believe I saw one cache plugin did that, but it'll make the game use too much RAM if not carefully).
I did notice the fast snap to battle scene and I actually don't mind it. It makes the game feel more responsive. I definitely like @gstv87's idea of keeping the current map in memory as often as possible as long as previous maps are disposed regularly. I've set the minimum RAM requirement for Akhena to 4GB on Steam.
On the topic of Yanfly plugins. I've noticed that YEP_EventMiniLabel is another performance hitter during map load and [ShowMiniLabel] calls.
every map is disposed of, the moment you change maps.
that's the usual behavior... but it shouldn't dispose the map when loading another scene on top of it, since the only place to go back to, is always the map.
going from map to map still happens in the map *scene*
nnnnnnngh.....
not advisable for tilemaps, since *the map* usually refers to it's bitmaps as "list entry nº X" from a list, not by name, and the list changes between maps.
could eat too much memory.
you always only need 10 files per map.... which files? whatever the list says... if it ain't there, don't keep it.
(I worked around that fact when making my preloader: "go to this map", "which files to load?" -> these. "any already loaded?" [this list] XOR [that list]. "keep those, drop the unneeded ones and load the new ones")
I think it's normal. When I used RPG Maker MV offline it was relatively faster than when I use it online. I bought it through Steam and there's that problem, if the application isn't updated the game won't run. RPG 2K even runs without Steam.
Now, any other open program directly impacts the game here, be it Gimp, Word, Excel and even the Internet.
Not to mention that recording videos also slows down the program's response. I think it must be due to RAM memory, because before I had a program that cleaned memory, but my PC bugged out with it, now I don't use it anymore.
Now, any other open program directly impacts the game here, be it Gimp, Word, Excel and even the Internet.
Not to mention that recording videos also slows down the program's response. I think it must be due to RAM memory, because before I had a program that cleaned memory, but my PC bugged out with it, now I don't use it anymore.
Anyway, this is the 1.0 version. Let's wait for the OP to test it.
It preserve the map scene, until another map is loaded or back to the title screen.
By the way, the battle scene is tricky. Because zoom and fadeout should be reset and the game hides all characters in order to make a screenshot of the map background.
It preserve the map scene, until another map is loaded or back to the title screen.
By the way, the battle scene is tricky. Because zoom and fadeout should be reset and the game hides all characters in order to make a screenshot of the map background.
JavaScript:
(function(alias){
SceneManager.clearStack = function() {
alias.call(this);
SceneManager.preserveScene(null);
};
})(SceneManager.clearStack);
SceneManager.preserveScene = function(scene){
if(this._preserved){
this._preserved.stop();
this._preserved.terminate();
this._preserved.detachReservation();
}
if(scene){
this._preserved=scene;
scene._isPreserved=true;
}else delete this._preserved;
};
Spriteset_Map.prototype.showCharacters = function() {
for (var i = 0; i < this._characterSprites.length; i++) {
this._characterSprites[i].show();
}
};
(function(alias){
SceneManager.changeScene = function() {
if((this._scene&&this._scene._isPreserved)||(this._nextScene&&this._nextScene._isPreserved)) {
if (this.isSceneChanging() && !this.isCurrentSceneBusy()) {
if (this._scene) {
if(!this._scene._isPreserved){
this._scene.terminate();
this._scene.detachReservation();
} else{
SceneManager.snapForBackground();
$gameScreen.clearZoom();
}
this._previousClass = this._scene.constructor;
}
this._scene = this._nextScene;
if (this._scene) {
if(!this._scene._isPreserved){
this._scene.attachReservation();
this._scene.create();
this.onSceneCreate();
this._sceneStarted = false;
}else{
this._scene._active=true;
this._scene.menuCalling = false;
if(this._previousClass==Scene_Battle){
this._scene.startFadeIn(this._scene.fadeSpeed(), false);
this._scene._spriteset.showCharacters();
}
}
this._nextScene = null;
delete this._scene._isPreserved;
}
if (this._exiting) {
this.terminate();
}
}
}else {
alias.call(this);
}
};
})(SceneManager.changeScene);
(function(alias){
SceneManager.goto = function(sceneClass) {
//preserve map scene before battle and menu
if(this._scene && this._scene instanceof Scene_Map){
if(sceneClass!=Scene_Map){
this.preserveScene(this._scene);
}
}
if(this._preserved){
if (sceneClass) {
if(this._preserved instanceof sceneClass){
this._nextScene = this._preserved;
delete this._preserved;
}else{
this._nextScene = new sceneClass();
}
}
if (this._scene!=this._preserved) {
this._scene.stop();
}else{
this._preserved._active=false;
if(sceneClass==Scene_Battle) {
this._scene.launchBattle();
}
}
}else alias.call(this,sceneClass);
};
})(SceneManager.goto);
I'm glad it helps.
Now I think I found a minor bug that if you open and close the menu AFTER a map transition, there would be a fade-in effect.
Not sure how it happens, I think I'll check it out when I got home.
Edit* Fixed
Now I think I found a minor bug that if you open and close the menu AFTER a map transition, there would be a fade-in effect.
Not sure how it happens, I think I'll check it out when I got home.
Edit* Fixed
Original thread: https://forums.rpgmakerweb.com/threads/extreme-lag-on-main-menu-and-map-transition.171283/