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,418
Reaction score
671
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,404
Reaction score
4,801
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 Profile Posts

So I just spent the weekend...playing my own game. The one I released last year. Yep you heard that right.
Goal for MZ? None... I'm still curious how to finish my VXA project and how it looks like when it actually finished. Which will take at least another two years. Coming late again to the party.
Finding it amusing that people are posting support questions in new threads for an engine that isn't even released yet. Touch and Archeia are the only ones authorised to say anything, and there's only one active thread where they'll be answering questions.
I think my goal for MZ ... is to actually release a game and not have twenty technical demos and debugging projects. Let's see if I can manage that. ;o
I am starting to enjoy writing. I never thought I would enjoy it since my dyslexia was holding me back so much.
Thanks to the community here :)
For those interested chapter 2 and 3 are available to read here:

Forum statistics

Threads
100,652
Messages
978,095
Members
132,260
Latest member
enciasduras
Top