Question about avoiding future lag.

Status
Not open for further replies.

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
My game has no random encounters, and I've made a respawn system off of counting variables.

With each monster requiring a variable being counted, will this cause lag in the future when my monster count reaches into the hundreds?

edit: I've considered having every monster run off one timer, but I'd like to avoid having monsters come back all at once, and more based on time killed.
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
A variable counter shouldn't cause much of an issue no matter what it holds. It's just a number, and programming languages (like Ruby) depend on the quick changing and comparison of values for speed, so it shouldn't cause any issue.

As for the timers, it may make a bit more of stress on the game to run them, but it really shouldn't be anything bad.
 

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
I guess the problem would be having ~100 variable counters counting at all times even when not in the current zone. This won't lag with all other game processes working away?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Yes you're going to run into performance issues.


Most people lag just by having 100 events on the screen that aren't doing anything (so it's just a sprite update every frame).


Imagine sprite update along with the game interpreter running?
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
As Tsukihime said, having one counter for each monster will create a larger lag.

However, there are ways around that with a bit of planning...

Only events on the current map can lag. If you keep the maps small enough that there are less than a dozen enemy events per map, then the lag problem isn't as bad as if you're having a hundred enemies on a large map.

You don't need every monster to reappear on a different time. I agree that the monsters of one map (and perhaps the monsters of adjacent maps) should not appear at once, but having 10 counters and reuse them for monsters on different maps or that are far away from each other should be enough. That works because you don't have to remember the exact time a monster was slain - the player won't remember that this specific monster was slain twenty seconds earlier than the time loop for that group of monsters tell them to respawn...
 

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
Thanks for the input. I guess I'll just have map counters cycling from adjacent map to the next, and maybe even shared per map, but less than 10 variables counting at once. Thanks for the help :)

edit: I have a further question.

Does anyone know of a simple way for an event to track a variable from a seperate map?

IE: my variable strikes 0, im in a house at the time, when I leave it would have reset the variable already and the monster wasn't spawned in. Any ideas?
 
Last edited by a moderator:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,422
First Language
English
Primarily Uses
RMXP
The problem about lag is that you really must test to be certain.

I once played around with the number of variables in the database and had no trouble at all with 100k variables existing. Mind you, most were not used. Only a few was ever used at the same time.

Still... I didn't really encounter any problems until around half a million where I remember game acting funny. This test being in RPG Maker XP we cannot know whether the same

We have data that graphical representation of events is heavy on the performance.

I haven't heard about any performance data on having 100 counters being counted in events. My personal guess is that it won't be particular significant, and furthermore it seems they don't require being counted every frame so you can break down the update to say 25 counters being updated every frames. (Thus each counter is being updated every 4 frames)

I don't have any performance data so be aware that I can be totally wrong. Without testing we cannot know.

*hugs*
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
Does anyone know of a simple way for an event to track a variable from a seperate map?
No, that is not possible because events are only processed on the current map.

I once had the logic to handle such a case, forcing the respawn of the enemy upon entering if the delay was passed while the player was on another map.

Unfortunately it's late here and I can't concentrate enough to remember the exact handling, I only remember that it basically required two additional event pages and one switch per map to make those respawns happen. Perhaps I'll remember tomorrow...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You could use my event timers script to just set a timer and turn on a self switch when a monster is defeated, and when the timer goes off, turn the self switch back off again.


No need for lots of variables, no need for events just to count things. It WOULD mean you could have quite a few timers to check each frame, but it would be limited to only those that are waiting to respawn.


Extended Game Timers
 

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,422
First Language
English
Primarily Uses
RMXP
If you have a variable per monster I guess you could just leave it at 0 or 1 or something like that once it is reached.

Once you go to the map you can then check the variable.
 

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
If you have a variable per monster I guess you could just leave it at 0 or 1 or something like that once it is reached.

Once you go to the map you can then check the variable.
This is currently how I have it set. Though to have the timer checking outside of the map it's something like 

branch

variable timer > 0

control variable timer + 1

branch timer = 60

enemy1=0

enemy2=0

enemy3=0

enemy4=0

enemy5=0

etc.

then in the event page instead of self switch it's checking the variable. end of fight variable set to 1. timer ticks enemy pops back up.

The problem is the way the timer is handled on a parallel process, I'm worried once I get upwards of 200 enemies and it's controlling those variables (or even doing nothing) it will crap bricks

edit: It's running on a common event*

edit2: Shaz that actually looks very helpful. How many timers at once have you tested succesfully?
 
Last edited by a moderator:

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
Shaz that timer works wonders!

This can be closed :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Awesome! If you do get a lot of them running at once and you find it starting to lag, please go back to that thread and let me know :)


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top