JulioManeiiro

Regular
Regular
Joined
Jul 19, 2017
Messages
40
Reaction score
8
First Language
Portuguese
Primarily Uses
RMMV
Hello!
I'm using script call to delete event when near screen return false.
But the event runs in parallel event and this cause many lag.

So, i thinking on plugin to automate this process with notetag in event.
With "<near>" notetag, when event return $gameMap.event(this._eventId).isNearTheScreen(); false, it will automatically delete itself.
This way I can leave the event with another event priority, thus consuming less memory of the device that is running the game.

Obs: I use an plugin(EventReSpawn.js) to generate events in map of @Triacontane.
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,680
Reaction score
1,145
First Language
English
Primarily Uses
RMMV
You would use whatever the script call or plugin command in Triacontane's plugin is to unspawn that event. I don't know why you would need another plugin on top of that.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,035
Reaction score
8,959
First Language
English
Primarily Uses
RMMV
But the event runs in parallel event and this cause many lag.
Put a Wait command in it. It takes 16 frames for the player to move/scroll one tile while walking, so there's no reason to check your event more frequently than that.

This way I can leave the event with another event priority, thus consuming less memory of the device that is running the game.
Just as a quick note, this would affect the processing/CPU of a device, not the memory.
 

TheAM-Dol

Randomly Generated User Name
Regular
Joined
Feb 26, 2022
Messages
925
Reaction score
1,616
First Language
English
Primarily Uses
RMMV
I did a video tutorial on just this thing:LZSskeptic:
If I'm understanding you correctly, you are basically creating a culling system to cull certain events when they are outside of your screen to improve performance.
In which case, you don't need to delete the event, you just need to disable the event. So on the events to be culled, add a new event page with a self switch and nothing else, leave it set to action button for the trigger. Your parallel culler event will check the "isNearScreen" and if false, will turn on the self switch of the appropriate events (else turn off the self switch). I don't recall the script to remotely change an event's self switch (and am not near my computer to double check the script in my game) but I'm sure Google or someone smart can answer that for you.
As mister Turan already mentioned, you should put a wait time on the culler because it only needs to check once the player has moved at least one tile. It's also worth noting from my testing that there is a buffer with the "isNearScreen". It's actually a pretty wide buffer too, maybe 7 - 10 tiles outside the visible camera. So having the culler run slowly is totally okay since the event won't actually be within the viewable area for likely a second or longer (depending on the speed of the player)

It's also worth noting that this isn't a magical performance boosting bullet. Because of the aforementioned buffer around the screen, culling events this way is totally pointless on smaller maps. Setting it up on smaller maps is: 1) (most importantly) a waste of time, and 2) will actually have a performance impact rather than saving performance (even if it's a negligible impact)
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,959
First Language
English
Primarily Uses
RMMV
Put a Wait command in it
I agree with this. I suggest you post a screenshot of your event (in the MV Support forum) to see if we can help you remove the lag. Better to try that first, than to add another plugin to get rid of a problem that you likely caused by event design.

The only parallel event that I can think of that NEEDS to run without a Wait is one that's monitoring for the player pressing a button.
 

JulioManeiiro

Regular
Regular
Joined
Jul 19, 2017
Messages
40
Reaction score
8
First Language
Portuguese
Primarily Uses
RMMV
I did a video tutorial on just this thing:LZSskeptic:
If I'm understanding you correctly, you are basically creating a culling system to cull certain events when they are outside of your screen to improve performance.
In which case, you don't need to delete the event, you just need to disable the event. So on the events to be culled, add a new event page with a self switch and nothing else, leave it set to action button for the trigger. Your parallel culler event will check the "isNearScreen" and if false, will turn on the self switch of the appropriate events (else turn off the self switch). I don't recall the script to remotely change an event's self switch (and am not near my computer to double check the script in my game) but I'm sure Google or someone smart can answer that for you.
As mister Turan already mentioned, you should put a wait time on the culler because it only needs to check once the player has moved at least one tile. It's also worth noting from my testing that there is a buffer with the "isNearScreen". It's actually a pretty wide buffer too, maybe 7 - 10 tiles outside the visible camera. So having the culler run slowly is totally okay since the event won't actually be within the viewable area for likely a second or longer (depending on the speed of the player)

It's also worth noting that this isn't a magical performance boosting bullet. Because of the aforementioned buffer around the screen, culling events this way is totally pointless on smaller maps. Setting it up on smaller maps is: 1) (most importantly) a waste of time, and 2) will actually have a performance impact rather than saving performance (even if it's a negligible impact)
Hey!
Thanks for your complete response!
But for the event build I'm dealing with, I need this plugin or a better way, as the event cannot remain on the map, it works in a visual way until the moment the player moves away from it.
A check via plugin/notetag will certainly have less impact than a parallel event.
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,680
Reaction score
1,145
First Language
English
Primarily Uses
RMMV
You can try this
JavaScript:
 * @help The following actions will lighten the processing of events
 * It is effective on maps where a large number of events are placed.
 *
 * 1. Stop Draw Out of Screen
 * Reduces the load by stopping unnecessary
 * drawing processing for off-screen events.
 *
 * 2. Cache Event Running
 * Cache the process of checking the running status of events,
 * so that it is executed only once every 1/60th of a second.
 * This can be especially effective when used in conjunction
 * with StopSelfMovementWithPlayer.js, etc.
 

JulioManeiiro

Regular
Regular
Joined
Jul 19, 2017
Messages
40
Reaction score
8
First Language
Portuguese
Primarily Uses
RMMV
You can try this
JavaScript:
 * @help The following actions will lighten the processing of events
 * It is effective on maps where a large number of events are placed.
 *
 * 1. Stop Draw Out of Screen
 * Reduces the load by stopping unnecessary
 * drawing processing for off-screen events.
 *
 * 2. Cache Event Running
 * Cache the process of checking the running status of events,
 * so that it is executed only once every 1/60th of a second.
 * This can be especially effective when used in conjunction
 * with StopSelfMovementWithPlayer.js, etc.
GREAT!
Maybe i can make other thing with this.
 

Latest Threads

Latest Posts

Latest Profile Posts

ThereseIdleWIP2.gif
Design finished. Onto finishing the entire sprite sheet and alternative colours now
What does it say about you when a mushroom is your best friend?
If a game had a moral-choice system at the beginning 3 chapters where defeating an on-screen encounter grants a "-2" at the end of the level whereas evading it granted "+2" at the end of the chapter, and then each chapter also had a dialogue choice that'd give/take points depending on the answer the player gives, how many points would you expect to gain from the dialogue choices?
Dynamic.png

My next plugin will be:

DYNAMIC SWITCHES! (For RPG MAKER MZ)

What does this plugin allow?

Basically it allows you to create switches that work even though the game is closed.

Example of use:

You can make a system that you can only run a mini game once a day (or an event or whatever you want) and you have to wait 24 hours to play again.

I open thread here...
Brain: Hey! Let's draw something inspired by Tangela.
Result: Hartestant.png

Brain: What the hell man! That's it, I'm out!

Forum statistics

Threads
134,797
Messages
1,250,749
Members
177,591
Latest member
NeonWolf2000s
Top