Various questions on parallel processes(MV)

Sauteed_Onion

Mmm Tasty
Veteran
Joined
Dec 13, 2017
Messages
554
Reaction score
3,665
First Language
English
Primarily Uses
RMMV
Ok I'm learning the basics in a reasonable way for me, so far.. but I'm wondering, what are they and why do I need Parallel Processes.

I understand they are taxing on the machine and make the game "lag", but "why?" is what I want to know.

Also what exactly is the point of a parallel process and why do I see so many people talk about them, either for the lag they cause or the other stuff I see people talking about?
I tried searching the forum and found 0 threads titled Parallel Process, and found snippets of parallel jibberish here and there, but I just want a massive unloading of parallel info dumped out right in here if possible. Or a youtube video suggestion if possible.

I've seen Echo607 I think it was make a cool effect with a parallel process but she didn't really explain anything about it, and said it like lightning fast. And a few "random" videos by some random.. dude.. meow, had a few mentions of doing stuff with a random parallel process, but they always just kind of briefly say it, then nope no more. Meow.


TLDR;
What is a parallel process?
Why do people use Parallel processes if they cause lag?
Why use them in the first place?
What can be done with them that other triggers don't/can't do.
Meow?
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
These are good questions.

A parallel process event runs every frame. Typically, this means that it runs 60 times per second.

You could have a parallel event that tracks the position of the player and maybe some other events (for a classic boulder-pushing puzzle, for example). Maybe if the player, or the boulder are on the switch (located at x = 37, y = 14) then the spikes get disabled.
Here is a sample event code:
Code:
Control Variables: #0001 = Map X of Player
Control Variables: #0002 = Map Y of Player
Control Variables: #0003 = Map X of Boulder
Control Variables: #0004 = Map Y of Boulder
Conditional Branch IF: Variable #0001 == 37
    Conditional Branch IF: Variable #0002 == 14
       Control Switches: #0001 Spikes Active = OFF
    End
End
Conditional Branch IF: Variable #0003 == 37
    Conditional Branch IF: Variable #0004 == 14
       Control Switches: #0001 Spikes Active = OFF
    End
End
Even though this parallel event is running 60 times per second, you are not likely to encounter lag. This is because what it is doing is simple enough to run incredibly quickly.

If you use a parallel event with more graphical things (like loading pictures/changing sprites) you are more likely to encounter lag.

Generally, you only want to have 1 parallel event active at any given time. Otherwise, it can be too hard to find the bugs in your eventing if multiple things are happening all at once.
 
Last edited:

GrandmaDeb

Modern Exteriors Posted!
Veteran
Joined
Apr 25, 2012
Messages
4,467
Reaction score
2,942
Primarily Uses

Sauteed_Onion

Mmm Tasty
Veteran
Joined
Dec 13, 2017
Messages
554
Reaction score
3,665
First Language
English
Primarily Uses
RMMV
Yay thanks @Aloe Guvner Yay ALSO thanks @GrandmaDeb .. Here is another question..

If I make a parallel process on a map for let's say a dungeon, and I leave the map and go to town, will that parallel process going on in the dungeon be affecting the stuff in the rest of the town?
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
Events on maps are only active while that map is active. If the player moves to a new map, then only the events on the new map are active.

There is another kind of event called a Common Event which is not bound to any particular map. The Common Events can be configured from the Database. There are 3 possible triggers for the Common Event:
  1. Parallel (will run continuously in parallel if the given Switch is ON)
  2. Autorun (will run immediately if the given Switch is ON)
  3. None

  • The Parallel and Autorun triggers are exactly the same as their on-map cousins as described in the tutorials GrandmaDeb has linked.
  • The No Trigger events can be triggered from other events (either on-map or Common) on the 1st page of Event Commands, bottom-left.

There are infinite possibilities from this. Any complex event that you might use more than once, consider making it a Common Event.
For example I do all of my map transfers as a Common Event. Why? Because if I decide to make a fancy transition graphic halfway through development of the game, I only need to apply it to the Common Event, not to the hundreds of transfer events that are on the various maps.

The downside is when finding bugs in your events, it could be hard to visualize the interaction between on-map events and Common Events in your head.

Common Events are both more dangerous and more useful because of this.
 

NaughtyScales

Villager
Member
Joined
Jan 4, 2018
Messages
15
Reaction score
6
First Language
Ukrainian
Primarily Uses
RMMV
Yay thanks @Aloe Guvner Yay ALSO thanks @GrandmaDeb .. Here is another question..

