Question about Map changes and Image Cache

Brogar

Villager
Member
Joined
Feb 16, 2017
Messages
29
Reaction score
16
First Language
German
Primarily Uses
RMMV
Hello everybody,
can somebody enlighten me why the ImageManager cache has to be cleared every time a map is changed?
That evades me...

Cache clearing is called from Scene_Map.onTransfer, which is called everytime a map is created,
which happens everytime SceneManager.goto calls a map. Am i missing something here?
I just deactivated that in my project for the time being and it doesn't seem to cause errors,
but doesn't reload images everytime the map is changed.

Found this while isung the visustella core plugin and preloading faces, which were not there anymore
when switching maps. I wrote me a test plugin that loaded every png file in faces at game start and had
the same experience, no faces when switching maps.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
4,647
Reaction score
3,779
First Language
EN
Primarily Uses
RMMZ
MZ's image cache is cleared on map transfer, instead of being based on size like in MV.

If it didn't get cleared now and then, the game could potentially end up using a lot of RAM, particularly for games that use a lot of pictures, e.g. parallax mapping. It depends on your game.

Preloader plugins typically implement a separate cache system.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
38,495
Reaction score
10,916
First Language
German
Primarily Uses
RMMV
A new map means new tilesets, possibly a new background and possibly entirely different event sprites. Keeping those images from the previous map in cache when they will probably no longer be needed would use up quite a bit of the cache.
 

Brogar

Villager
Member
Joined
Feb 16, 2017
Messages
29
Reaction score
16
First Language
German
Primarily Uses
RMMV
Ah ok thanks :) i'll just implement the mv variant then for my project... else the images are not loaded fast enough when i change them on armor changes in the menu. I tried a few of the preloaders and they all need me to input every single file, so i have to input around 50 files and change them everytime a new armor is introduced in my project :p

Update:
Ok, tested it out, and it won't even crash on me if i throw insane amounts of data at it when disabling cache clearing (tried preloading 2.3GB Images and adding 2 million integer variables, and it still is around 3.5GB memory usage) and it doesn't need to reload images that much, which possibly helps wear and energy consumption on smartphones and solid state drives. But found a way changing 2 lines of code for the faces, characters and potentially pictures to keep loaded permanently and everything other to get flushed on map change

Update 2:
Thread can be closed, made a plugin to adress some of the parts i didn't like about the cache system.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

With this, I'm gonna have a good night sleep
Damn. We’ve gotten so close to 0 reports, 0 approvals a few times over the past couple weeks. Does it matter? No. Is it realistic. No? Do I rely on your reports and want everyone to keep posting. Yes. Do I 100% games? …sigh… Yes.

Ah yes, all three of my moods all at once.
Here's a tutorial I did on how I made my Leonardo A.I.-assisted artworks for my game's recent update. :rhappy:

Disclaimer: This is meant to be a band-aid solution for people like me who aren't good artists or don't have the financial means to hire an amazing artist. If you have the means, please buy commissions and support your fav artists.:yhappy:

Forum statistics

Threads
131,756
Messages
1,223,009
Members
173,518
Latest member
Tiagrun
Top