Crazy Lag after update to 1.3

Discussion in 'RPG Maker MV' started by padr81, Aug 10, 2016.

  1. padr81

    padr81 Guy whose game is taking too long. Veteran

    Messages:
    642
    Likes Received:
    640
    First Language:
    english
    Primarily Uses:
    N/A
    All of my maps which were running at below 60 fps due to lots of events are now running at 3-4 fps as opposed to 40 or so.  Any idea how I can fix this, do I have to create a new game and carry everything over or just remove lots of lighting events.
     
    #1
  2. Hackerham

    Hackerham Developer Developer

    Messages:
    82
    Likes Received:
    68
    First Language:
    Russian
    Hello! I was responsible for graphical engine update. And while I optimized vanilla version, I certainly did not care about any plugins. Please share your stuff with me, I'm "jedi_knight07" in steam :)  Together, we will bring it up to 60!
     
    Last edited by a moderator: Aug 10, 2016
    #2
    padr81 likes this.
  3. padr81

    padr81 Guy whose game is taking too long. Veteran

    Messages:
    642
    Likes Received:
    640
    First Language:
    english
    Primarily Uses:
    N/A
    Will do, will I send you the full game?  Its a weird build up of lag that didn't happen pre-update, when I get to the first town the fps drops to 30, than when I enter the church or inn it drops to 3-4 fps.  Interestingly if I save just before entering the town, quit and reload the game runs fine never dropping below 40 fps.
     
    #3
  4. Hackerham

    Hackerham Developer Developer

    Messages:
    82
    Likes Received:
    68
    First Language:
    Russian
    Make minimal example, if its possible.
     
    #4
  5. brandos

    brandos Veteran Veteran

    Messages:
    147
    Likes Received:
    31
    First Language:
    German
    Will the parallax memory leak ever be fixed in the future? The engine still doesn't clean the parallax/pixi cache.


    How to recreate the problem:


    1. Create new project


    2. Create 3-4 maps


    3. Add a huge parallax map to each map. 


    4. Test the game and travel through the maps


    5. See the game.exe ram usage go up without going back again


    Or create a map with a very large parallax map and spam right-click. 
     
    #5
  6. Hackerham

    Hackerham Developer Developer

    Messages:
    82
    Likes Received:
    68
    First Language:
    Russian
    @brandos I am sorry, but this is not memory leak. If you have ~1Gb of image files for Rpgmv, you will need 4Gb machine to run it. There's no other strategy for RPGMV except "store everything in cache".


    I am responsible for renderer engine, not for memory management. What I did is basically: "If you have N bytes of resources for the game, it wont eat more than 3*N memory". Before that, it could eat more memory for every stage regardless of was it loaded or not.


    KDKW hadn't specify memory management, there is no specification on RPGMV memory usage at all. Care to write one for me? If you specify all cases (static stuff, dynamic effects for battle) and such, which ones need to be cached if there's memory, which ones are unloaded on the stage exit, e.t.c. , then I will be able to do something about it. So far everyone wants me to read their minds on how to solve their problems, or make "reduce memory usage" magic button, so sorry I cant do that.


    Or may be you have a link to some doc for that kind of system for other RPG game, so I can use it?


    Actually, I think I'll be able to implement special cache for parallaxes, and then use it for some other cases too :)  Can you help me with demos? Make me a demo and share in steam, I'll test my stuff on it.


    That will bring me one step forward in that problem. Though still, it wont be general solution for every RPGMV resource  :(  
     
    Last edited by a moderator: Aug 10, 2016
    #6
  7. brandos

    brandos Veteran Veteran

    Messages:
    147
    Likes Received:
    31
    First Language:
    German
    @Hackerham


    Sure thing, I just created and uploaded a demo for you:  https://mega.nz/#!WB9XTBgA!RuzTMpbXkSGIKcCYICheKsv3jZqZ01wdvh6DI_xaUz8


    As you can see in the task manager the ram usage goes up to 1,1 GB while travelling through those 6 maps.


    I honestly don't understand why we can't simply clear the parallax cache, to me it sounds like it makes no sense that pictures that aren't being used in a map


    still are calculated by the ram.
     
    #7
  8. Hackerham

    Hackerham Developer Developer

    Messages:
    82
    Likes Received:
    68
    First Language:
    Russian
    Because there's no technical documentation on it, and I really don't want to work on RPGMV logic , its not my job and specialization. I can try to implement functions for that kind of case - load/unload stuff that is specific for single stage, and we can use them for parallax. But what about corner cases? For example, same parallax image in two consecutive maps, do I have to unload and load it at the same time? If no, then I need a way of predicting that the stage will have that parallax map, so I wont unload it. This stuff makes my brain hurt, and no one can write technical documentation on it for me :(


    BTW, is that possible to share that kind of big stuff (~1GB) through steam? I dont have mega account, i will create one :)


    UPD. Done, i downloaded it, thank you!


    UPD2.


    Also, consider that we have a lot of resources for the stage, including parallax map. I need an estimation of how much memory can be allocated for that stuff. If we have two consecutive stages and player is going in and out, I prefer them to be cached both, if its possible with current memory limit.


    I will be happy if someone here forms a collective that can solve that issues for me and arrange a technical document :)
     
    Last edited by a moderator: Aug 11, 2016
    #8
  9. brandos

    brandos Veteran Veteran

    Messages:
    147
    Likes Received:
    31
    First Language:
    German
    I'm by far no coder, the only thing I can help with is pointing out the problem.



    I also have a suggestion, the only way to clear the cache right now is to restart the game. What about a plugin which counts the map transfers and does a hidden restart and saves the game after every 5~ map changes and then continues where it saved so the Player things the game was only loading a bit longer.



    Right now it is impossible to create visually stunning games with RPG maker MV.
     
    #9
  10. Hackerham

    Hackerham Developer Developer

    Messages:
    82
    Likes Received:
    68
    First Language:
    Russian
    I completely agree with that. RPGMV is too general to make them, its hard to satisfy everyone needs. Some people want stunning parallaxes, some people want 4k animated tilesets, and such. I can do works for specific projects, but that won't solve the problem. I need general solution: How much memory can be used on mobiles, on PCs, what resources are critical and must be cached for multiple stages, e.t.c. If those settings will be included in RPGMV  , then all users will be able to tweak them for their game :)  


    Right now you are asking me to tweak stuff for you. I will help with that, and I'll decorate it as a partial solution that can be called from plugins, so people will be able to do at least something about their problems.


    That kind of stuff exists for every platform, HTML5 or not, and it must be documented. Especially when we open game on mobiles. We can't do stunning games on mobiles without good memory management. If someone writes a task like "optimize RPGMV for mobiles, make everything running OK", it will end with huge restrictions on RPGMV games. Unless we allow the tweaking.
     
    Last edited by a moderator: Aug 11, 2016
    #10
  11. padr81

    padr81 Guy whose game is taking too long. Veteran

    Messages:
    642
    Likes Received:
    640
    First Language:
    english
    Primarily Uses:
    N/A
    Hi Hackerman and I think that the problem I'm having is the same as Brandos.  The lag is only there since the update though.  Interestingly if I update the games .js and index.html file from a new project the game won't start at all and on test play I get a cannot define error from my overlay script, either Kaus or Orange which I use for parrallax.  Would it be better for you if I upload both the versions of the game, with the old 1.2 .js files and index.html and than with the 1.3 files?
     
    #11
  12. Hackerham

    Hackerham Developer Developer

    Messages:
    82
    Likes Received:
    68
    First Language:
    Russian
    you can put "js" directory a new one, and "js_old" as old. same with index.html / index_old.html :)
     
    #12
  13. padr81

    padr81 Guy whose game is taking too long. Veteran

    Messages:
    642
    Likes Received:
    640
    First Language:
    english
    Primarily Uses:
    N/A
    Will do. Uploading now.  Thanks for all the help dude, much appreciated


    @Hackerham - pm'd you the file link as it has paid resources that Im afraid will get pirated.
     
    Last edited by a moderator: Aug 11, 2016
    #13
  14. Hackerham

    Hackerham Developer Developer

    Messages:
    82
    Likes Received:
    68
    First Language:
    Russian
    @padr81 It seems that lighting engine tries to do some heavy operations each frame, when its "scripted" (day-night cycle). I can't solve it yet, but Canvas renderer will work better for you than WebGL.


    Please ask plugin author to fix lags, he can also ask me for consultation. I'm most certainly wont update his very advanced code without his help.
     
    #14

Share This Page