If I make a parallel process on a map for let's say a dungeon, and I leave the map and go to town, will that parallel process going on in the dungeon be affecting the stuff in the rest of the town?
As far I know parallel events are start work when you enter (where you place them) to map and stop when you leave, to transit results of map you must use global Switches or Variables. So if you implement day/night, every map must have event that track the time. As far I know.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I have not read through all the responses, so no doubt I will be repeating some things, but hopefully I'll also add some new things.

It's all about event triggers. An event can have 5 different triggers. Action button means you need to walk up to the event and interact with it (press space or enter) in order to trigger it. Player touch means you just have to bump into it or walk onto it (depending on the priority) and it will trigger - you don't need to use the action button. Event touch means you just have to bump into / walk onto it, OR it can bump into / walk onto you, and it will trigger.

The two remaining triggers cause the event commands to run automatically, without any initiation from the player/event touching/interacting. Parallel process means the commands will run in parallel with - at the same time as - other events. It is a "running behind the scenes" things, that will allow the player to do other things, or for other events to run, at the same time. Autorun events "take over" the game and do not allow the player to do other things for the time they are running.

Parallel and autorun events will start running the moment their conditions are met, and will continue running as long as the conditions are met. This means if there ARE no conditions, they will run for the whole time the map is loaded. Under most circumstances, you would not want that to happen. You would want it to run and do some things, and then to stop. You can stop it by using the Erase Event command or by adding a second page with an Action Button trigger and some condition (usually a switch or self switch), and at the end of the autorun/parallel event page, enable the condition that activates the second page.

When to use them? Autorun events are good for cutscenes, when you want the player to just sit back and watch, and not be able to wander around or open the menu. Parallel process events are good for setting things up on the map that you don't want the player to see, when the map is first loaded (playing a certain BGM depending on conditions, setting up or removing weather or screen tints, moving events to certain locations at different parts of the story, etc).

How to turn them off? If you only want the event to run once, ever, even if the player leaves the map and comes back, use a self switch with a second page conditioned by that switch. If you want the event to run every time you enter that map, use Erase Event.

What causes lag? Lag is caused by parallel process events that are not turned off - they continue running, looping by default, for the entire time you are on the map. But it's only events that haven't been well written, or have a lot of processing. Think about what you're trying to do ... if you want to check for a condition every time the player has taken 20 steps, then 20 steps aren't going to happen 60 times every second. It won't even happen once every second. How long would it take for the player to move 20 steps - maybe 5 seconds? That's 300 frames. So put a Wait 300 frames at the end of the event, and it'll wait that long to loop and repeat its process. If you want to monitor for when the player equips a certain weapon, again 60 times a second (once a frame) is overkill. Make it wait 60 frames at the end of the event, then your event commands will only run once per second. Even a 5 frame wait will greatly reduce the effects of lag.

All of the above is talking about events you put on the map. They will run on that map and will stop when you go to another map. However, common events can also be set to autorun or parallel process, and in those cases they must be conditioned by a switch, and will only run while that switch is on. Common events run over all maps, so if you have a parallel process common event that's activated, it will continue running, even while you change maps, until you turn off the switch that triggers it. The above examples, when you're checking something after every X steps or monitoring for a particular weapon to be equipped, would be set up as common events unless you only want to do that on a particular map. That just means you don't have to set up the same event on every map. Common events with an autorun or parallel process trigger also loop by default, and you must turn off the switch in order to stop them from running.

So when you're thinking about creating one, ask yourself if it's something you want to run just on this map, or on all of them (ie - is it going to be a map event or a common event)? Is it something you want to run right at the start of the map or when a certain condition is met, go through the commands once, and then turn off, and do you want it to run again when you leave the map and return (ie - will you use Erase Event to end it, or will you use a new event page and make it active)? Or is it something you want to run continually (ie - no erase event or activating a new page)? When it runs, do you want the player to still be able to do stuff, or do you want to remove control from them for that time (ie - will it be parallel process or autorun)? Then, if it's parallel process and is not going to be turned off, have a good think about how often you want it to happen, and set your wait time at the end of the event accordingly (60 frames is 1 second, so if you want to check twice a second, the wait will be 30 frames). Note - if you have a condition in there somewhere, make sure the Wait is OUTSIDE of the condition - you generally want it to wait on every iteration, not just when the condition is true, or just when it's false - if you only put the wait into the true or false blocks, then you could still have the lag issue.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,569
Latest member
Shtelsky
Top