Hi everyone,
I would like to formally address the issue with memory leaking due to image/audio caching. It has been known for awhile that this is an issue with MV, but just how to deal with it I haven't fully decided yet. I would like to implement a proper caching/garbage collection into the engine for a future revision, or as a plugin(s). However I would like to know what the users of the engine want out of a caching system, just how much "control" do you all want over what is cached, and what isn't? I will be making a design document of what I personally have in mind and then editing this post at some point with that. This is an issue that is critical to the engine, and it is best worked out with the users of the engine to give them something they want. Any and all suggestions are welcome.
Edit: It should be noted an actual caching system was added in 1.5.0, it could use some improvement but most users who updated their JS should notice the ram usage shouldn't be as bad as it used to be. This topic is also meant to discuss what you want out of a built in "preloader" as I would consider that apart of a caching system.
As always thank you,
- Liquidize
Thank god! It will help a lot (If you could try to bring improvements to performance, by using more GPU and Less CPU in the engine, i would thank a lot! I saw somewhere people telling that MV uses too much CPU and that makes the game run slowly)
Cache increases too much over time while playing a game. My game has less than 100MB until now and when i play it, RAM Consume reaches almost 500MB, what probably means that some things are being loaded more than 1 time and are taking too long to be removed from cache. Maybe a better cache management/reading would help solve that.
Also loadings from map to map when necessary aren't that bad. There could be an update in the engine to allow the "Transfer Player" option to have an extra setting asking if you wish or not to clear cache and load the next map assets, and maybe an automatic(configurable in database/system) setting to force cache clear + loading in map transfer when memory reaches X MB. It could even allow custom loading images or something.
is this why i experience noticeable lag when test-playing my projects?
There are many reasons why a project may have lag. Usually it's something you've done in one of your events.
I've been working on a preloader for my game for Ace, but the logic could be adapted for MV.
I'm currently stuck on solving how to make preload lists or any way of external control for it.
drop me a message if you want to look at the code.... if you people can solve that problem, it could be adapted to load the resources used in a specific map, and always what is on a specific map, thus always using the memory it needs, and nothing more.
I narrowed the problem down to how bitmaps are loaded.
Audio, maps and other resources are definitely not the problem.... bitmaps? the larger they are, the more memory they take exponentially.
which is nonsense because I can load the same bitmap in a graphic editor and it only takes a hundredth of the memory.
I have no noticeable lag, high CPU usage or ram usage so I can't suggest anything based on performance because MV games runs flawlessly on my ancient computer. As a plugin developer though, I would like to see a preload function for plugin assets. I'd like to see plugin developers have quick and easy access to the cache so while plugins are loaded so are the assets required by them and are ready as soon as you hit the title screen. At the moment i use the bitmap onload function to ensure the assets are loaded before I use them in code but it would be nice to have important assets ready to go upon game boot up.
As a much larger idea, id rather see you guy use PIXI.loader for all assets but I understand it's a large job and requires a rewrite of the bitmap class. I i think of anything else I'll chime in.
I remember when I first started my project, test battle had no lag but as things went on it started to get lag and my main project now has a lot of lag. Just to see if I was remembering things right I went back to make a new test project and yeah there's no lag but If I open my main project and go into a test battle there will be lag.
I don't know what it is but I'm glad it's a known issue and you guys are looking into it. I don't think it's an event issue either as my project only has a few events.
I'll be eagerly watching this thread and looking forward to the next MV update.
Well at least now I know it's not just me. That makes me not worry as much about my computer.
off-topic:
the lag is hit or miss for me; sometimes i experience smooth gameplay throughout, and other times there is noticeable lag.
on-topic:
if images and such are properly requested and stored when needed, is a pre-loader even necessary?
I learned that the hard way while playing Mount & Blade.
"Hey, if it doesn't load everything at once, that means less memory used! ............... right?"
yep.... go loading a 60-vs-60 battle, on demand.... :/