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
484
Reaction score
288
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.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Do you have an audio you want me to animate? If so send me the youtube link and I’ll animate it.
Okay, so I'm working on Draft 2 of my game's script.
Will try to keep you guys posted, if you're interested!

This is vid of my new game, Crystalgazers. A demo is available on my Gamejolt

I just thought of the best achievement for my game: "'I Didn't Know You Were a Developer!' Find and enter one or more dev room(s)."
I made this animation to apply to a job, what do you think?

Forum statistics

Threads
105,582
Messages
1,014,781
Members
137,250
Latest member
jjrocks2000
Top