I need some preventive tips on lag prevention!

Hey guys,
I have some questions concerning; what causes lag, and what is pretty much harmless.
Also any tips on rookie mistakes on lag would be helpful aswell!

1) lets say id put 1000 extremely performance taxing events in a map, and my game would lag like crazy, and then I would go to another map, would those events still be doing anything at that point?

2) do parallel events without anything in them still take performance?

3) what parallel process would be more taxing:
this?
Code:
◆If:#0006 is ON
  ◆Text:None, Window, Bottom
  :    :lol
  ◆
:Else
  ◆If:#0007 is ON
    ◆Text:None, Window, Bottom
    :    :lol
    ◆
  :Else
    ◆If:#0008 is ON
      ◆Text:None, Window, Bottom
      :    :lol
      ◆
    :End
    ◆
  :End
  ◆
:End
or this?
Code:
◆If:#0006 is ON
  ◆Text:None, Window, Bottom
  :    :lol
  ◆
:End
◆If:#0007 is ON
  ◆Text:None, Window, Bottom
  :    :lol
  ◆
:End
◆If:#0008 is ON
  ◆Text:None, Window, Bottom
  :    :lol
  ◆
:End

4) Would a parallel process still be taxing if the conditional branch in it, wouldnt let the real events contents pass yet, like this:
to be more clear: do unmet conditional branches also take performance?
Code:
◆If:#0007 is ON
  ◆Control Switches:#0007 = OFF
  ◆Text:None, Window, Bottom
  :    :lol
  ◆
:End

5) Are there specific event commands, that take more performance than others? like:
◆Control Variables:#0126 += 1

Hope im clear enough guys! I just feel really in the dark right now on how to make a good performing game, and i dont want to find out after im long in the making of a game, that ive been handling it poorly.
1) I don't think so.
2) Why would you even have empty parallel events in the first place?
3) The bottom one, I'd say.
4) Yes, as the engine still has to check if the condition is met.
5) Certainly, though I don't know on top of my head.

Quick advice: don't use parallel events if it's not necessary.
@Jules98

thanks for the answers.
Also, about question 2 - Im just curious if just running a parallel event without any "tasks" would still take any performance.
Yes, in fact empty parallels are one way to use up your computer resources really fast, because even if there is no content the game loop has to process the event sixty times per second. And that does take resources...
Yes, in fact empty parallels are one way to use up your computer resources really fast, because even if there is no content the game loop has to process the event sixty times per second. And that does take resources...
would putting a wait command in it help? Ive once heard that works well against lag, but i cant be sure.
A wait command basically tells the computer to skip processing that event for a number of frames.
But for an empty parallel, that makes no sense because there is no content to be processed.

If an event has no content, the best way is to keep the trigger in action button - because there is nothing to be processed, and the trigger is only about the content, the rest of the event properties are independent of the trigger.

Some one told the base rule already above: If you don't need a parallel for something, don't use it. Parallel processes should be avoided wherever possible.
@Andar yes but i mean more in general parallel events. Would putting a wait actually reduce the performance? For example, what would be more performance taxing: 60 parallel events, with each a wait command of 60 frames, or one parallel event with no wait command at all.
There is no general answer, it depends on what the parallel process does.

You use waits to remove useless processing, but never to remove needed processes.

One example:
You have a parallel process that checks if the player is on a certain coordinate with a death trap to kill it.
There is no need to check the coordinates every frame, because the player needs time and frames to move from one tile to the next. So usually you put a wait of 10 or so there, and the position is checked six times per second.
If instead of wait(10) you put a wait(30) there, then you might allow the player to dash through that tile if he can move two tiles in half a second, which can happen if the player speed is increased.

You always have to experiment how many waits are good for a specific parallel. Too few and you create lag, too many and the parallel will no longer function correctly.
There is no general answer, it depends in what the parallel process does.

You use waits to remove useless processing, but never to remove needed processes.

One example:
You have a parallel process that checks if the player is on a certain coordinate with a death trap to kill it.
There is no need to check the coordinates every frame, because the player needs time and frames to move from one tile to the next. So usually you put a wait of 10 or so there, and the position is checked six times per second.
If instead of wait(10) you put a wait(30) there, then you might allow the player to dash through that file if he can move two tiles in half a second, which can happen if the player speed is increased.

You always have to experiment how many waits are good for a specific parallel. Too few and you create lag, too many and the parallel will no longer function correctly.
Ok so, bottom line of what im gathering here is:
if you have two identical events, but one has a wait command of 1 fps - that event will be less taxing on your performance than the other event that doesnt have the wait command. Right?
Again, there is no general answer.

Yes, a wait will always reduce the processing time - but it might cause the event to fail depending in what it does.

I suggest you follow the link to "bughunting" in my signature if you want to know more about how parallel processes work.


A single wait usually doesn't create problems, but on the other hand it often is not enough to reduce the lag completely.
Best solution is still to use as few parallels as possible, hopefully none.
Again, there is no general answer.

Yes, a wait will always reduce the processing time - but it might cause the event to fail depending in what it does.

I suggest you follow the link to "bughunting" in my signature if you want to know more about how parallel processes work.


A single wait usually doesn't create problems, but on the other hand it often is not enough to reduce the lag completely.
Best solution is still to use as few parallels as possible, hopefully none.
I see. I will check it out, thanks

Original thread: https://forums.rpgmakerweb.com/threads/i-need-some-preventive-tips-on-lag-prevention.84124/