A question regarding image caching.

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
When I tried to use a combination of show picture and wait to animate images, there was a flickering between them. I did some looking around and saw someone explain that it's because MV handles the process differently than ACE.

I was told this syntax would prevent that if I used it to call on the images before showing them, which worked.
ImageManager.loadPicture("imagename")

I'm speculating here, but if you kept a game running long enough, I imagine that if more images were cached it would cause the game to slow down? Is this the case?
If it is, is there script similar to 'ImageManager.loadPicture("imagename")' that I can use during events to clear any cached images I called specifically for that event?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You're right - MV caches the images (all the previous engines did as well), so the longer you play the game and the more images you show, the more memory will be used.


Something like this might let you selectively clear the images:


ImageManager.cache._inner[name].free();


where name is img/pictures/filename:hue and hue is 0 by default.


To be sure, you could probably type Object.keys(ImageManager.cache._inner) into the console to get a list of the keys, which would confirm or contradict the format above.
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
You're right - MV caches the images (all the previous engines did as well), so the longer you play the game and the more images you show, the more memory will be used.


Something like this might let you selectively clear the images:


ImageManager.cache._inner[name].free();


where name is img/pictures/filename:hue and hue is 0 by default.


To be sure, you could probably type Object.keys(ImageManager.cache._inner) into the console to get a list of the keys, which would confirm or contradict the format above.


I typed that into the console and most of it completed (up to "_inner") so I think you were right?
Just to make sure I get what you mean about the hue: If my image was called 'compass', the syntax would be "ImageManager.cache._inner[compass:0].free()"?
 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
you left out the path, and the name, being text, should be in quotes.


ImageManager.cache._inner["img/pictures/compass:0"].free()


However, that's why I said to use Object.keys - so it would show you how to format them.  Please do that, because I haven't tested that syntax and can't guarantee that it's correct.

I typed that into the console and most of it completed (up to "_inner") so I think you were right?


It was the bit after _inner that I wasn't sure about, so please type the whole thing and press enter to see what it outputs to the console.
 
Last edited by a moderator:

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
you left out the path, and the name, being text, should be in quotes.


ImageManager.cache._inner["img/pictures/compass:0"].free()


However, that's why I said to use Object.keys - so it would show you how to format them.  Please do that, because I haven't tested that syntax and can't guarantee that it's correct.


It was the bit after _inner that I wasn't sure about, so please type the whole thing and press enter to see what it outputs to the console.

Sorry, sorta misunderstood that. I get what you mean now.
You were pretty close, the only thing you were missing was the extension for the image before the hue.

Thank you very much for the help, and for inadvertently teaching me about the console.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
the console is amazing if you want to get into any kind of scripting stuff :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top