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.
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
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)
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.
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
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.
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.
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.
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.
Okay. So there is no way to do what I want so I will remove it. Thanks guys.
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.
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.
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. 😅 Sorry to bother yall!
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. 🙂
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.
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.