Map Cache Fix

Discussion in 'JS Plugin Releases (RMMV)' started by brandos, Feb 29, 2016.

  1. brandos

    brandos Veteran Veteran

    Messages:
    146
    Likes Received:
    31
    First Language:
    German
    Hey folks,


    I commissioned this awesome script from Felix "Xilefian" Jones and he allowed me to post it here.


    This Plugin optimises the way spritesets are handled by Scene_Map by caching them. By using a cache, the memory usage and CPU usage is reduced massively.


    You can even choose after which number of map transitions it cleans the cache. In my eyes its a must have problem for big projects with many parallax maps.


    This also fixes completly the bug that the game starts to get slow when spamming the menu.


    You can get it: here
     
    #1
  2. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,020
    Location:
    Toronto
    First Language:
    English
    If the sprites are cached, wouldn't that simply leave more data in memory until you explicitly clear it out?
     
    #2
  3. brandos

    brandos Veteran Veteran

    Messages:
    146
    Likes Received:
    31
    First Language:
    German
    To be honest i'm not really fond with the topic but I know that there is a critical error/mistake in the MV Engine. You can easily replicate it. Create a new project, add a large parallax map and then spam right click, after some while your Ram usage goes up. The same when you travel between maps with parallax maps. If you plan to use parallax maps bigger than 40 x 40 tiles this script is required otherwise it it will lead to freezes or random shut downs of the game.
     
    #3
  4. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    193
    Likes Received:
    401
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV
    Wow, you are right. We usually never spend too much time in our games, walking between many maps etc (or call the menu more than 10 times), that's what happen when you only "play-test" your project, we close the game very often and start fresh.


    But this issue is very serious, I tried to call the menu many time on a simple map with just some parallax fogs and my RAM was full in no time, the menu took longer and longer to appear/disappear and even the sound effects (when you open/close) started to glitch.


    Thankfully this plugin fixed everything, but I really think you should show that to the staff, this is a game breaking problem that need to be officially fixed in a next update.


    Thanks for sharing!
     
    #4
  5. brandos

    brandos Veteran Veteran

    Messages:
    146
    Likes Received:
    31
    First Language:
    German
    Sadly I have no idea how to contact the real developers since they are based in japan or china? But yeah it is crazy how something big like this is ignored by the developes. Maybe they are unable to fix it?
     
    #5
  6. Victor Sant

    Victor Sant Veteran Veteran

    Messages:
    1,694
    Likes Received:
    1,415
    Location:
    Brazil
    First Language:
    Portuguese
    This issue was already reported on the improvement board and the staff already acknowledge it. A solution probably will be set for the big update they are planning with all the data collected from there.
     
    Last edited by a moderator: Mar 2, 2016
    #6
  7. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    193
    Likes Received:
    401
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV
    I can't wait for this day to happen, knowing all bug fixes are now built-in the main program without the use of plugins (no blur on parallax, delta time etc), this will be a relief.
    Thanks for the link.
     
    #7
  8. brandos

    brandos Veteran Veteran

    Messages:
    146
    Likes Received:
    31
    First Language:
    German
     
    #8
  9. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,020
    Location:
    Toronto
    First Language:
    English
    There's this plugin you can install
     
    #9
  10. Victor Sant

    Victor Sant Veteran Veteran

    Messages:
    1,694
    Likes Received:
    1,415
    Location:
    Brazil
    First Language:
    Portuguese
    The rm mv update included a fix for this i belive. The plugins are no longer needed.
     
    #10
  11. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    193
    Likes Received:
    401
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV


    Unfortunately no, I updated everything and this big problem is still here.


    (again, it will take a pretty long time to "feel" the issue if you only move between tile-based maps with only some small parallaxes, but it will happen eventually. Big parallaxes are a faster way to experience the problem in no time, we just need to transfer between "many" maps [depending on how much RAM you have] to see the problem [transfers take longer and longer] or for an even faster result, by spamming the menu...)


    @brandos Despite being pretty good, I need to report a big problem in your plugin. To reproduce it, simply create an event moving randomly (I don't know, just take the cat from RTPs and set "autonomous movement type" to "random"), it will work the first time you go on the map with this cat, but if you transfer to another map and come back, now the cat SPRITE will be at the last position it was before leaving the map, and even worse, now the original EVENT for this cat is still at the right position but invisible.


    I don't see any other problem so far, too bad because this plugin is (for now) the only way to fix this "memory leak" (?) problem, the one linked by @Tsukihime doesn't change anything with me, it probably solved another issue.
     
    #11
  12. Ashouse

    Ashouse Resident Zombie Veteran

    Messages:
    242
    Likes Received:
    87
    First Language:
    English
    Primarily Uses:
    N/A
    I haven't installed the update yet, so I don't know if it will fix anything. I run this plug in and it helped somewhat. I don't have any auto move routes, or anything other than transfer events running at the moment. I no longer come to a grinding halt between maps, but ram usage still jumps up and stays up. So, watching task manager, I start at say 300 something mb. Walk around a bit and transfer to a small map. 800 something. Then when transferring from a large map to another large map (80x80 to 40x40) It jumps WAY up and never comes down (High 90 percentiles). It didn't lag or slow, but it shouldn't be that high (and never come down). Also, I show 3 instances of "game.exe" running in my task manager. Is this usual? They all have different values, but I was wondering if that's just how it do...
     
    #12
  13. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    193
    Likes Received:
    401
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV
    Do you have this with this plugin ON?


    Because I don't have any issue when this plugin runs, my RAM stays at a decent level, don't forget that it's not supposed to be the same size as your .PNG file once in the RAM, it's more like a .BMP equivalent so if you have a big 80x80 map with even just 2 layers it's going to be pretty big anyway, the good thing is that this plugin will flush the RAM so it's not going to saturate like it does by default (yes even with the new update), but hey... Put some random "auto move routes" events here and there and you'll see this plugin is not usable yet. I hope things will get better anytime soon.


    PS: I also have 3 instances of game.exe
     
    Last edited by a moderator: Mar 4, 2016
    #13
  14. Ashouse

    Ashouse Resident Zombie Veteran

    Messages:
    242
    Likes Received:
    87
    First Language:
    English
    Primarily Uses:
    N/A
    Alright, good to know (3 instances). Yeah, I have a big ram jump, but things are running smooth at least. I couldn't imagine what it would do to the average portable device. That's what I was aiming for early on, but now I'm just aiming at pc. Well, it's a pretty nasty little (big) bug. It simply can't go unfixed forever. But then again, us weirdos who want to spend 64 hours on a Parallax map aren't all that common... lol
     
    #14
  15. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    193
    Likes Received:
    401
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV
    Well, even somebody who just want to map with chipsets and use the provided parallaxes (like those in RTPs) to have a simple landscape effect, will eventually have this problem, it will just take more time. (since this kind of parallax is smaller etc)


    And, about RAM saturation on mobile devices, let's say now the latest iPhones/Galaxy have 2 or 3go, and it's not going to stop, so if we pay attention to the way we do maps I think it can work on those devices too. I tried on a cheap tablet PC with only 2go of RAM and a weak ATOM CPU and the game works:


    [​IMG]


    But of course we need a way to clean the RAM  ;)  because my little screenshot looks nice until I transfer on many maps and the game crashes lol.


    A solution exists... Simply use another plugin that uses pictures instead of parallaxes, like TDDP's "Bind Pictures to Maps", this one doesn't have the memory leak problem and you can chose to show a picture below your character so it will behave like a parallax. (would be nice to know this issue is fixed though)
     
    #15
  16. Saneterre

    Saneterre Veteran Veteran

    Messages:
    208
    Likes Received:
    66
    First Language:
    French
    thank you for the plugin
     
    #16
  17. Victor Sant

    Victor Sant Veteran Veteran

    Messages:
    1,694
    Likes Received:
    1,415
    Location:
    Brazil
    First Language:
    Portuguese
    Well, i tested with a 3000 x 3000 parallax with 16MBs, no issue here. My ram was around 80% (wich is common when I have browser + maker + test play open) even changing maps or opening and closing the menu.


    ram.png


    And my pc RAM is 2GB.


    Did you replace the .js on your project?
     
    Last edited by a moderator: Mar 4, 2016
    #17
  18. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    193
    Likes Received:
    401
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV
    This is strange. Did you use the embeded RM parallax function or one of your personnal plugin? Maybe the one from KAUS (because indeed with that one it's fine, same as the TDDP one, but unfortunately not the one from GALV)


    PS: don't forget you have to do multiple transfer/call menu
     
    Last edited by a moderator: Mar 4, 2016
    #18
  19. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    193
    Likes Received:
    401
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV


    Yes of course, I even tried from a fresh new project from v1.1 to be sure. With ZERO plugin to be extra sure, using simply the parallax function from RM.
     
    #19
  20. Victor Sant

    Victor Sant Veteran Veteran

    Messages:
    1,694
    Likes Received:
    1,415
    Location:
    Brazil
    First Language:
    Portuguese
    No plugin. But I also used my Fog and Overlay with multiple fogs with no issue.

    I was transfering and open/closing the menu like crazy.
     
    #20

Share This Page