Input, animation and sound lag

Hello! I've run into a very annoying problem with RMMZ, hopefully there's an easy fix to this. I work on both a Macbook and a fairly good Windows PC and keep my game files on an external hard drive, this setup works well and I ran into this problem before, when I used only my PC to make changes to my game.

Whenever I playtest my game it takes multiple clicks to trigger events, mostly events which are set to under character and are - duh - triggered by pressing a button. This also applies to my custom menu common event, which checks if ESC is being triggered and transfers the player to a dedicated menu map. There's also a noticable lag in sounds and animations, skipping frames or playing 1 "Knock" sound instead of 3 when someone's hammering on the door. I thought this was because of my macbooks poor performance but as I have stated before, those lags and input delays also occur on my PC, not only during playtesting but also when the game is deployed. Same lag, same delay.

Anyone got any idea for a fix to this? I just want the engine to work properly, waaah, waaah :'(
sounds like you have the wrong number of waitframes on your parallel processes.

but without seeing the event code it is almost impossible to determine if you have not enough or too many waitframes.

explanation:
the wait command works by telling the engine to stop processing that event for a number of loops of the main gameloop.
in a regular event that results in a simple wait, but for parallel processes that means skipping the processing for some time - instead of sixty times per second, the event is processed a lot less.

with a few waitframes in parallel processes that reduces lag a lot, and you don't need to check sixty times per second if ESC is pressed because no player can press that fast or often.

however if you have too many waitframes that turns into a true wait even for parallel processes - the event reacts delayed to presses of right or whatever because the check is skipped too often.

add that to other lag effects and you'll need a lot of experimenting to determine the needed wait. And the number of waitframes required will change whenever you add more parallel processes,because everyone of them needs to be processed in the same loop.
sounds like you have the wrong number of waitframes on your parallel processes.

but without seeing the event code it is almost impossible to determine if you have not enough or too many waitframes.

explanation:
the wait command works by telling the engine to stop processing that event for a number of loops of the main gameloop.
in a regular event that results in a simple wait, but for parallel processes that means skipping the processing for some time - instead of sixty times per second, the event is processed a lot less.

with a few waitframes in parallel processes that reduces lag a lot, and you don't need to check sixty times per second if ESC is pressed because no player can press that fast or often.

however if you have too many waitframes that turns into a true wait even for parallel processes - the event reacts delayed to presses of right or whatever because the check is skipped too often.

add that to other lag effects and you'll need a lot of experimenting to determine the needed wait. And the number of waitframes required will change whenever you add more parallel processes,because everyone of them needs to be processed in the same loop.
Ahh, I see! That was exactly my problem, thank you very much!

Original thread: https://forums.rpgmakerweb.com/threads/input-animation-and-sound-lag.152769/