Can too many Parrarel Events cause the game to freeze?

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
646
Reaction score
582
First Language
English
Primarily Uses
RMMV
I had someone test my game. I was told by someone here that too many Parrarel Events can cause in game problems.
The test player said that sometimes during the SAME event, it would freeze. And when they tried the event game, it would then work.

For something to NOT work and THEN work doesn't make sense. Thoughts?

Edit extra: No, I do not use Plugins. The game works fine for me.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
Having more events, especially parallel events that are built wrongly can increase the load a lot hence why people tend to suggest minimizing the use of parallel process events
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
646
Reaction score
582
First Language
English
Primarily Uses
RMMV
Oooh okay. So making a bunch of berry events that respawn after 300 seconds is probably not a good idea. =(

I'll just change it to where a seed planted can spawn a random berry instead. That should help the game I suppose...(Removing the Parallel completely from all berries)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
One way to do what you want with minimal parallels is to have 1 controlling parallel process, and control each berry event with a variable instead. So in the control event, you will loop thru all berry variables and reduce/increase their "time". You can then use this time variable as the condition for the event page in which the berry is "respawned*

Putting wait into parallel events also help alleviate the load. For your specific problem, I suggest a wait of 60 frames (1 second) if you havent done so yet.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
646
Reaction score
582
First Language
English
Primarily Uses
RMMV
How would I do that? I have each berry using the same var timer.

◆If:Berry Reset timer ≥ 300
◆Control Self Switch:A = OFF
◆Control Variables:#0031 Berry Reset timer = 0

:Else

:End
◆Control Variables:#0031 Berry Reset timer += 1
◆Wait:60 frames
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
You need to use a different variable per berry.. If you only have one variable, then all berries will respawn at the same time, and the reset time will also not always be what you want because if a berry event is running the timer, it will affect all berries. Lets say you have 2 berry events, one is spawned while one is on the timer.. After 150 seconds, the spawned berry gets picked and goes to timer mode. It will only take that berry 150 seconds to respawn since the timer is already on 150.

Each berry event will also reduce the actual time in your current method. Like if you have 2 berries on the timer page (starting at 0 time at the same time), it will only take 150 seconds to respawn since both of them increases your variable by 1 per run.
 
Last edited:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
611
Reaction score
203
First Language
English
Primarily Uses
RMMV
By freezing, I assume you meant the game stops you from moving, but doesn't actually crash the program. In that case, odds are you have an infinite loop somewhere that's getting triggered. When you have a ton of parallel processes going, it's really easy for one of these to pop up, if you're not careful.

That said, it's almost always better to keep the number of parallel processes going at once to a minimum. I suggest Engr. Adiktuzmiko's suggestion of a single "master" parallel process, with variables keeping track of the individual bushes.

As a side note, having waits in parallel processes can be a lifesaver for performance. Increasing the "berry timer" variables once every 20 seconds is a whole lot less taxing than having them increase every second.

Edit: If you're using this event to keep track of all the berry bushes (or foragables) in the game, I'd recommend making the "master" event a common event, so that it can run regardless of what map you are in. It's also a lot easier later on if you only have to edit one event, as opposed to finding and editing it on a bunch of different maps.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
646
Reaction score
582
First Language
English
Primarily Uses
RMMV
I don't know to be honest if it froze or what. It wasn't even a berry event. Just cutscenes that would freeze and they said they reloaded and then it worked. So I assume it's the berries and all their parallels events IF the player plucked them. I have over 15 berry events in the game.

I think I am going to remove the parallel and make it where the berry can be plucked, planted, watered and randomly turn into one of the three berries.

I also have Day and Night going so that's another parallel that I need to keep.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
With your current setup, if player plucks all 15 berries at almost the same time, they will all respawn in just (300/15) seconds, or 20 seconds because you used a single variable and all of the berry events increases its value..

Anyway if it freezes on a cutscene, it can be a case of a move route that cannot proceed because the path got blocked.
 
Last edited:

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
646
Reaction score
582
First Language
English
Primarily Uses
RMMV
Okay. So there is no way to do what I want so I will remove it. Thanks guys.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
611
Reaction score
203
First Language
English
Primarily Uses
RMMV
If you do still want to keep the berry growth parallel process, here's how I'd recommend setting it up:

In total, you'll need 1 common event, and as many variables as you have berry bushes.

Firstly, the bush itself. Create an event, and call it bush1. The bush event will need 2 event pages.
The first page is the harvest-able bush. Set the event to give you the berries, and set the Bush1 variable equil to 30.
For the second page, set the event condition to variable Bush1 is greater than 0. This is the empty bush.

Lastly, for the common event itself. Make the common event a parallel process. Set a wait command for 600 frames (10 seconds). After that, have all the bush variables decrease by 1.

And there you have it! Each berry bush can now be harvested 300 seconds (with at most 10 seconds of inaccuracy) after they are harvested. The wait commands in the common event aren't necessarily needed, but it keeps the parallel process from running too often.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
Okay. So there is no way to do what I want so I will remove it. Thanks guys.

There is, I already told you on my earlier reply, use a controlling event and one variabler per berry event.

Vis_Mage outlined it on the post before this :)

