Multiple parallel events, bad idea?

mishakoc

Professional Procrastinator
Veteran
Joined
Jan 1, 2019
Messages
143
Reaction score
871
First Language
Czech
Primarily Uses
RMMV
As a good practice, you should keep your parallel events to a minimum, I'm aware of that. I just wanted to ask how you'd go about using multiple ones and how badly can it affect your game performance. I know it's hard to say how a certain number would impact the performance so I won't ask something like "how many parallel events at maximum can you use".
I'm thinking about using a number of common parallel events in my game, sometimes combined with the ones in the map but since I don't need them to fire 60 times a second, I tend to add wait commands (generally between 30 and 300 frames). Would you say that's enough to escape the danger of lag if there are multiple parallel events going on? Is there something else I could do? What's the best practice regarding writing parallel events?
Thanks! :)
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,542
Reaction score
869
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi!
The thing is, it depends on what your parallel event is executing. This is the crucial part that will determine if it will lag or not.
So I don't think there is an answer to that since you already know that:
As a good practice, you should keep your parallel events to a minimum, I'm aware of that
and that:
I tend to add wait commands (generally between 30 and 300 frames)
I would say that the best practice in program, so in events, is to avoid executing code all time when you don't need it.
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,480
Reaction score
4,948
First Language
English
Primarily Uses
RMVXA
It depends on what your events are executing like @Eliaquim said (a variable change every 30 frames is a lot different than a graphical effect or several thousand loops through a complex script block). But also, be aware that even moderate numbers (10-20) of parallel events running at once can take the performance of a computer with low to medium processing power - especially if you're also using scripts or plugins that require some processing. I've personally found MV to be worse than Ace for this kind of thing.

Wherever possible, run processing only at the moment that you need to. For example, if a maze minigame gives different rewards when completed based on the number of Steps you took while playing it:
  • You could run an event that checks the Steps counter every 20 frames to see if it's different than the last Steps counter and if so, increases a variable and re-calculates the reward if necessary
  • You could have invisible events that trigger a common event that increases a variable and re-calculates the reward you'd get each time the player takes a step
  • You could simply store the Steps counter at the beginning of the minigame and check it at the end of the minigame, subtracting one from the other and calculating the reward based on the steps taken
The third approach is by far the most efficient in terms of not risking your game's smooth technical performance.
 

mishakoc

Professional Procrastinator
Veteran
Joined
Jan 1, 2019
Messages
143
Reaction score
871
First Language
Czech
Primarily Uses
RMMV
Thanks for your answers!
The parallel events in my game are nothing complicated (for now), mainly getting player location, region IDs, distance from certain events, and such, changing them when necessary. Visual gauges. (Also for initializing the maps but in those cases they only run once before I erase them.) I try to avoid parallel processes when it's possible because I know they can cause lag sometimes.
The reason why I asked is because I was thinking of adding several parallel processes that would be used for graphical changes as well - time/weather, idle poses, blinking, and so on. These are obviously not necessary for the game but would be nice to implement. However, I wasn't sure if they wouldn't be too taxing alongside the other ones.
@Wavelength makes a fair point, especially since I'm using a bunch of plugins alongside that. I'd probably add a switch and an option in the menu to disable the ones that only cause minor graphical changes that don't add anything to the game except aesthetics.
I'll keep your suggestions in mind, I appreciate the example given. :)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

12 done, 4-5 started. Now that the weekend is over, things will sloooowwwww down again proabably.
when you're completely done with someone's crap lol...
Ami
--- Survival For RPGist Part 3 ---

F.Healer: Here it is,I made the Simple Sandwich
Survivalist
: it's so Delicious!
Chef: Here you Go! My Gourmet Steak.
Survivalist: It's Super Delicious,Too!
F.Mage: I Made it for you!
F.Healer: Uhh...Charcoal?
F.Mage No,It's a Toast!
Chef: Did you Let it in 10 Minutes?
F.Mage: Maybe?
I had a birthday party earlier today. No-one showed up. ;_;

Forum statistics

Threads
103,032
Messages
996,808
Members
134,508
Latest member
juegostudios
Top