MV Image Cache

FEATURES
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

40 thoughts on “MV Image Cache

  1. Ki says:

    Hello,
    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:
      ‘Galv.CACHE.load(‘layers’,’MAP002main’);’
      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: https://www.virustotal.com/#/file/53b10db742bd2fc8c21ca012f3887884c56dfaf63d40ce9c92377cbb2277da27/detection

    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

    • Galv says:

      I don’t do compatibility fixes, sorry.

    • Homtaro says:

      Have you managed to find a solution? Really need both plugins, since wasted too much time on configuring. I doubt I will get something as 2 years passed, but I’ll give it a shot anyways.

      • Homtaro says:

        So I removed some array.prototype functions as they were reason of conflict and just added them inside needed js files as methods, clunky, but it works now for what I need them.

  13. fazthestampede says:

    Hi Galv. I hope I’m not too late to seek advice. I used your beautiful plugin but it still flickers. Could this be because I’m trying to cache 14 pictures of which has 700-1000kb each in size? (So in total around 12MB in that folder)

    • Galv says:

      Not sure. Make sure all file names are in the same case to how you put them in the plugin. And if you are calling via script, make sure to do it with time before you show the graphics and not right before.

  14. fazthestampede says:

    Hi Galv. I finally finished trying & experimenting your plugin and it amazingly worked, just like magic! If you allow me to, I’ve credited your name in my game’s credit section which leads to this website.

    That being said, I think I found a phenomenon where the plugin doesn’t work if there’s another autorun event of which ID number is lower than the autorun event for your Cache-ing. What would be the cause of this? because my lower-autorun-ID is not activated at the same time (only triggered by a switch), which means your Cache autorun event should’ve run with no issue if no other autorun events are triggered. So, I inserted the Script call in the beginning of each event that involves the number of image I’m using in that event instead of an autorun.

    Nonetheless, I want to thank you very much. It solved my flickering forever.

    • Galv says:

      I can’t think of why that would make a difference. As long as the script call is done and it has time to put it in the cache, the event ID shouldn’t matter.

  15. David says:

    Hi, I’ve been enjoying your plugins but have found that the image cache is incompatible with Shora Lighting. I will let Shora know as well.

    I get an error that reads:

    Failed to load: img/parallaxes/function%20(x)%….etc

    Thank you for your work!

    David

    • Galv says:

      It looks as though there are spaces in the image filename there. Are you able to remove those spaces and have the other plugin still work? It may solve the issue.

      • David says:

        Hi Galv, thanks for responding. I double-checked and there are no spaces in the image filename.

        There are only a few files in the cache under parallaxes and none of the filenames have spaces.

        I haven’t heard back from Shora yet.

        Thank you!

  16. sugarb says:

    So far the plugin works very well!

Leave a comment