Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [Scripting]Let's Anti Event Lag!, *~Causes & Ways to reduce Lag~*
woratana
post Jan 29 2008, 07:13 PM
Post #1


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Let's Anti Event Lag!
By Woratana [woratana@hotmail.com]
29/01/2008

I believe that most of experienced RPG Maker users definitely have a problem with lag in their game before. There are many things that can cause lag, and they have different ways to decrease its lag. This article will focus in lag that happens by events (which is the simple thing that most of RPG Maker user starts with).

First, we will take a look about what are the causes of lag from events, then I will tell you about how to reduce the lag.


Causes of Lag from Events

1. Parallel Process Events/Common Events:
When you are setting trigger of an event, there is 2 choices that will automatically run. They are "Parallel Process" and "Autorun". Autorun will not affect your game as much as Parallel Process, because Autorun will stop other events before run its process, but Parallel Process will run its process in the same time that other events are running their process. So Parallel Process will run every frame and can cause lag if you don't organize it.

2. Too many events:
The events on map will update all the time, so they can make game lag if there's too many events in one map.

3. Low RAM:
If the player's computer has low RAM, this can make the game easier to lag. I suggest to take a look at RPG Maker's minimum system requirement.

Minimum system requirement for RMXP: http://www.enterbrain.co.jp/tkool/RPG_XP/eng/
Minimum system requirement for RMVX: http://www.tkool.jp/products/rpgvx/eng/

If the player's computer has lower system than requirement, it will make the game easier to lag. The lag that purely happens because of player's computer system is hardest to solve. However, I found out that RMVX game is harder to lag than RMXP game.


Ways to Reduce Lag

1. Add event command "Wait":
This is one of the best ways to reduce lag. At the end of "event command list" in your Parallel Process event, add event command "Wait" a few frames below it. This will make the Parallel event don't run at every frame. I always use wait 1 frame, but it's a good idea to use more than 1 frame in case if that Parallel Process event don't important enough to run all the time.

Don't be afraid that "Wait" a few frames will cause bug in your game system, because there is 40 frames per second in normal RMXP game, and 60 frames per second in normal RMVX game. So this way will normally not disturb your game system a lot.

And it's good idea to put "Wait" only below or top of event command list. It may cause bug if you put it in the middle of event command list.

2. Use Anti-Lag Script:
You may heard or used Anti-Lag script before, and someone may misunderstand that Anti-Lag script can reduce any lag. In fact, what Anti-Lag script does is to stop update event that is not on the screen. However, Parallel Process and Autorun event still update even though they're not on the screen.

The Anti-Lag script will good to use if there are many non-Parallel Process events in map, and keep in mind that it will not help if many events all pack on the screen. It will work best if events are place on different part of the map.

The 2 popular Anti-Lag scripts are Near Fantastica's and Zeriab's. You can find Zeriab's Anti Event Lag System here: http://rpgrevolution.com/script/1/

3. Use Switch/Condition to Control Parallel Process events:

If there is some Parallel Process events that you don't really need it to run all the time, it is good idea to run/stop it by switch, so you can control when it should run and when it shouldn't. This will probably decrease lag if you turn it off in appropriate time.

The other way to make events not run all the time is make condition. For example, do something if variable [hp] lower than 10, or do something if player press button C. This will make the event don't have to process its hard work every frame. And I suggest to add "Wait" a few frame under the condition branch.

4. Try this easy & short Anti-Lag script:

I found the Easy-setup Anti-Lag Script by Angelix that I think it will help a lot. This script works different from normal Anti-Lag script that I considered before. What this script does is it will stop update events that you use for decorate map. The "event for decorate map" means the event that has no reaction with the player (for example, the tree that use character set).

Angelix's Anti-Lag Script and How to Use
1. Go to Script Editor, in Game_Event. Find this lines:
CODE
attr_reader   :starting                 # starting flag


Add this line below it:
CODE
attr_reader :event


2. Go to Game_Map, find these lines:
QUOTE
for event in @events.values
event.update
end


Replace line event.update with:
CODE
event.update if event.event.name != "#"


3. Change name for all the "event for decorate map" to be #

Finish!

========================================
If there is a question or suggestion, feel free to post~^^


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
sean753
post Mar 5 2008, 03:18 PM
Post #2



Group Icon

Group: Member
Posts: 1
Type: None
RM Skill: Undisclosed




thx alot! tongue.gif
Go to the top of the page
 
+Quote Post
   
zeshiba
post Jun 12 2009, 02:47 AM
Post #3


Level 1
Group Icon

Group: Member
Posts: 12
Type: Developer
RM Skill: Intermediate




For those who are looking for answers of this question
QUESTION-I use (SOMEONE) anti lag script but it does not work..
ANSWER-combine all the anti lag scripts you know I use 3!

anyway thanks woratana


__________________________

YEAH!
Go to the top of the page
 
+Quote Post
   
charbelramy
post Jun 22 2009, 05:28 PM
Post #4


Level 1
Group Icon

Group: Member
Posts: 10
Type: Scripter
RM Skill: Advanced




biggrin.gif thank you


__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 12:15 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker