RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RESOLVED] event lag?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 87
okay, In my game, the first town has a bazaar, right? well, that means LOTS of people, right? :(
so, that also means am @$$ load of lag. :tpg:..I used ABSEAL and verything, but it still lags to death! >:(

Anyone know how I can reduce this damn lag? :-\
« Last Edit: August 04, 2007, 09:32:21 AM by Zeriab »

***
Rep:
Level 87
????
If its xp use an antilag script if its 2003 at the begining make and event that makes things faster

***
Rep:
Level 87
thanx
but ABSEAL is the BEST anti-lag script.

***
Rep:
Level 87
????
ANOTHER SULOTION ok use the speed up thing in the beging of the game (it will be a little bit laggy but..)

***
Rep:
Level 87
speed up...thing? what do u mean?

i made less characters move at random, and stay fixed. That reduced it a ton, but only a few move now and it still lags a but...i don't want no one to move, i mean, it's a freakin bazaar!

***
Rep:
Level 87
????
Ohmygosh lol the speed up thing is in your move event thing =)

***
Rep:
Level 87
That just speeds up walk speed...the lag I'm suffering from doesn't slow me down, it glitches and slows the whole screen down.......hmm...

I might have to get rid of a few people...I guess bustling cities filled with wild crowds are just a little too much for the old RMXP...huh, wonder why I never thought of this before....all the people that aren't doing anything, are as good as a tiles, right?

Well, tiles don't slow the stupid thing up!!!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
http://rmrk.net/index.php/topic,1121.0.html

landofshadows made a few crowd graphics. That should give the impression of a lot of people bustling about, but it only uses one event.

***
Rep:
Level 87
true...well, I have also used the idea of replacing most events with tiles, and has improved lag greatly! this crwod thing'll help, too.

wow, i must be tired, my grammar is suffering......well, thanx for the crowds! they didn't solve the lag problem, but they made my bazaar like time square!

also, after copying the map on a new project w/o any events at all, i have discovered it is probably my laptop. My character as moving almost full speed, but the screen was stll laging and glitching. Adding events really actually didn't change ANYTHING. Very minor changes, that is.

Well, tomorrow i'll send a link for my map, and I ask that someone test it for me for lag, to see if it really is just my crappy laptop.
« Last Edit: August 03, 2007, 05:27:51 AM by da good king »

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
If you have too many events on the visible part of the map it'll lag pretty much regardlessly of the anti event lag script used.
I am afraid the reason is due to bad engine design. If it is this, then there is nothing you can do. We might be able to speed other things up though.
I do have an idea for anti event lag script btw. You would need a scripter to do it ^_^

Spoiler for Idea:
The principle in my idea is not to optimize the current design, but instead to alter the design.
I would instead map the events accordingly to their coordinates.
We could for example do something like this:
Code: [Select]
$game_map.map_events = {}
$game_map.map_events[[x,y]] = event
# or
$game_map.map_events[[x,y]] = [event1, event2]   #so there can be more than 1 event on that tile
Naturally I would implement it in the Game_Map class; it is just to give the idea.
I am not saying that using a hash in that way is the most efficient way, but it is conceptually easy to understand.
Perhaps it would be better to encapsulate the map of events in a class, I am not sure.

Think about how fast collision detection becomes.
If a event moves to the left it is simple just to check what is in $game_map.map_events[[x-1,y]]
This is much much faster than the naive collision detection that is in the original scripts

Another bonus is which events to update.
Just check for events in the visible part of the map and a buffer (a tile or two outside the screen) in the hash-map. Update the found events.
You won't event process outside events.
An added bonus of this is that the size of the map is irrelevant when updating the events.
The cost is simple just more ram usages.
The speed is dependent on how many events are visible.

We can take this and go even more advanced. Why should events outside of the screen have sprites?
Sprites will slow down the game significantly even if they are outside the screen.
1 or 2 sprites make no difference, but what if you have a 500x500 map with loads of events?
500 sprites outside the screen... I think you get my point.

We can do some tricks to make the adding and removing of sprites faster.
We only have to consider which events move into the buffer and out of the buffer. This is why I wanted a buffer previously. Otherwise the player might notice the events blink in and out.
If the player moves to the right then we should consider the new 17 or 19 tiles that comes into the buffer and create the sprites for the events there, while removing the sprites for the tiles going out of the buffer.
Naturally we will also have to check when events move whether or not the go inside or outside of the buffer/visible area.

 ~ Zeriab

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
That's a great idea for an anti-lag

***
Rep:
Level 87
those are very good ideas Zeriab. I must say I was thinking of things similar myself a while back. Perhaps we should post ur idea as a script request?
Events outside the screen was the first thing that came to mind, since my city IS 61x90, (not TOO big) and even when I'm on the outskirts of town where there is little more than one person, the screen still lags just as much.

unfortunately, in my case, as I have said, the same map, with NO events (and even some demos I've tried) lag incredibly on my laptop. So I'm not sure I'll ever be able to banish lag from my laptop.

Also, could someone test for and tell me if it lags on their computer?
the map
the tileset

just to save time, I didn't upload the the tileset data or scripts for messages, so...too bad.

I'd really appreciate if someone could tell me if this works.

*
A Random Custom Title
Rep:
Level 96
wah
Spoiler for Idea:
The principle in my idea is not to optimize the current design, but instead to alter the design.
I would instead map the events accordingly to their coordinates.
We could for example do something like this:
Code: [Select]
$game_map.map_events = {}
$game_map.map_events[[x,y]] = event
# or
$game_map.map_events[[x,y]] = [event1, event2]   #so there can be more than 1 event on that tile
Naturally I would implement it in the Game_Map class; it is just to give the idea.
I am not saying that using a hash in that way is the most efficient way, but it is conceptually easy to understand.
Perhaps it would be better to encapsulate the map of events in a class, I am not sure.

Think about how fast collision detection becomes.
If a event moves to the left it is simple just to check what is in $game_map.map_events[[x-1,y]]
This is much much faster than the naive collision detection that is in the original scripts

Another bonus is which events to update.
Just check for events in the visible part of the map and a buffer (a tile or two outside the screen) in the hash-map. Update the found events.
You won't event process outside events.
An added bonus of this is that the size of the map is irrelevant when updating the events.
The cost is simple just more ram usages.
The speed is dependent on how many events are visible.

We can take this and go even more advanced. Why should events outside of the screen have sprites?
Sprites will slow down the game significantly even if they are outside the screen.
1 or 2 sprites make no difference, but what if you have a 500x500 map with loads of events?
500 sprites outside the screen... I think you get my point.

We can do some tricks to make the adding and removing of sprites faster.
We only have to consider which events move into the buffer and out of the buffer. This is why I wanted a buffer previously. Otherwise the player might notice the events blink in and out.
If the player moves to the right then we should consider the new 17 or 19 tiles that comes into the buffer and create the sprites for the events there, while removing the sprites for the tiles going out of the buffer.
Naturally we will also have to check when events move whether or not the go inside or outside of the buffer/visible area.

 ~ Zeriab
Tl;dr. Anyone mind summing it up for me? I read a bit but I was overwhelmed.

***
Rep:
Level 87
he's saying to correct a few stupid mistakes the program has, such as keeping track of events you can't even see.

Well, just tested my again, and.......it's fine. laptop must have been fried yesterday from all the work I've been doing. Even with all the crowd events, it's working!
thanx all! think I'll call this one resolved.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Lol, I'm glad that it works now, whatever the reason was for it lagging before.

I am too lazy to do the script myself  ;9
Maybe I'll try to get Blizzy to do it. He is not as lazy as I am.

***
Rep:
Level 87
laziness is a mental illness, i swear to god

i suffer from a ba case of it...