MZ Should I worry about creating too many sprites and causes lag?

Back in RGSS3, creating too many sprites may cause lag and I had to create a nasty workaround to prevent lag. But I once tried to create 300 events in MV trying to cause a map lag, didn't happen, at least on my end (only a slight frameskip but no FPS drop). But that was like 2 years ago if I recall correctly.

Then today, I also found that the MZ code also abuses sprite creation as much. Such as the existence of the Sprite_Gauge, Sprite_Button, etc. Which creates inner sprites within sprites. I'm thinking to do the same. The problem is, I don't know how efficient PIXI handles many sprites if I end up creating too many sprites.

Granted, if it actually starts to lag, I can always create a workaround.
But, I'm still wondering, if there is a "limit" on this.

I'm not expecting an answer "that depends on the PC spec", but rather if the PIXI library is okay with this (they're handling it efficiently or not). Or maybe if there is any other factor I need to watch out for.

Any thought on this?
Well, in one of my games, I have over 100 moving events on a huge map that continue to move offscreen and I didn't notice any performace issues. The game also has a browser version and that one works fine as well. And from what I've read, the general consensus seems to be that MZ is much better at this than MV. This is just my experience though.
I'd say PIXI is pretty well optimized to handle a fair amount of sprites on the screen, since it is a rendering engine and Sprites are essentially their base unit for drawing things with texture (which ought to be the most common use case). This demo on their site creates 1000 sprites (one for each star), and it runs pretty smoothly here.

The RPG Maker core library, on the other hand, might not be as optimized as the underlying library itself (probably isn't), as this amazing post demonstrates. So there's not really much we could say about its performance for a large number of sprites without actually testing it, I think. There might well be some additional handling the rpg maker core does on top of PIXI that would make it run a lot slower if you have too many Sprites (sorting is one that comes to mind).

I don't think you'd have any noticeable problems if you're going for less than 1000 simple sprites though, as fortunately the engine itself in MV and specially MZ is far more performatic than RGSS was (not that it's very hard to beat GDI+ anyway).

That being said, if you do run into performance issues, you could always give the ParticleContainer a try, if that suits your needs, or fallback into using PIXI directly instead of proxying through the RPG Maker core scripts.
Very informative. Thank you.

If I understand this correctly, the key is as long as I'm using the same texture it won't drop the performance too much even if I'm using many sprites(?)
If you're dealing with pure PIXI, I'd expect that to be the case. PIXI has its own batch rendering logic and will optimize Sprites with similar enough characteristics into a single draw call, so it's usually quite fast even if you have a lot of them. The RPG Maker core engine might get in the way though, so I'd be wary of that.
The RPG Maker core engine might get in the way though, so I'd be wary of that.
In the case of WindowLayer, yeah. I already hate that back in MV. It did something funny when I place a certain window in a certain way that it didn't happen if I do it in RGSS3. I guess the existence of WindowLayer was to emulate the Viewport object from RGSS3 which failed miserably. But apparently, in the case of the RPG Maker Sprite class, it is just a direct extension from PIXI Sprite which should be safe enough to use. The extension means to emulate how the RGSS3 sprite system works.

While the extension of the Stage class (Scene_Base and its inheritances) also seems a direct extension without added a layer of complexity like WindowLayer. I'm pretty sure those are safe. I would be happy to be proven wrong.

Original thread: https://forums.rpgmakerweb.com/threads/should-i-worry-about-creating-too-many-sprites-and-causes-lag.133247/