What's up, RMers?
Anyone with RMXP wanna give this anti-lag a try?

Part1 - The mostly Custom Code
Part2 - Mainly Game_Map's update edited
Part 3 - Mainly Spriteset_Map's update edited

Just tinkering with it, but I personally get at least a FPS of 38 out of 40 with the 900+ events in the anti-lag demo I cobbled together for the Zeriab posts. Faster than Near Fantastica's or Amaranth's too it seems.

It doesn't have all the bells and whistles (ie defining certain events that are always/never updated, enable/disable antilag).... But its a start, and its pretty much not altering the RMXP game variables.

DO NOTE: It does rewrite the update methods for "Game_Map" and "Spriteset_Map". But I sure as heck identified where the changes are made. And I kept with RMXP SDK names for the methods that cycle through and update the events/characters.



Rather than repeatedly re-acquire the minimum and maximum x/y coordinates where your player character is standing (typical with 'in_range?' like methods), it only grabs the coordinates IF you moved. So instead of it performing a dozen calculations just for the boundaries before even testing if the event(s) are in/outside the area, it runs a test to see if the player's X, Y and/or Map had changed... much less processing if you're not moving at all.

I kept values marginally unique with prefixes of @antilag of al (short for anti-lag) in variable names.



EDIT: Oh, gawd. I added two lines so I could have an RMXP switch to turn on/off anti-lag; one simple line in the config system, and one line for the simple 'if its on' bypass.

Turning the Anti-Lag off in that ridiculous 900+ map dropped the 38Frame rate down to 23!!! Yeah, I know without a DOUBT the anti-lag is working.

EDIT 2: Oof. Well, I added a sort of name tag for events so they can always be active on the map even outside your view when all others are limited by the anti-lag system. It seems to start dropping the FPS when you hit 200 events. Quite confusing to me. But... 200 events being fully active no matter when when everyone else is limited by the anti-lag is still a lot.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply
Okay, I have a consistent 38/39 frame speed with the anti-lag I'm working on. 

It only gets borked when you use commands to flag over 100+ events to either "IGNORE" the antilag system and be active outside of view or "INACTIVE" which means that they don't update and are essentially glorified tiles.    I mean, you have to actively flag these... and I am saying you need to have over 100 flagged events before you may notice a frame rate reduction.  Though... hitting 500 events being flagged and there will be more noticeable drop in the FPS.  Comically, its worth turning the anti-lag off by that point.

By flagging, you can add a special character to an event's name.

EV001
EV002[Bork]
EV003[Bork]
EV004

Yep, you can add a custom phrase or special character IN the name. It doesn't need to replace the whole name as some others.

And unlike Near Fantastica's, I now have it recognize when an event has been given a "Move Route" by way of an Event Command.  If it is given an event command, it will move about regardless of being within the visible area or not. Do know I mean the [Set Move Route] event command within the "List of Event Commands" and not a cursory [Fixed/Custom/Random/Follow] route setting.

I saw another script do something similar, but it did not consider (1) that the event must update at least 'once' for the move route to take effect, and (2) to deactivate the feature when the route is done (repeat-when-done notwithstanding).

It might not be as Frame Rate saving as a couple I know, but it doesn't change, alter or (gasp) bypass/erase either the Game_Map @events nor Spriteset_Map @character_sprite variables.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply
Performed some minor updates to my working Anti-Lag, though I had encountered the ever loving "Step-Forward / Step-Backwards" scenario.

Trying to perform some cleaning and streamlining, my antilag went from a 38 FPS down to a 35fps rate.  While it visibly didn't affect the motion or reaction within the game map, it was still greatly unacceptable. But the thing is, the cause was rather strange.

My initial work that held an average 37-38 frame rate with 998 tiles used the following code to ensure that  Auto-Run and Parallel Process events were exempt:

    return true if obj.trigger == 3            # Permit for autorun
    return true if obj.trigger == 4            # Permit for parallel


However, I attempted the following in its place:

    return true if [3,4].include?(obj.trigger) # Permit for triggers

Who would think that one command using the include? method in the Array class would cause more lag? But it does as it comically takes more processing time than two simple if...end blocks.

It does.

Be that as it may, and some more cleaning up, I added a simple little test command.  

While you might not think it may happen, I would not put it past anyone to accidentally flag an event "ALWAYS" update even when not in the player's view and "NEVER" update which would effectively turn an event into a glorified tile.  That would be an issue indeed.

So I added a single method that will, upon entering any field map, check to see if any events contain both flags and generate a pop-up display indicating the IDs of the so offending events.



My current config setup for the script.   Blushing + Cheery

module AntiLag

  # VIEWPORT TILES
  # ==============
  # Understanding that an additional Resolution Script may be used to change
  # the game window's size, it's here where you set the size of the player's
  # viewport in tiles both width and height.
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  TILES_HORIZONTAL = 20
  TILES_VERTICAL   = 15

  # VIEWPORT BUFFER
  # ==============+
  # Because the player is moving across the map,  it should be accepted that
  # events should be  active and functioning  before they are visible in the
  # player's viewport.  It is here that you set how far outside the viewport
  # in tiles where event activities are permitted.
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  BUFFER_SIZE = 2

  # DISABLE SWITCH ID
  # ==============+==
  # This determines the RPGMaker XP Switch  that lets you enable/disable the
  # anti-lag system with a simple [Control Switches] event command.
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  DISABLE_ID = 4

  # EVENTS ALWAYS ACTIVE
  # ==============+=====
  # This establishes a custom tag  that can be placed within an event's name
  # allowing it to update even if off-screen. OR set to nil if there's none.
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  EVENTS_ALWAYS = nil #"[Alw]"

  # EVENTS NEVER ACTIVE
  # ==============+====
  # This establishes a custom tag  that can be placed within an event's name
  # preventing from ever updating.. OR set to nil if there's none.
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  EVENTS_NEVER = nil #"[Nev]"

  # EVENTS CONFLICT TEST
  # ==============+=====
  # Essentially, this will bring up a pop-up window upon entering a map when
  # any events contain BOTH  the "Events Always' and 'Events Never' which is
  # an obvious accidental error. It will report both the map ID and name for
  # reference and a list of all event IDs that have this issue.
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  EVENT_TEST = true

end

Have you seen anything more self-explanatory and understandable? 

Don't answer that.  Laughing + Tongue sticking out



And I'm contemplating two things for development

  1. Event command calls to add or remove the "EVENTS_ALWAYS" / "EVENTS_NEVER" flag while running, though it would likely reset each time you enter the map.
  2. The ability to read flag-applying comments from the Event's "List of Event Commands" page, which would allow different flag conditions per page. Though an additional script call would be needed to ensure any such event with such would be able to update.

Yep, I try to consider eventualities.  Winking
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply




Users browsing this thread: 43 Guest(s)