Can parallal conditional checks without a wait time cause game freezing?

Hi there,

On a particular map, I have some events that run a conditional branch evert few frames, and then some without any wait time at all.

I understand it's a good idea to have at least a couple of frames wait time in instances like this, but just thought I'd try it. Then I experienced a game freeze. Just the once though, hasn't happened since. Funnily enough, it happened during a piece of dialogue. The text got one letter in before it froze, but the music kept going. There are no moving visual effects on the map so I can't say whether or not other processes were going on in the background.

Anyway, without going into detail about the two or three parallel processes that are running, was just wondering if this was a likely cause or if I should look elsewhere.
Yes, without wait it can freeze the game, because the game doesn't know when to rest and deal with other processes.
That's all I was after. Thanks!
It depends on how many events you have on the map, how many of them are parallel process, whether they have waits, what other commands they have (some without waits will run fine, some won't - it depends on what the event is doing), and what other plugins you have.
yes and no - as shaz said it depends on what exactly is going on at that moment.
If a show text is stopped mid-letter however, I would look for something other than a parallel process being the cause, unless you have plugins that modify show text. It might even be that the cause is not inside the RM but a windows error if no plugin like that was involved.
It is concerning the amount of plugins so early on I have going even though I have tried to keep it to a minimum. I'll add waits to the parallel processes and see if it comes up again. I guess I'll cross that bridge when / if it happens again.
Unless you NEED something to happen 60 times a second, you should ALWAYS add waits to parallel processes.
In that case, what's a recommended wait time to run checks for player movement?

For instance, if I have a system set up where boulders fall down on the player, and if the sprite of the boulder and sprite of the player occupy the same tile, how many frames should I allow before running the next check? I'm thinking it has to be less than 10 because a player could press and leave a tile in that time, but specifically - I'm not too sure.

As long as there is a wait of more than 1 or 2 frames, is freezing unlikely to happen?
I would consider not using parallel processes at all for that. How are you making the boulder fall? If it's a Set Move Route and it can only hit the player at the end of that move route, then check the Wait for Completion box on the move route and add a check at the end to see if the player and the boulder are on the same tile.

For player movement - consider how many tiles the player can move per second. With a wait of 1 frame, you are expecting the player might move up to 30 tiles in a second. Highly unlikely. With a wait of 2 frames, you're expecting them to move up to 15 tiles in a second. Also highly unlikely.

If I'm doing a parallel process based on player movement, I'd make the wait at least 5, or maybe up to 10 frames. But that's only if I don't know when the condition could become true. If I know exactly when the condition should be checked (the boulder has reached the ground), I'll put the test on that event instead and not use a parallel process at all.
Nah, the boulder travels 'above' the player sprite. So, regardless of where the boulder is in its move route, it should be able to "hit" the player anytime the paths coincide. Don't worry about that - it's working fine.

What I'm having trouble with is changing the player image when they hold shift to run. You see, I had a parallel common event for this that checked if the player was holding down the shift key with no wait time involved. This way of doing things presents a few problems.

Firstly, the freezing thing. If there's no wait time, like you and others have said, the engine doesn't know when to process the command.

If there *is* wait time, it means that if the player holds shift down, the image flicks and back and forth between the walking sprite and the running sprite. This is because the else branch has a command that returns the player to their walking sprite if the shift key isn't held down.

Is this the kind of thing I'm better off getting someone to make a plugin for?
I was just explaining in a 2k3 topic, what you want to do is set up a memory check and tie it in so it ONLY makes a change when you first press or release the button.

The simplest way to do this is with 2 variables and 3 conditional branches.

Instead of tying it to the button directly, use a conditional branch that sets a variable (we'll call this RUN) to a particular number (Let's say "1") whenever you're holding the button and 0 when you're not.

(btw a wait time of 1 frame is enough to avoid lag.)

Then make a second conditional branch that checks if a second variable (we'll call this RUN CHECKER) is equal to "RUN"
Put a variable command in the ELSE branch and have it set "RUN CHECKER" to equal "RUN"

Now put the third conditional branch directly below the variable command.
Have it check if "RUN CHECKER" is equal to 1 (change to dashing sprite)
Or not (Change to walking sprite.)

This way the command is only run under two conditions, when you first press the button and when you first release it. Otherwise the only thing it's doing is updating the variable and then running a wait frame, so it's lag free.


Here's a quick example.
Code:
◆Wait:1 frame
◆If:Button [Shift] is pressed down
  ◆Control Variables:#0013 Run = 1
  ◆
:Else
  ◆Control Variables:#0013 Run = 0
  ◆
:End
◆If:Run Checker = Run
  ◆
:Else
  ◆Control Variables:#0014 Run Checker = Run
  ◆If:Run Checker = 1
    ◆Change Actor Images:Marsha, Actor3(7), %RS-runningstraight(2), Actor3_8
    ◆
  :Else
    ◆Change Actor Images:Marsha, Actor3(7), %WS-walkingstraight(2), Actor3_8
    ◆
  :End
  ◆
:End
Oh goodness, what a great solution. Thank you so much for this!

EDIT: Just on this solution - is there any way to avoid having the player being able to press SHIFT during cutscenes and having the sprite change *other* than having a single switch that turns this common event on and off every time a scene takes place?

Original thread: https://forums.rpgmakerweb.com/threads/can-parallal-conditional-checks-without-a-wait-time-cause-game-freezing.81812/