Akrib

Villager
Member
Joined
Jan 28, 2014
Messages
20
Reaction score
0
Primarily Uses
Hello everyone,

I've searched almost everywhere but couldn't find any deeper explanations on the function of the cache and garbage collection of the rpgmaker (mv).
I am currently working on a project which relies heavily on the use of parallaxes and overly images. Because of this it is very important for me to be able to unload images from the image cache to prevent the game from lagging after a certain time.

Imagine the following: There is a large map (let's say around 100x100 tiles) which has to parallax layers for the whole map. These would be far too large just load with the start of the game, at least without causing the game to lag heavily. Instead, there would be a possibility to split these huge images into several small ones, that would be loading when the player enters the corresponding areas of the map.
For example:
Player is on coordinates x y, so image 1 is loaded, which displays the part of the map the player is currently in. Then the player moves to coordinates a b, so image 1 is erased and image 2 ist loaded, which shows the part of the map around these coordinates, without the player entering another map.

While I am currently trying to event this system, my current problem is: When I am constantly loading and deleting parallaxes as the player walks through the map, will the deleted images get deleted out of the cache as well? Otherwise I'd have to fear lag or crashes.

In short, is there someone who is able to explain:
1. How the automatic garbage collection of rpgmmv works exactly?
2. If there is a way to clear the cache from specific images via script calls?
3. How the ImageManager.clear() function works? I tried this one on a map with tiles and parallaxes, and it didn't seem to do anything at all. Is the program reloading the cleared cache on the running map? Or did i do something wrong when making a script call "ImageManager.clear();"?

Thanks a lot in advance! (and sorry for the long text...)
 

peq42_

Yeet
Veteran
Joined
Feb 5, 2016
Messages
532
Reaction score
316
First Language
Portuguese(BR)
Primarily Uses
RMMV
1) Garbage collection is not a thing of MV. It's from chromium(or what ever browser run your game. Be it mobile or not).
2) I don't know if there is a way to use javascript to clear/remove images from the cache. But if there be, search on google how to do that in chrome, or general javascripts commands for that, because probably they will work(since anything that works on Chromium/Chrome, NodeJS or NWJS will work with MV games[At least, in desktop]).
3)Think of the Garbage Collector as someone who holds all your things, follows/receive orders from you and have a list of the things he's carrying. If you use that "function", you're simply removing things from the list, but that guy won't simply drop them in the street. You're going to need to stop doing your activities(In your case, close the game/tab where it is running) for him to have free time to get rid of them(OR you need to wait some time, for him to start getting rid of a few things here and there as time passes, until all that was loaded and you asked him to get rid of be removed).
At least I THINK that's the way it works.

But you don't need to worry about it. Your game can reach up to 4GB of ram usage(If it be 64bits, AKA once MV 1.6 comes again and you update RM MV) without crashing(if it doesn't get to this point in a small amount of time) as far as I know. Also using lots of ram won't slow it down, it's quite the opposite: The more stuff you've loaded in RAM, the less the system will use CPU to load stuff(Because it will need a lot less time to load them from ram, than would to load from HDD/SSD), therefore the more performance you've.
 

Latest Threads

Latest Posts

Latest Profile Posts

Current menu of Shadows of the Earth: The Vrila'an Legend. Currently taking a break from combat related mechanics. Hope i get the actor busts done before the day ends :)
Was in need for a black van, so I made one by editing that one truck in the tileset. :kaoswt2:
nFfmJca.png
I honestly haven't ever been really active in this community, even though this year will mark my 4th year of having an account and 5th or 6th of using RPG maker. I didn't do anything with RM for most of 2020 and 2021 for personal reasons, but I'm excited to get back into game making!
Editing my old work, I thought the black border made the characters stand out.
Yes, I should have done it from the start. 010.PNG
Took a while, but finally released an update to my game. Now to see if anyone buys it :')

Forum statistics

Threads
118,769
Messages
1,118,585
Members
155,926
Latest member
jxggyzy
Top