MV [SOLVED] Too many events causing game lag, or am I bad at eventing?

I honestly don't know where to post this, but in general I'm fairly new to javascript and the rmmv engine.
I've been using gradient images under the character folder & prefix to add lighting and shading for things like lanterns, non-animated stuff such as tree/large object bloom effects, and static godrays.

Here's an example of an area with all these kooky events running:
Screen Shot 2021-05-02 at 11.04.32 AM.png

in the editor:
Screen Shot 2021-05-02 at 11.05.48 AM.png


Here is the event setup for the trees's shaders—godrays are the same:
Screen Shot 2021-05-02 at 11.06.19 AM.png
Screen Shot 2021-05-02 at 11.06.13 AM.png


The gradient character images used are less than 100kb in size so I don't believe that's the issue, just way too many events and a crappy cpu may be the cause. Am I setting up these kind of events wrong, is there a better way to use them or should I just no be doing this at all?

I also heard that parallel events—vaguely described as 'poorly made'—can cause lag. I use parallel events for two things:

1) Screen tinting and/or showing image per unique map.
Screen Shot 2021-05-02 at 11.05.59 AM.png

2) Event tripwire
Screen Shot 2021-05-02 at 11.06.37 AM.png

Screen Shot 2021-05-02 at 11.06.30 AM.png


I won't deny that I like to go overboard with special lighting effects. Unfortunately rpg maker only allows transparent textures in tile sets to overlap twice, which writes out the possibility of using gradient tiles for my particular case and how I want other things to overlap...
If only we could have had infinite amount of transparent texture overlapping
extremeweep.png


So yea this map is fairly large (49x80) and I have a ton of events all running at the same time so the lag is a no brainer.
Screen Shot 2021-05-02 at 11.26.58 AM.png

I just want to know if I'm setting these events up right for their intended purpose. It's hard to google this kind of thing because it's very niche, and I'm just crazy enough to do this stuff.
itjustbelikethat.png


Edit/Update: After adding 'erase event' onto every special effect, and removing the tree bloom event to add it into the actual texture, the game still crashes on my friend's gaming pc. The good news is that it runs pretty good on my 2013 mac book pro, the only noticeable lag is with yanfly's letter sound effects from the extended message pack. Prior to making the changes, it never crashed on my mac but it did make the internal temp reach 70°C, now it's averaging at less than 62°C which is superb based on the other games I normally play on it.

Update 2: Game works flawlessly on mac but crashes roughly at the same exact point on two of my friends's gaming pcs, steve jobs has blessed me from beyond the grave.
Your screen tinting and 'display image once' parallel events you can add an 'erase event' to after they do their jobs; this will prevent them from running every frame and hopefully speed things up.
2rdYohB.png
Also, for your "tripwire" event, consider:
  1. ...adding a "Wait 6 frames" or something at the end, if you don't already have something like that. Technically the event just needs to check faster than the player can move from one tile to the next. With default speed (4) + dashing (+1), that's 8 frames:
    Frames per tile is equal to 2 to the power of (8 - moveSpeed):
    Spoiler: Game_CharacterBase > distancePerFrame (rpg_objects.js)
    JavaScript:
    Game_CharacterBase.prototype.distancePerFrame = function() {
        return Math.pow(2, this.realMoveSpeed()) / 256;
    };
    So:
    • Speed 3 = 32 frames per tile
    • Speed 4 = 16 frames per tile (default player walk speed)
    • Speed 5 = 8 frames per tile (default player dash speed)
    🙏

    Edit: also, a diagonal move takes exactly as long to complete as an orthogonal one:
    Spoiler: Game_CharacterBase > updateMove (rpg_objects.js)
    JavaScript:
    Game_CharacterBase.prototype.updateMove = function() {
        if (this._x < this._realX) {
            this._realX = Math.max(this._realX - this.distancePerFrame(), this._x);
        }
        if (this._x > this._realX) {
            this._realX = Math.min(this._realX + this.distancePerFrame(), this._x);
        }
        if (this._y < this._realY) {
            this._realY = Math.max(this._realY - this.distancePerFrame(), this._y);
        }
        if (this._y > this._realY) {
            this._realY = Math.min(this._realY + this.distancePerFrame(), this._y);
        }
        if (!this.isMoving()) {
            this.refreshBushDepth();
        }
    };

  2. ...removing the variables and instead using:
    • Conditional Branch > Script: $gamePlayer.regionId() === 1
    [Edit: replace 1 with the ID of the region to check against.]

    Every frame that a potential page condition (e.g. a variable) has changed value, all events will re-check their page conditions, and change page + refresh if necessary. (If you have other events changing variables/switches/etc every frame then this will have no effect.)
Basically what the others have said. Keep in mind that parallel process events are executed nonstop once per frame. For example, if after tinting the screen on the first frame, it executes the command to tint the screen again on the next frame, you're just wasting CPU power since the second execution doesn't do anything. The solution, like others have mentioned, is to add an "Erase Event" command after the "Tint Screen" command.
Also, for your "tripwire" event, consider:
  1. ...adding a "Wait 6 frames" or something at the end, if you don't already have something like that. Technically the event just needs to check faster than the player can move from one tile to the next. With default speed (4) + dashing (+1), that's 8 frames:
    ​

  2. ...removing the variables and instead using:
    • Conditional Branch > Script: $gamePlayer.regionId()
    Every frame that a potential page condition (e.g. a variable) has changed value, all events will re-check their page conditions, and change page + refresh if necessary. (If you have other events changing variables/switches/etc every frame then this will have no effect.)
That second method does work, however, I have two tripwire events in one map and for some reason it now plays one after the other instantly - even though both parallel events have a control switch. I also did what you suggested with the waiting of frames before and after.

Here's what I have for both tripwire events:
Screen Shot 2021-05-02 at 2.28.57 PM.png

Screen Shot 2021-05-02 at 2.27.34 PM.png
$gamePlayer.regionId() == 1

not

$gamePlayer.regionId(1)
Whoops, yes, do like Shaz says; I forgot to compare it to a value. 😴

(I'll edit the correction into my original response~)
Thank you so much, this reduced the lag exponentially! Oddly enough, the official deployed version of my game runs great on my 2013 macbook pro, but crashes in the same location on both of my friends's gaming pcs(?) It's getting harder to know if the crashing is just based on the computer's software, too many events, or perhaps the numerous plugins. I would like to believe if it crashes on pc it would also crash on mac, but this is not the case, and I've indirectly pampered apple's ego further LMAO.
Your screen tinting and 'display image once' parallel events you can add an 'erase event' to after they do their jobs; this will prevent them from running every frame and hopefully speed things up.
2rdYohB.png

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-too-many-events-causing-game-lag-or-am-i-bad-at-eventing.136098/