Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RGSS] [RMVX] Anti-Lag

Yaoumei

Sponsor

Script made by Anaryu. Posted with his permission.
Contact info: anmckell@gmail.com

If you have any questions or concerns, please contact Anaryu, not me!
I did not work on this at all. I'm just an artist, not a programmer.


//---Post by Anaryu---//
//================//

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 4:12am EST: Fixed errors with vehicles, passability, and airship landing.
1.2e (March 18th, 2008): Fixed tileset and passability errors with multi-page events.
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.
1.2h (September 20th 10:35am EST): Added a check so changing graphics on a blank event from another event, or using Show Animation or Show Bubble will activate the event automatically and set it to be in use. Also added two new globals to allow you to choose how far off-screen updates will still be performed (see below.) Also fixed efficiency loss by having several math functions in the on_screen function (called constantly) and moved those to initialize function instead.

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. (8) Lots of events that don't do anything
4. (8) Lots of moving events/characters on a large map (many offscreen at a time)
5. (3) Lots of moving events/characters on screen at the same time

NEW:
You can increase how many squares off-screen the system will update events (see instructions at the top of the script). You can use this to keep large sprites from ghosting on the screen edge.

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!

http://anamei.net/files/images/al/ALScreen1.jpg[/img]
 
THX This is very helpful. :smile: :smile: :smile:
Can i post this script in an german board?
I will say that all credits go to you.

When in fact all credits should go to Anaryu : ) - arevulopapo

Oh i dont have seen it. Can someone say were i can find him?
 

Yaoumei

Sponsor

eugene222":lo65yaz1 said:
THX This is very helpful. :smile: :smile: :smile:
Can i post this script in an german board?
I will say that all credits go to you.

When in fact all credits should go to Anaryu : ) - arevulopapo

Oh i dont have seen it. Can someone say were i can find him?

Script made by Anaryu. Posted with his permission.
Contact info: anmckell@gmail.com


Please don't credit me at -all- for this.
All credits go to Anaryu!

Please feel free to contact him via e-mail.
I will also ask him when he gets home (we're husband/wife).
 

arev

Sponsor

Family business, isn't it? :D Good to have such a script, although the new RM is much more powerfull, so it will handle many times more events than XP.
 

Yaoumei

Sponsor

arevulopapo":vpwkibrz said:
Family business, isn't it? :D Good to have such a script, although the new RM is much more powerfull, so it will handle many times more events than XP.

It still lagged pretty bad. Trust me. I saw him test it.
 

Yaoumei

Sponsor

Newer version released:
Added a big update for efficiency for tons of moving events and character events (doors, NPCs, etc) fixed several potential annoyances and bugs.
 

Zeriab

Sponsor

It was the link for the old version before it was updated. In case of any future updates I would expect the link to stay the same ;)
 

Yaoumei

Sponsor

eugene222":2b4jgsao said:
oh i know i have think, that this was the older version

No no. Every time he updates it with a newer version, he just replaces the file that link goes to. It will always be the latest edition, each time the post is updated.


VGMasterIII":2b4jgsao said:
I seriously feel like strangling you for putting it into a demo and not in the actual post itself.

But, wow.

What are you talking about? And please, strangle my husband Anaryu, not me. :smile:
 
it has still bugs.
For example if i do an event with the graphic in page 1 and then a self switch in patch two and an other grafik,
then the event has both graphics in game.
And there are still other
 

Yaoumei

Sponsor

eugene222":3m7s9rds said:
it has still bugs.
For example if i do an event with the graphic in page 1 and then a self switch in patch two and an other grafik,
then the event has both graphics in game.
And there are still other

Thanks for pointing that out. There's a newer version out now.
 
still some bugs for (me at least)
1 random crash on a loaded game (Stack level too deep)
and I have an event that has a move event for itself, and it doesn't move.
besides that it's working very nice, no more lags on my maps. =)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top