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,700
Reaction score
1,169
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,152
Reaction score
9,101
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
940
Reaction score
1,641
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,960
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,700
Reaction score
1,169
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 Profile Posts

I'm pretty sure me watching Netflix while having sushi just led to me eating the tail of my tempura shrimp.
1696004095642.png
...and now he even makes resources, too! xD
OMG Y'all. I found an alternate Google Drive I 100% forgot I had. All my crusty old game files from 2014 (when I signed up) are in there. When I like...maybe actually make a prototype thread it's gonna be so much fun taking everyone down my memory lane.
We are at the finish line!!! Thank you COMMUNITY!!!
GameCompletion.jpg

Forum statistics

Threads
134,903
Messages
1,251,756
Members
177,723
Latest member
DemonHitmaker
Top