RMMV FPS Slowdown with 2880 Events, How to Improve FPS of this Massive Project?

eluukkanen

Game Dev
Veteran
Joined
Feb 16, 2016
Messages
350
Reaction score
238
First Language
Finnish
Primarily Uses
N/A
Hi RPG Maker Forum Members,

THANK YOU beforehand already :kaoblush:, so many helpful people have helped me here in the past.

I have a question about improving performance of a game I am making. I think I know how this issue comes, here is the information:

many events.jpg
I am making a game that has maps with size of 130x 100y. These maps connect to eachother with a system I have built (sort of open world, but not quite)

Each map has 5 types of objects in form of events. Trees, Flora, Fauna, Buildings and NPCs. When each map loads they first setup by spawing in (with event spawn plugin) trees (around 50 or so). Then flora is setup (around 100) then fauna (around 30) then buildings made of 48x48 parts (around 200) and then NPC's. I am not sure has anyone done this sort of system with rpg maker, but it works so far.

This is done so I can make as example a fire spread to event to event with a system I have made. Also each object can be destroyed if needed. All these systems work as intended. The only things that suffers is the performance.

It's not because of the plugins. I have tested and removed temporarily all plugins but the ones that spawn things in. Also the drop of FPS to 10 or so happens only on maps where the objects have been spawned into. Also I have made adjustements to package.js and all recommended things I have managed to find out from this very forum.

The slowdown is because of the amount of events (I really need this many events) as even outside the players view the events still are moving and doing their thing. Even if I just spawn events that do not do anything, it still slows down.

I have taken a lot of steps trying to improve the performance. This game I am making would be something many here would really enjoy, but the problem is that if the performance is this poor, it is not yet enjoyable. In small scale it is amazing, but in bigger there are problems.

If there is anyone here who has the knowledge please let me know. I have tried to find out an anti-lag solutions, but as for projects where there are only a few events here and there (under 100) the engine works perfectly well. That is why I have read that people like victor (who made anti lag plugins earlier) havent done this to MV, which is understandable.

I am personally doing my all to find out a way to somehow stop updating any events outside of players view distance. This would increase the performance in a huge way.

Any help someone might give would be hugely appreaciated. I would even pay to someone to do this, as I know it would be simple, but with my limited knowledge of coding I simply cannot yet achieve it.
 

Faherya

The Knight of the Sad Figure
Veteran
Joined
Jul 25, 2013
Messages
254
Reaction score
582
First Language
Portuguese
Primarily Uses
RMVXA
In fact, it is the events. The RPG Maker was not made to handle this amount of them at the same time. What is the real need to have so many on such large maps, if you can divide the scenarios into smaller environments?

This will not break the flow of the game, just add specific teleports that do not have visual effects (a.k.a fade out / in). If done correctly, the player may not even realize he has been transferred from one map to another.

If the problem is to keep events in their respective states (position and the like), use this. These guys are working on an antilag, but what can be done to help the code work makes it easier. The best antilag is the developer. :D
 
Last edited:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,266
Reaction score
1,410
First Language
English
Primarily Uses
RMXP
F12 brings up the dev tools when testplaying the game.
Click on the performance tab. This allows you to record a bit of you playing your game. It will then analyze the recording and tell you where it spend its time. Super valuable information when trying to optimize your game.

That said, I have a gut feeling that optimizing the Game_Map.prototype.eventsXyNt method so it uses a better datastructure for looking up events on tile (x, y), say a hash map, can help alot.

Instead of stop updating events outside of the players view distance it is probably better keep track of which events needs to be updated. You can also consider splitting the events into multiple types. If you have your events that doesn't move in a separate list then you don't need to even consider them when considering which events should move.

Don't just go for these ideas though. Use the performance tab to profile your code and find which method consumes the most time. I mentioned Game_Map.prototype.eventsXyNt because in MZ I saw it consuming a lot of time when having 500 events running around, and because when building a superior collision detection system in RMXP got massive gains. Tested with a pathfinding script on a 500x500 map with 50 events. In the it took to check 2500 tiles before it could check 200000 tiles.

You could also create your own data model with the generated elements. Then write the code for updating and maintaining your data. How fauna moves, fire spreads, etc.
On top of this build a system for generating and deleting event as they come into the player's view. Adding some buffer area makes it easier to ensure the events truly outside the player's view. By buffer area I mean that events are created when they are let's say 2 tiles away from the player's view.
I have used this technique before in RMXP and had 20k events in a 499x499 map running without lag.

@Faherya
How will you implement the firespreading scenario?

*hugs*
 
Last edited:

Hyouryuu-Na

Sapphire Sodium
Veteran
Joined
Jun 15, 2017
Messages
846
Reaction score
1,968
First Language
Not English
Primarily Uses
RMMV
Use a preloader plugin that can load up the whole map before the game starts. Or alternatively, upon game start/load, fade out the screen and wait for a few frames for the entire map to sort of load I guess. It seems to work for me.
Go for a smaller screen resolution. The more of the map the player can see at a time, the bigger the lag. Something like 1008x576 or 1104x624 should improve performance.
Divide your map. Does the player really need to see so much of the world at once? Aren't there obstacles and stuff? You can just move parts of the map where the player can't reach initially to a different map.
Combine events!!! You said your buildings are pieces of 48x48 events. Don't do that. Combine the entire building to a new spritesheet and use that new building. If you're worried about event placement, use QMovement and YEP_SpriteOffset and you can literally place an event anywhere you want. Say bye-bye to grids.
 

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
902
Reaction score
380
First Language
English (USA)
Primarily Uses
RMMV
Bit of a personal and/or conceptual problem with one of the suggestions. More specifically, the Ignis plugin which is for MZ (and the OP asked about MV). I doubt with the differences on both ends that it can work for both (though obviously I haven't tested it) but I checked the link and it clearly states that MZ is the intended target.

On a separate note, is there any idea of whether or not someone can write some code to "double buffer" the MV engine, or at least do a multithread conversion? That may be another way in which the performance can be improved but the research that I did has gone way over my head (even by my own standards). And apologies in advance if this could derail the intended purpose of the discussion, but it is a related concern and I'm short of ideas for my own purposes on equivalent grounds so I think it's worth looking into.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Officially not a mod anymore. Thanks for the many years!
Thinking if i should post on the classifieds section...
Made another plugin showcase video! :kaojoy:
(Plugins and details inside the description of the YouTube video.) :LZScheeze:
Ami
Castle is my Biggest Fear :kaodes:. I just Managed make Part by Part (like the Entrance only),not the Entire Castle like in the RM Sample...
This video really speaks to me...

Forum statistics

Threads
104,369
Messages
1,005,890
Members
135,890
Latest member
vaobongdotbiz
Top