Also, in case you missed my edit

Anyway if it freezes on a cutscene, it can be a case of a move route that cannot proceed because the path got blocked.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
646
Reaction score
582
First Language
English
Primarily Uses
RMMV
Oh. I don't really understand it though.

So make a new separate variable for each berry event I make?

Or it sounds like a better way is to set up Common event?

Which is...var Bush 1 Bush 2 Bush 3 etc Have a separate variable for each bush....and then...
Heck, I'mma try to make the event Vis_mage said and get back with yall.

Thanks btw!

Edit note: Please excuse me it is late at night.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
600
First Language
Italian
Primarily Uses
RMVXA
If you want to make events re-spawn after a set amount of time, and that time is the same for every event, you can use a FIFO approach. If you want to read something about it you can check the "Timed Events and Complex Timed Systems" link in my signature, it is a tutorial meant for VX Ace, but the basic idea is the same in MV, the only difference is how to handle script calls (as you have to use MV variables and not VX Ace ones). However, since it uses basic classes - just arrays - it is not very difficult to do it, and MV script calls thread already shows how to properly set up variables as arrays.

If you decide to not do it that way it is fine, but that one really is the optimal solution for such a thing, and it does not depend on the language you are using. I suggest that you read the theory behind it - it is explained quite thoroughly - and then just ask for the parts you did not understand. I can send you the script calls for MV if you are not able to figure them out on your own. However, everything would be much easier once you grasp the basics and would make explaining it much faster; one thing is having to explain everything from the very beginning, another thing is having to send you just a few script calls and/or explain the things you were not able to understand.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
@evmaster - Even if you use a common event, you will still use 1 variable per berry... Anyway, best way would be that, CE+variables :)

I also suggest looking at the cutscene where the game froze for your testers to see if there is no possibility of blocked move routes etc...

Also just curious, how did you do the cutscene? Did you use a controlling event for it?
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
646
Reaction score
582
First Language
English
Primarily Uses
RMMV
It's late and I'm about to go to bed. I think I will just have a system where players plant seeds and grow a random berries that does not use Parrarel process. Thanks again everyone. :kaoswt2: Sorry to bother yall!
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
How about your original problem then? We are still not sure if the parallels are the cause especially when it freezes on a cutscene.

IMHO, you should still check the cutscene in question to be sure. :)
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
600
First Language
Italian
Primarily Uses
RMVXA
I think I will just have a system where players plant seeds and grow a random berries that does not use Parrarel process.
The game is yours and you are free to implement things however you want. In any case, you should not be afraid of using a different approach, you might be surprised to see how easy it is and how little effort is required to do something like that.

On a side note, I hardly think parallel process can freeze your screen. They might drop your frames per second to a single digit, but freezing is something that autorun events do, not parallel process ones. I agree with @Engr. Adiktuzmiko when he recommends you to check the cutscene to identify the cause of this issue.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,073
Reaction score
7,982
First Language
German
Primarily Uses
RMMV
to the original question:
A single badly designed parallel process can create a lagging hell even on the most powerfull computer if the logic is bad enough, but with intelligent logic knowing the limitations there should be no problems with a few dozens parallels. It all depends on what they do, and a tiny parallel that mostly consists of a wait(300) creates no lag at all.

That said, using variables for berries will use up a lot of variables and create a lot of work (you can't simply copy the events anymore, each copy needs its variable changed).
For a spawn system that changes more than three or five events per map I really suggest to use an event timer plugin, those are written exactly for that case - Iirc Shaz wrote a stable one that doesn't have any excess functions attached for unneeded things.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,626
Reaction score
14,372
First Language
English
Primarily Uses
RMVXA
Another thing to note is Windows 10 often will do 'background' tasks while you are working and I've seen those tasks cost me 10 - 15 FPS in a game from time to time. It usually goes away quickly, but if your friend is playing it on a windows 10 PC and the OS decides it is time to do a background task the game may appear to freeze for a second or two.
 

Latest Threads

Latest Posts

Latest Profile Posts

I just found out that MZ regional price on Steam in my place is much cheaper than MV.
Our water started to work again, now i don't have to fill up our toilet with water again.
Finally able to return to work after months of lockdown. My poor feet are hurting :( I need to get used to working again haha
My birthday was yesterday and tomorrow marks the day my grandpa died around 5-6 years ago. I think about him a lot, and surprisingly had grown to become interested in programming- something he'd done for a living among other things. Funny how life works. I'm just glad I was able to enjoy yesterday with my immediate family. Anyway- guess who's 9 + 10?

Forum statistics

Threads
108,876
Messages
1,040,218
Members
141,311
Latest member
Ciifer
Top