EST - SAVE MAP EVENTS (My First Java Script Plugin)

● ARCHIVED · READ-ONLY
Started by estriole 24 posts Page 2 of 2 View original ↗
  1. I just wanted to mention that lately I tried replacing this plugin (including the Event Clone Plugin) with my own 'simple' even copy plugin, and in doing so noticed a MAJOR performance issue that this plugin seems to help reduce substantially. Especially in maps with over 400 events.
    (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);
  2. @Roguedeus, when you say "replace" this plugin, are you saying the script you have provided can be used instead of the EST script, or that it can be used in conjunction with it, to help improve performance?
  3. Shaz said:
    @Roguedeus, when you say "replace" this plugin, are you saying the script you have provided can be used instead of the EST script, or that it can be used in conjunction with it, to help improve performance?



    Sorry for the confusion. What I meant to say is that this plugin, is helping with performance, not hurting. The plugin I started writing, to replace this plugin (thinking that this plugin was causing an issue with performance) actually revealed that without this plugin performance became unplayable with upwards of 400+ events. :)


    I am also using Estriole's event clone plugin as well.


    Estriole is caching map data in such a way that maps with many hundreds of events, even maps approaching the event limit of 999, remain playable. But the proximity check I posted, used together with this plugin, allows me to have an 800 event test map, run at nearly 60 fps. Including the use of Lyson proximity sensors plugin and Hime's Page Conditions. Which add more than the standard event update overhead.
  4. The link has expired, anyone still have a copy of this? please paste here <3