(I have a stress test with 800 Events)
Put simply. If you plan on stuffing your maps with events, you should really consider this plugin to reduce overhead.
For those interested, here is a simple proximity check I make that allows me to keep even my 800 Event stress test playable. (58~60 FPS) Though the actual impact depends on what each event is doing and how often its done as well as the distance used.
Also keep in mind that this will not effect Auto or Parallel page events. This will not help with any performance impact caused by their over use.
(Make sure this is above any other plugins. Feel free to use it however you like. No need to credit me, though it would be appreciated.)
Spoiler
Code:
//RD_EventUpdate.js
//16_0304
//v1.0
//Last:
var RD = RD || {};
RD.EventUpdate = RD.EventUpdate || {};
var Imported = Imported || {};
Imported.RD_EventUpdate = true;
/*
Credits:
Estriole - Clone_Transform_Delete_Events
Note: Change the dist < 16 check on line 28 to whatever you need to make
sure that events update outside your current screen size. The value is
the number of squares away from the players current position on map.
*/
(function($) {
//Replaces events() function in a the below functions...
Game_Map.prototype.proxEvents = function() {
return this._events.filter(function(event) {
var player = $gamePlayer;
var dist = $gameMap.distance(event.x, event.y, player.x, player.y);
if(dist < 16 || event._trigger > 2) {
return !!event;
}else{
return false;
}
});
};
//Overwrite
Game_Map.prototype.refresh = function() {
this.proxEvents().forEach(function(event) {
event.refresh();
});
this._commonEvents.forEach(function(event) {
event.refresh();
});
this.refreshTileEvents();
this._needsRefresh = false;
};
//Overwrite
Game_Map.prototype.updateEvents = function() {
this.proxEvents().forEach(function(event) {
event.update();
});
this._commonEvents.forEach(function(event) {
event.update();
});
};
//==============================================================================
})(RD.EventUpdate);