Would making a crowd of NPCs facing player w/ parallel events crash my game?

I wanted to have a scene with a sea of npcs that are programmed to turn and look at the player regarding their position on the map using the region IDs. I have using the same type of parallel events for things like cutscene triggers using the condition: $gamePlayer.regionId() == 1

The NPC crowd would fill practically every square aside from the middle carpet area for the player to walk through:
map portion.PNG


NPC's individual event, ID's would be changed depending on their position in that corresponding area:
event.PNG


Despite having a great cpu, I don't want to risk it and go ahead with filling my map with a ton of these parallel events just to test it in case it crashes and/or corrupts the game files. Is the method of conditional scripts I'm currently using done correctly, or is there another way to achieve what I'm trying to do here?
The key to parallel events is to always (unless you know explicitly what you're doing) have a Wait command at the end.

Nothing you're doing in your event is CPU-intensive and it shouldn't cause any significant lag unless you leave it the way it is so that it's processing 60 times per second and then you fill your map up with that.

It should be fine if you just add some Wait at the end.

Might it not be easier to just have everything run by the center tiles instead?

- Get rid of the region IDs and all code in the audience events
- Give the audience event 3 pages with the image facing down, right, or up, based on a Condition of a variable
- Make your carpet have rows of player touch events that set the variable to the appropriate value
- Copy the audience events as desired. The ones on the opposite side of the carpet get the facing right image changed to facing left before copying en masse
you could make ONE single sheet with the npcs, which while making the file a big big would reduce the load from 20+ parallels to a single one.

OR you can make 3 paged events, each with a facing direction controlled by either variable or switch and make the pages swap depending on these, with a single parallel controlling the "facing" switch/variable.
Can't you just use [Turn Towards Player] in the event's move route?
I'm not sure what changes between MV and MZ there are, but in MZ you could make a supposed group of people as one single sprite. Using the pictures you provided, this would make a group of 6 people act as a single sprite.

Take for instance the 'door' sprites. Usually it has 3 doors, and each have 4 frames. Those 4 frames are for each of the facing directions, and the column corresponds to the stepping frame. So in practice, you could have 3 different groups of 6 people, on a single event sprite sheet.

Edit: I had made incorrect assumptions on vram savings, but creating a group of events as a single sprite would still save you on how many events you put on the map, if you care at all. It's just easier to manage 10 events than it is to manage 60. Even if they are all copies.
Can't you just use [Turn Towards Player] in the event's move route?
Was thinking the same.
Cutting down the resources needed 6fold when compared to just putting them down 1 by 1.
Are you sure? Even if the engine caches 6 copies of the small sprite (which it might not do if it recognizes duplicates), wouldn't one large image take up the same amount of memory as it's the same number of pixels? Or do I misunderstand something?

The actual event object takes up a trivial amount of resources.
Are you sure? Even if the engine caches 6 copies of the small sprite (which it might not do if it recognizes duplicates), wouldn't one large image take up the same amount of memory as it's the same number of pixels? Or do I misunderstand something?

The actual event object takes up a trivial amount of resources.
Hmm, going back on it, yeah you're right. I knew pixel to pixel it'd be the same, but I had made the incorrect assumption that since you're grouping events together and splitting '12' frames into essentially 3 groups of 4 you'd save on resources, but no I'm wrong on that. It's the same as if you were to just replace each column on an event sprite sheet with different events to only utilize the 4 facing directions.

And if event objects do indeed take up trivial amount of resources, I guess it doesn't matter if it's 10 or 100.
Can't you just use [Turn Towards Player] in the event's move route?
Ok ty because I completely forgot that is a thing LMAO - but wouldn't they still have to be individual parallel events or?
The key to parallel events is to always (unless you know explicitly what you're doing) have a Wait command at the end.

Nothing you're doing in your event is CPU-intensive and it shouldn't cause any significant lag unless you leave it the way it is so that it's processing 60 times per second and then you fill your map up with that.

It should be fine if you just add some Wait at the end.

Might it not be easier to just have everything run by the center tiles instead?

- Get rid of the region IDs and all code in the audience events
- Give the audience event 3 pages with the image facing down, right, or up, based on a Condition of a variable
- Make your carpet have rows of player touch events that set the variable to the appropriate value
- Copy the audience events as desired. The ones on the opposite side of the carpet get the facing right image changed to facing left before copying en masse
I get what you mean by the wait thing, helps a lot even if its only 5 frames. Idk why but I thought parallel events (done right) would be less laggy than a bunch of player touch events or is it really the opposite? I only ask because in general I understand how its bad to have too many events in one map, although I don't know the exact number/limit of events they are referring to.
I thought parallel events (done right) would be less laggy than a bunch of player touch events or is it really the opposite?
Done properly, your parallel method could still cause lag, depending on exactly how many there are and how frequently they're cycling. Using touch events would pretty absolutely cause no lag (maybe on a lower-end system that takes time to update that many images at once).

I only ask because in general I understand how its bad to have too many events in one map
This is some kind of popular myth. I'm not sure how it started or is getting propagated, but simply having events on the map does nothing.

There was even a recent thread where someone was asking about it and I and another user made maps filled with 100-200 events and there was no effect on framerate.

Lag only comes from events doing things, not existing. Somehow the concept of it being bad to have too many parallel events running too frequently got morphed into it being bad to have events on the map.
I get what you mean by the wait thing, helps a lot even if its only 5 frames. Idk why but I thought parallel events (done right) would be less laggy than a bunch of player touch events or is it really the opposite? I only ask because in general I understand how its bad to have too many events in one map, although I don't know the exact number/limit of events they are referring to.
Well look at it this way, what's easier to do, 10 people running through a small kitchen to make a sandwich at the same time, or telling one person to go, make theirs, and then telling the next person, followed by the next person, etc...

Have enough people running in that small kitchen at the same time and nobody is going to be moving very fast at all.
Done properly, your parallel method could still cause lag, depending on exactly how many there are and how frequently they're cycling. Using touch events would pretty absolutely cause no lag (maybe on a lower-end system that takes time to update that many images at once).


This is some kind of popular myth. I'm not sure how it started or is getting propagated, but simply having events on the map does nothing.

There was even a recent thread where someone was asking about it and I and another user made maps filled with 100-200 events and there was no effect on framerate.

Lag only comes from events doing things, not existing. Somehow the concept of it being bad to have too many parallel events running too frequently got morphed into it being bad to have events on the map.
Tysm your detailed and easy to understand explanations!! I just gotta pick your brain for a few more answers on the same topic...

Testing my game through the editor runs flawlessly, but the deployed version seems to have completely random instant-crashing, no warning signs whatsoever; like the possibilities of it doing so shouldn't be shocking just based on the crazy amount of plugins installed. BUT I think this is probably to my affinity for region IDs based parallel events and the workaround I'm using for post processing effects.

Like I mentioned before, I like using parallel events w/ region IDs to set up 'tripwires' for things like cutscenes; where the called region ID is painted in a long line so that the trigger is unavoidable. Currently all type of tripwire are setup in the same fashion as this one (without the waiting bit you suggested):
region id trigger example.PNG

Should I just be using a long line of 'player touch' events—that all link to the same common event with all shown data—instead of parallel events? I am seriously starting to believe my parallel events are working against me rn


And for post processing effects—because you can only stack two transparent data tiles on top of each other in the map editor—I started using events to call for things like static atmospheric light shafts/godrays - and same goes for animated lighting effects such as lamps:
godrays.PNG
lantern glow.PNG

Another user suggested I use 'erase event' to reduce lag/crashing causes. However I recently realized that because these post processing events are using the 'action button' trigger means they disappear when I click on them in-game which is definitely not what I want to happen. I'm very much open to new suggestions on how to reduce lag and keep these post processing effects, I know for sure that there's gotta be a better way to go about all this and it's killing me not knowing exactly how to do so.

And if it wasn't already obvious, programming is not my strong suit, so I appreciate any and all input!
Well look at it this way, what's easier to do, 10 people running through a small kitchen to make a sandwich at the same time, or telling one person to go, make theirs, and then telling the next person, followed by the next person, etc...

Have enough people running in that small kitchen at the same time and nobody is going to be moving very fast at all.

I get what you mean by that. I was using 'wait' control the flow of cutscenes and player/event movement actions, but I hadn't considered using it in parallel events before this post. The only other time I had to use it was in a scenario where the text in 'window' mode following MessageRows 4 glitched out for a solid 5 frames or so before correcting itself; which I solved by just trying the wait: 10 frames - I'm guessing it's because it was a plugin command, however the text in 'dim' mode following the first input MessageRows 2 doesn't act strange in the slightest which makes no sense to me ngl
wait method.PNG
Just to mention it, we're not supposed to double post. You can respond to two people by clicking Reply on both posts, or the +Quote buttons or @tag the people.

Should I just be using a long line of 'player touch' events—that all link to the same common event with all shown data—instead of parallel events?
Yes, see my post #2. I don't really see why you'd think the setup you posted to be preferable to:
Screenshot 2023-01-31 141553.jpg

Edit: And I see now that the event you posted is unrelated to this thread, but still the concept is valid.

And for post processing effects
I can't speak much to this because it depends on the specific plugin you're using to create these lighting effects. But:

Another user suggested I use 'erase event' to reduce lag/crashing causes.
I think you misunderstood what was said to you. There's absolutely no point in putting an Erase Event command inside an event that's just sitting there with an Action Button trigger. That doesn't do anything.

Again, any lag from this would be coming from your plugin and how it's creating the lighting, not anything on the side of the event in the editor.
I'm not sure what changes between MV and MZ there are, but in MZ you could make a supposed group of people as one single sprite. Using the pictures you provided, this would make a group of 6 people act as a single sprite.

Take for instance the 'door' sprites. Usually it has 3 doors, and each have 4 frames. Those 4 frames are for each of the facing directions, and the column corresponds to the stepping frame. So in practice, you could have 3 different groups of 6 people, on a single event sprite sheet.

Edit: I had made incorrect assumptions on vram savings, but creating a group of events as a single sprite would still save you on how many events you put on the map, if you care at all. It's just easier to manage 10 events than it is to manage 60. Even if they are all copies.
I should point out this option has some serious slowdown and flickering at really huge sizes (or at least it did for me), but you have to get to about 480 x 480 before you see it. Show picture could work instead though to get around that.

Myself I'd just do one event with a lot of set move routes moving each and every NPC to face. Its monotonous but then you don't even need multiple pages as long as you have all the frames set up properly for the sprite in the first place.
RE: Many events in a map slow the game down/are bad
This is some kind of popular myth. I'm not sure how it started or is getting propagated, but simply having events on the map does nothing.
Not exactly, it is true - but it needs to be put into context.

Even a decorative event on a map does require processing, simply because the engine has to check if it is triggered regularly. THAT is what caused the origin of "too many events cause lag", and at itself it is absolutely true.

However for today's computers that is a very small amount of lag and will almost always do nothing.
The last time that has been a factor was ten years ago when VXAce was the current engine, and even then you needed several hundred events on a single map to trigger the effect and for the lag to become detectable.
But since VXA had only two mapping layers it required a lot more decorative events than the modern makers with 3 map layers, and that made the limit pop up a lot more often.

With the higher processing power of modern computers and the added map layer (you only need decorative events for animations or a fourth layer), it would take an unlikely number of events (read thousands instead of hundreds) to trigger the event-lag.
But in the days of VXA that was so common that some people even wrote anti-lag scripts to improve event handling on a map.
Just to mention it, we're not supposed to double post. You can respond to two people by clicking Reply on both posts, or the +Quote buttons or @tag the people.


Yes, see my post #2. I don't really see why you'd think the setup you posted to be preferable to:
View attachment 252081

Edit: And I see now that the event you posted is unrelated to this thread, but still the concept is valid.


I can't speak much to this because it depends on the specific plugin you're using to create these lighting effects. But:


I think you misunderstood what was said to you. There's absolutely no point in putting an Erase Event command inside an event that's just sitting there with an Action Button trigger. That doesn't do anything.

Again, any lag from this would be coming from your plugin and how it's creating the lighting, not anything on the side of the event in the editor.
my bad for double posting but ty for the tip!
Regarding post processing effect images—not a plugin literally just an event displaying a png from the character folder—I actually still don't a proper solution as to what this event's trigger should be. I found the original post I made about that topic, and after re-reading it I realize I did misinterpret the 'erase event' answer. However, no one actually answered my question for this single issue; So, I still don't know how what to set this event's trigger to! Should make it 'action button' trigger and put it above the player so they can't touch it? Or a parallel event? Like in the original post you can see there are a ton of these display png effects, and it's like that for nearly every large map, so I hope you can understand my concern that they are most likely contributing to crash chance during gameplay, but I need these post processing effects to stay in-game.
I actually still don't a proper solution as to what this event's trigger should be.
It has no commands. There is, literally, nothing to trigger - so it doesn't need to be triggered 😉

Should make it 'action button' trigger and put it above the player so they can't touch it?
Correct.

Or a parallel event?
Absolutely not. You should never make autorun or parallel events unless they're doing something, and then you carefully evaluate what they're doing.

I hope you can understand my concern that they are most likely contributing to crash chance during gameplay
I mean...not really? I understand that you have the concern, but not really why. It's just a picture sitting there, I don't know why you think that might crash your game.

You apparently read something that was relevant to a different version of RPG Maker on computer hardware a decade back and it's wormed its way into your head. But you've been told all thread long that it's not true.
Would a wait command at the beginning of a parallel process be any different versus having it at the end?

Original thread: https://forums.rpgmakerweb.com/threads/would-making-a-crowd-of-npcs-facing-player-w-parallel-events-crash-my-game.154560/