Lag and parallel process

which is less efficient?

have 4 common events with 10 lines each and parallel process? or 1 common event with 40 lines and parallel process?

Thank you.
Others who know more than me will be able to answer your specific question. I do, however, know which option I would prefer to debug!
I doubt that it makes a noticeable difference either way, but it might, depending on what the "10 lines" are, and what you are doing overall. If you told us (or showed us some screenshots of your event editor) exactly what you're doing, that would probably get you a better response.
not entirely sure, but I believe if you have multiple parallel events they're sent for processing in parallel, one event's list being intercut with the other.
meaning, the processor will have two tasks half finished rather than one task done and forgotten, and another queued and active.

so, by a hair, one parallel process might be quicker than two.

I've been out of touch with the code lately, so don't take it 100% certain, but I do remember the structure of the common events and they all require their own interpreter object to be created at run time, which is cleared after the event is done.
so... the more events, the more objects there are, and the more the processor is spread across them.
go to the interpreter object and you'll see the core loop deals with the contents of ONE event (itself!) and then deletes itself.
the "parallel" part is only "parallel" because that main loop relinquishes control to the main program at every pass, and that main program uses that time to deal with another loop.
Hi!
In the end, it really depends on what your parallel events are doing.
Someone already asked a similar question, I believe there is more, but I remember this topic here.
It depends entirely what those "10 lines" are. The important question is "how often do I need to do <this thing>"? 60 times a second? 6 times a second?

Tell us what their purpose is and if they're all the same, and we'll tell you if it makes any difference.
Unless those 4 processes need to run under different specific timings or triggers, you'd probably want to run them as one. Performance-wise, it shouldn't make much of a difference either way.
Unless those 4 processes need to run under different specific timings or triggers, you'd probably want to run them as one. Performance-wise, it shouldn't make much of a difference either way.

the four common events are running throughout the game.

So, would it be better if those 4 common events became one?
Tell us what their purpose is and if they're all the same, and we'll tell you if it makes any difference.
they are not all the same. they all do something different.

1 checks the current money and takes it to a variable and other things
2. check if the player got any items at any time
3. check if the player got any achievements
4. check the weather and time of day all the time
Interesting thread, in general I never thought of testing so many events simultaneously.

Unless those 4 processes need to run under different specific timings or triggers, you'd probably want to run them as one. Performance-wise, it shouldn't make much of a difference either way.
In general this is the most practical way, to organize things it would be something like this in the RMMV:
Code:
◆Common Event:#0011
◆Common Event:#00012
◆Common Event:#00014
◆Common Event:#00017
◆Wait:10 frames

But in general I think it depends on the version of Rpg Maker, as I assume that the core of each one works differently, I don't know if this is the correct term.

I ran a test to simulate the use of the processor:
00-Map.png

  1. This one doesn't have anything, it's just in parallel process.
  2. It is constantly adding 1 in a variable.
  3. This is what consumes the most, it's an animation that doesn't wait for the end to restart, it causes a lot of lag.
  4. This one despite using a little more of the processor does not influence the lag as much, it constantly switches the image of Picture 1 with no gap between the images, which makes it impossible to see the animation.
In general there was no change in consumption if it was all in one event or 4 separate events.
Attachments contain the number of events used and the type of interval in the names themselves.
they are not all the same. they all do something different.

1 checks the current money and takes it to a variable and other things
2. check if the player got any items at any time
3. check if the player got any achievements
4. check the weather and time of day all the time

all of that can be turned into plugins.
I have similar things running on my end.
nº 3 in my case would be quests, which are tied to all other triggers: end of battle, item acquired, party changed, event interacted with, etc.

you don't need to watch the money 100% all the time, only when it changes.
and it changes during battle, after visiting a shop, or after acquiring an item randomly, which can only be done outside of battle through an event interaction.
it's the proverbial "are we there yet? are we there yet? are we there yet?" question from annoying kids.

this is what is known as "event-oriented" programming, as opposed to "real-time interaction" programming.
real-time interaction is what shapes things like guided missiles and self-driving cars: they *must* check their environment all the time, because both it and themselves are constantly changing
event-oriented interaction only happens when another thing triggers the block of instructions, and then it goes back to a state of rest... like an ATM, or a calculator.
Why would you need #2 and #3 to be parallel processes? You would only give an item or an achievement via an event, so you know exactly when they were obtained. You could add a Common Event call at the time you give items/achievements, so you don't have to be checking all the time. #1 is only going to be needed when you have an event that does something that could change gold, so call that one from those events.

For all of those except maybe the last, you don't need to check 60 times a second, so add a Wait at the start of the common event - even 5 frames, and they will be just fine to run at once, as individual common events. For the last one, it depends on how often you advance the game time - if you are updating something every frame, it shouldn't have a wait. But if you're only updating the weather and time of day once every minute or something like that, you've probably already got a wait in there.

Original thread: https://forums.rpgmakerweb.com/threads/lag-and-parallel-process.141197/