Anti-Lag VX
#1
RMVX Anti-Lag

Welcome to the second script I've bothered to release, this one is rather unique and fixes the problem that both RMXP and RMVX share: serious lag as the amount of events on a map is increased.

Version History:
1.0 (March 3rd, 2008): Initial version released.
1.1 (March 4th, 2008): Added "DOSPRITE" and "DOLOC" and "DOUPDATE" tag checking from event name to allow users to ensure an event's location (x/y), update function, and/or sprite are created and used regardless of the auto-parsing features.
1.2 (March 5th, 2008): Added a big update for efficiency for tons of moving events and character events (doors, NPCs, etc) fixed several potential annoyances and bugs.
1.2a (March 6th, 2008): Changed screen size check for on_screen function to use Graphics instead of static values.
1.2b (March 7th, 2008): Changed Game_Player to use the standard set/get functions and changed check for empty array to use emtpy? function.
1.2c (March 10th, 2008): Updated events that used a tile and a character on multiple pages to be drawn as a sprite correctly. (eugene)
1.2d (March 14th 2008): Fixed errors with vehicles, passability, and airship landing.
1.2f June 9th 4:34pm EST: Fixed errors with diagonal movement having the turn_ok setting passed in while the original functions didn't use it.
1.2g June 20th 7:49pm EST: Fixed bugs regarding diagonal movement for events (last update was just player!) and fixed bug with jump function not updating location.

How to use it:

To use it, just copy the "AS: Anti Lag" from the Script Editor to your own project below "Materials" (you know the drill!)

What this will help with: (and a rating on a scale of 1 (a little) to 10 (complete elmination) of how much it will help)

1. (10) Lots of events used as tileset graphics (event graphic is a tile)
2. (10) Lots of events that don't have a graphic but do something
3. (6) Lots of events that don't do anything
4. (3) Lots of moving events/characters

NEW: If you have any scripts that use an event based on a comment and do so with blank events, for example a jumping script that keeps players from jumping over any squares with a blank event with a "NOJUMP" comment or such, you can use these special tags to ensure the system isn't ignoring those events.

Put the tag in the event's name box: (can have all three together)
DOSPRITE: Ensures that the event will have a sprite regardless.
DOUPDATE: Ensures the udpate calls will always be called.
DOLOC: Ensures the events location is recorded.

If you wanted all three on at once, an event name could be: Door5DOSPRITEDOLOCDOUPDATE or Door3DOSPRITE-DOLOC-DOUPDATE, etc.

If you're not sure what good these are, you probably won't need to use them!

Anything neat?

You can now paste as many events that are single tiles (not characters, but map tiles that don't change) and have NO extra lag (it acts like a third layer instead of an event).

How it works for scripters:

For those with scripting knowledge, this first takes the awful loop out of everything (no more for event in $game_map.events) and instead uses a hash to track event locations.

It will take all events that are tile graphics that don't change (either all pages are the same or it only has one page) and create another tilemap and add those events and set them to not generate a Sprite (events become another layer instead of X amount of sprites to be updated.)

It also takes all events that never have a graphic, and eliminates the creation of a sprite (big efficiency gain).

It takes events that are never run and only have comments (to support other scripts that require comments on events) and will ignore the update command on them.

(It also combines all of these gains, so a blank event with a comment on it that is just used to say display a particle or mark something will work but not cause the system to process it or create a sprite to process.)

Disclaimer:

I've done some testing with this, but it's only been light testing and the changes are pretty low-level, so please report if this is causing weird conflicts, I will try to keep this one supported a bit, but I also will NOT promise compatability with other scripts. (This might be a non-issue thanks to VX's amazing organization of script methods.)

Download:
http://anamei.net/files/AntiLag.zip

Screenshot:

This image is of the "lag" on a map 25x25 filled on all squares but 1 (player start point) with events that have a single tile set for their graphic as well as a moving character and a couple test chests. (Total of 624 events on the map)

The map the kid transports you to has 221 Parallel events that do nothing but Wait 1 frame over and over.

If you want to see the difference in lag, make a copy and then delete the "AS: Anti Lag" script and then run the game again to see what your standard FPS is without it! Winking

[Image: ALScreen1.jpg]
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Victor Engine - Anti Lag Victor Sant 0 4,681 08-04-2012, 01:41 AM
Last Post: Victor Sant



Users browsing this thread: 2 Guest(s)