Loading tons of pictures at once

I know when you show a picture for the first time, there is a tiny lag before it appears. My way around it is usually showing it with opacity zero any time before I actually need it, so when I show it there will be no lag.

I'm currently working on a very image heavy game, to the point hundreds or pictures might be displayed at once. I already changed my picture limit. But since there will be hundreds, maybe thousands of images in my image folder, preloading them one by one might be impossible.

My question is:

Is there a way to preload many, if not all of the images at once?
I'm wondering if I can do something like:
Scan all filenames of image folders.
Show picture1 = first file
show pictur2 = second file
Since my picture limit is 9999, in theory I could probably preload them all at once.

Is something like this possible? If so, could loading that many images at once be an issue? If not, any other ways to avoid these lags?
Preloading them one by one, even by script probably won't work for you if you have up to thousands of them loaded. RMMV can only have so much memory in use, and at some point it's going to unload old ones if they're not actively being shown to allow the space to load newer ones.

There are preloading plugins, which preload the assets into the engine when it first loads, which supposedly helps with the lag when the pictures come in the first time, but I haven't personally seen much difference between using them or not.

Something like this one:

galv_image Cache is one way (only load the one you use first, but the more
you load, the bigger the savefile and it doesn't have clearing cache.

another way is to load a specific folder (which I do) but this can also lead
into trouble with to many picture in memory in mind.
Best to just preload the images used in an event, at the start of each event. I do it the exact same way you do it.

I have a game where about 100 images move over the screen, and I never notice any lag even without preloading. (Note that I do this in MV.)

Mine is a card game, of which cards are 384x512 pixels, and each card has multiple layers. And even though there are many, they appear one by one (when drawn from a deck).

So, eìther you try to make many appear at once, or your images are huge.

If they are huge, you dont need so many. If you have many, they should be small.

---

However.... you say you have so many moving at the screen at once? I guess that is done with a parallel? If the answer is yes, this is most likely the cause of your lag.
Thanks for the input everyone!

I'm facing a different but related issue I need help with.

Just for test sake, I showed 200 pictures on the screen. I found the game got a bit choppy. The framerate was reduced from 60 to 11. My computer is not very good for games. I friend tested on his computer, he didn't get this reduction.

Additional info: moving pics through a parallel event didn't seem to affect fps. The reduction was the same just showing them (not with a parallel). Picture size had a very minor impact.

But I was still worried, so I started looking for solutions.
I found this:

I did as told. The latest nw.js didn't work, so I tried 49.2. It worked. After testing, my fps drop was from 60 to 50, which is pretty acceptable.

But I was getting an error message every time I playtested. I looked it up and found this:

I followed the instructions.
It worked.
It semed like everything was ok and figure out.

But then I decided to test an old game and got the following error:
this._CanvasClearWindowRect is not a function

I'm not sure what triggered, maybe some plugin incompatibility. But it made me pretty stressed because I feel like I'm effing up my MV and all my previous projects trying to fix this current one.

---edit2---
After some testing I found out this error was caused by a specific plugin, HMS: Choice Display Mode.

So my question is:

- Since I barely started my project, should I just migrate to MZ which has better performance?
- Should I just fix those tiny problems I'm dealing with and keep working on this current project?
- Should I give up on making a game that shows hundreds of pictures at once (cause my whole concept depends on it)?

----edit----

Here's how I tested the hundreds of pictures thing:

for (let i = 0; i < 500; i++) {
$gameScreen.showPicture(i, "filename", 0, i, i, 100, 100, 255, 0);
}
Activate self switch A

Next page, self switch A activated, parallel event:

for (let i = 0; i < 500; i++) {
$gameScreen.movePicture(i, 0, Math.randomInt(500), Math.randomInt(500), 100, 100, 255, 0, 2);
}
wait 2 frames

(as I said above, moving the pics didn't make a difference; just showing them had the effect on framerate).
That profile error comes when you play a game someone else made, who updated their NWJS. You can ignore the error, since your players wont get it.

You have solved it and removed the error, but it will come back when you play those games again.

Edit: so you have a parallel trying to change the movement of all tjose images, once every 3 frames. If that doesnt cause lag. You say it doesnt causes the lag, but that seems quite the task to me.

Original thread: https://forums.rpgmakerweb.com/threads/loading-tons-of-pictures-at-once.167350/