MV Image Cache

A simple image pre-loading plugin that enables to to specify images from folders within /img/ folder to pre-load (pre-cache) when the game is loading or to use a script call to cache images during game before they are needed.
This can be useful as RPG Maker MV loads images into memory as soon as they are needed during gameplay but sometimes this can cause issues such as images flashing blank for a moment, lag, or sometimes not loading at all.

VERSION 1.1 – RPG Maker MV
Download Plugin file
Download Demo

28 thoughts on “MV Image Cache

  1. Ki says:

    Thank you for the script. It seems it doesn’t work as is, but I changed “Scene_Boot.loadSystemImages” to “Scene_Boot.prototype.loadSystemImages” at the end of the script and now it works. Maybe you could check it ?
    Have a nice day !

    • Galv says:

      You are using old MV files as that is how the code used to be but was changed in an update.

      My plugins work with the latest MV files, I do not support projects that use older MV files.

  2. Vectorinox says:

    Is there a way to precache all images in the named folder instead of having to name every single one of them ?

  3. Hi Galv, thanks so much for your awesome time-saving plugins! I’m having trouble using this one in conjunction with your Layer Graphics plugin. I’ve added layers| as Folder 15 in the plugin settings, then used a plugin command ‘Galv.CACHE.load(‘layers’,’MAP002main’); but the image still flickers when first displaying. Is my plugin command correct? I couldn’t see a usage example for the plugin command so I also tried adding .png and changing ‘layers’ to ’15’ or ‘layers|’ but no luck. Any ideas?

    • Galv says:

      This is a tough one to answer without more details, but your script call:
      Looks to be correct (assuming your image name is actually /img/layers/MAP002main.png with that exact case).

      Some ideas off the top of my head:
      1. If your layer is a huge image, it might still flicker anyway when creating.
      2. You need to use the precache before you go to the map the layer is on.
      3. The latest version of MV changed how precaching works so I need to find time to check it works properly still.

      • I double checked the casing, it is correct. The image is 1152 x 672, hopefully that would be okay? Also, it doesn’t flicker on subsequent visits to the map. The plugin command was on the previous map, and I also tried loading it when the game loads, but no joy there either. Let me know if I can give you any more helpful information, and thank you for replying so promptly!

      • Galv says:

        Okay I’ve updated the plugin to version 1.1 to implement the latest MV changes – can you please test this to see if it fixes your issue?

        Note: You will need latest MV files in your project for this (MV 1.5.1)

      • Sorry for the bad nesting, for some reason I can’t reply to your other comment. The plugin still isn’t working for me, though I haven’t tried it in a fresh project and it’s possible that I’m doing something wrong. I have found a workaround however, by using Layer Graphics to display the layer at 0 opacity on a previous map so it’s kept in the cache! Thanks so much again Galv, keep up the awesome work!

  4. jo smith says:

    AWESOME!!!!!! :) :)

  5. jo smith says:

    This opens up insane possibilities for animated maps. Thank you! I have a map running a seventeen frame animation – it starts up right away and runs smooth. It makes me wonder: How many images do you think I can put in the cache before I start to have problems. And: What kind of problems should I expect to have? Thanks for your work!

    • Galv says:

      Actually I have found MV has problems when using many large images so I wouldn’t advise doing something like that in general. But it’s still worth a try to see what you encounter.

      I suspect you might run into the game starting to lag when you change scenes a lot (go in and out of your menu for example)

  6. jo smith says:

    Instead of large images I’ve been doing small maps linked together…I’ll post how it goes when I have a ton of images in the cache….Thanks, again! Loving all your plug-ins!

  7. jo smith says:

    I wonder if you can help me with your step sounds plug-in. It works great if the character is moving in open space. But when I push up against a wall the sound effect (set for frame 8 of 18) repeats rapidly…Is there a way to change this? -If there’s a better place to post this, let me know, happy to relocate… :)

    • Galv says:

      Please post questions in the comments of the actual plugin you have the question about… that way I can be sure I am looking at the same one you are talking about. This is an unrelated plugin to your question.

  8. Yoshiiki says:

    Hey, first of all, thanks for the plugin. It helped a lot :D
    If you are wondering for what, there is a download on my website (NSFW).
    Not sure if you are aware, but few antiviruses scream false positive on it:

    Didn’t see it mentioned anywhere, so I thought I would let you know.

  9. Kruxkushu says:

    Hello, I just wanted to thank you for this plugin, it combines perfectly with your Galv bust menu, I wonder if you made it for it :D

  10. AnthonyC says:

    Few small questions, can this be used for nested folders (folder inside a folder inside img folder)? For example my menu layout pulls images from img/menus/main. Would I set that up as menus/main|image, image, image in the parameters? And I noticed you mentioning this should be used with 1.51 mv, I’m still using 1.50 out of fear of break several other plugins. Is this still compatible?

    • Galv says:

      I don’t recall if it is compatible with that version, it has been so long, sorry. Not sure about nested folders you would have to test both to see if working.

      • AnthonyC says:

        Everything appears to be working and I couldn’t be happier Galv! Thank you for such a useful script, a few of the .png’s in my menu layout sometimes would fail to load in and this worked perfectly to fix that! :)

  11. kokonaughty says:

    Hello Galv! Thanks for the plugin, I’m using it with you other plugin, AnimatedBattlebacks : unfortunately I have a problem, I’m trying to preload my animated battleback, named Beach(4,15).png. But since there’s a comma in the name, the plugin thinks I’m looking for Beach(4.png and the game doesn’t load.
    Am I misunderstanding how to use the plugin, or are those two plugins uncompatible? Thanks in advance!

    • Galv says:

      Ah, yeah – I didn’t think of that. Currently they are incompatible as I didn’t think of the comma when splitting the image names

      • kokonaughty says:

        Thanks for the answer. Ah, that’s too bad, but no problem!
        If you ever update it let me know. :)
        Currently I found a way of hiding the lag with a short black screen (a few frames) between the battle transition and the actual battle screen. It’s the only lag I got so far on my rather old 6 years old laptop, but I’m early in the project, so I might end up with a lot of assets to load.

      • Galv says:

        If you edit the plugin, go to line 200 that reads:
        var list = arr[1].split(‘,’);

        replace the comma there to another character you want to use to split the cached images up. (not the | symbol as that is used for the folder split) Then in the plugin settings, instead of commas, use the symbol you chose.

      • kokonaughty says:

        Thanks a lot, it solved the compatibility problem. Strangely enough the small lag is still there, so I’ll keep hiding it with the short black screen. If other lags appear I might investigate further.
        Thanks again for your hard work :)

  12. mal says:

    There seems to be a compatibility issue with ICF-Soft’s Main Utility, where this plugin reads the functions past line 2856 as png files.

    The error: Failed to load: img/pictures/function () { for (var i = this.length – 1; i >= 0; i -= 1) { if (this[i] == null) this.splice(i,1); if (String(this[i]).length == 0) this.splice(i,1); } return this; }.png

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s