Simple Map, Major Lag... Why?

Discussion in 'RPG Maker MV' started by Soryn, Nov 3, 2015.

  1. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    Just trying to wrap my head around the issue here and find the root cause.

    Let me start by saying what my map contains:

    • Map Size is 50x50
    • Has only a 100% transparent tileset
    • Has a prallax background - optimized at 139kb
    • Has 5 other images displayed on the map - optimized size 1.42mb
    • No other sprites on the map besides the character
    • Disabled all plugins besides BindPictureToMap and PreloadManager (tried preloading the assests as well)
    • See attached image for the (only) event on the map
    [​IMG]
    Basically, the game loads with a little lag... but if you go back to the title, enter battle and then exit battle or reload the map in any way, it just freezes my system up for about 15 minutes until everything loads unless it crashes first. Haven't been brave enough to try it a 3rd time without closing the game first. Surely, with as few resources as I'm using in the game, it should not be doing this. It did this prior to using the preload manager as well which is what prompted me to use it in the first place. It helped with the initial load up but after that, subsequent map loads were just as bad.

    Any advice would be greatly appreciated.

    EDIT: I should note that I'm using a i7 3.2ghz CPU with 8gb RAM and AMD Radeon HD 8670M video card... Should not be a hardware issue.
     
    Last edited by a moderator: Nov 3, 2015
    #1
  2. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    So, just curious, am I doing something wrong with my event or is there some type of work around for this? From what I understand, this seems to be a common issue but I haven't seen any topics regarding it.

    Anyone?
     
    #2
  3. Alexa Angel

    Alexa Angel Veteran Veteran

    Messages:
    51
    Likes Received:
    16
    Location:
    You wish ;P
    First Language:
    English
    Try with one or two pictures. Does it cut the load in fractions??

    What resolution are you using? I ask because picture #2 is out of range in x coordinate with normal resolution.

    That could cause issues.

    Try binding these same event commands to a new event with an action button trigger.

    Activate it once, check the lag. Then click it again to see if it does the same.

    Open task manager and see if your RAM for MV is increasing while it froze to load.

    If so, it is a memory leak and it is not disposing or loading properly.
     
    #3
  4. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    disk use is maxing out. doesn't happen during initial load mainly when exiting battle. I was running at 1280x720 but then decided to try on default and it didn't change anything.

    Also, picture 2 isnt out of range on a 50x50 map. the picture loads from the x/y of the map not the screen correct?

    As for the rest, I'll try reducing and narrowing down the specifics.
     
    #4
  5. Alexa Angel

    Alexa Angel Veteran Veteran

    Messages:
    51
    Likes Received:
    16
    Location:
    You wish ;P
    First Language:
    English
    Show picture loads on in game screen coordinates, unless you have a plugin that changes that.

    I am not sure there is a plugin in MV yet that even does that.

    The way it is handling the pictures with what I have so far, I believe it isn't disposing of your pictures.

    When you exit battle and go back to the map, your pictures are returning.

    Then you have that event activating.

    If the program isn't disposing and reloading the pictures properly it is stacking.

    Then you have a stack runaway.

    You should test all pictures individually.

    There could be a faulty picture number, a faulty picture, weird coordinates or the program itself.

    Just some thoughts.  :D
     
    #5
  6. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    Just tried it again... recreated the event from scratch... worked fine until i added the 5th picture and then RAM and disk usage maxed out instantly. The 5th picture was only 88kb... the 1st 3 overlap each other a bit and it only slowed a hair. 4th didn't change anything... Just when I got to the 5th...

    Seems it doesn't matter what order i do it in... it always seems to happen with the 5th picture. Makes me think its a bug, not something on my end.

    Also, all pics load fine on their own... and any combination of 4 pics seems to have a slight bit of lag but nothing game breaking. Not sure why the 5th one does it unless, like you said, something isn't being disposed of properly and its stacking.
     
    Last edited by a moderator: Nov 4, 2015
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,706
    Likes Received:
    11,411
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Have you got any plugins? What happens if you disable them?


    I seem to recall an Ace script that made strange things happen when you use picture #5.


    Out of interest, what happens if you use Show Picture #6 instead of #5 - does it still lag?
     
    Last edited by a moderator: Nov 4, 2015
    #7
  8. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    No plugins besides BindPictureToMap and PreloadManager and i've tried with the preload on and off.

    picture numbers don't seem to matter, its just the 5th picture. I've set the 5th picture as something as small as 38kb and as one that is over 500kb. doesn't make a difference... though I'm going to try splitting this up into 2 events to see if it still happens then.

    EDIT: Tried splitting it up into 2 events and got the same result. Works fine loading picture #5 (event 2) and works fine loading 1-4 (event 1) but not when both events are running at the same time.
     
    Last edited by a moderator: Nov 4, 2015
    #8
  9. Zoltor

    Zoltor Veteran Veteran

    Messages:
    1,550
    Likes Received:
    208
    First Language:
    English
    I have a theory on what's going on here.

    Unless MV changed this, pictures don't disappear by them selves(when on any map mind you), plus in this case you have the event set to Parallel, and using erase event, instead of using a switch to get rid of the event.

    When you enter a battle, you are effectively not on any map at all(which is why you don't see the pictures while in battle), and the erase event command only gets rid of the event, until you leave, and return.

    Inshort not only do all the pictures remain until you manually delete them, but every time you enter battle, and leave battle, I think the Parallel event plays again, meaning the amount of pictures on the screen is being multiplied every time you go into battle/return to the map.

    I would suggest using a switch to turn off the event, instead of erase event.
     
    Last edited by a moderator: Nov 4, 2015
    #9
  10. Shaz

    Shaz Veteran Veteran

    Messages:
    37,706
    Likes Received:
    11,411
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You DO want a parallel event with Erase Event, because you want the pictures to disappear when you leave the map, but reappear when you come back on.


    Also, the event would not come back and run again after battle on the same map. The events are only refreshed when you leave the map (to go to another map) and return.


    But what you just said makes me think back to Neo's comment on my fog plugin, where it's not disposing the fog image. I based it on the logic already used by the parallax processing, which didn't specifically dispose the parallax sprite either. He suggested using Pictures as an example, but it sounds like maybe they don't get disposed properly either. So what you say could be true - if you leave the map and return to it - in a way that causes the setup method to run again (which resets all the events on the map), you could be getting the images loaded several times each.


    Can you please confirm, does the lag start immediately after you load the 5th image, even if you haven't left the map? Or do you have to load them all and then do something else in order for it to happen? You did mention going to the title screen then into a battle, but you can't go into a battle straight from the title screen, so you must be starting a new game or resuming a saved game from the title screen, and then once in the game, going into a battle? What I'm asking is, could you please list the individual steps that are the minimum required to reproduce this issue?
     
    #10
  11. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    Not really sure how I would turn it off upon entering battle and then re-enabling it after battle. Haven't messed with that type of thing on here yet.
     
    #11
  12. Zoltor

    Zoltor Veteran Veteran

    Messages:
    1,550
    Likes Received:
    208
    First Language:
    English
    The pictures shouldn't disappear though, they aren't tied to the event, once you show a picture, that's it, it will stay until you use the "erase Picture" command.

    Oh ok, that's nice to know, that erased events wont restart due to entering/leaving battle.
     
    Last edited by a moderator: Nov 4, 2015
    #12
  13. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    Steps to recreate:

    1. New Project
    2. New Map (I did 50x50) Parallax bg not needed
    3. Default overworld tileset used
    4. Flood filled grass (so i can move around to get an encounter)
    5. Set encounter troops to default (bats * 2) - optional
    6. No plugins except BindPicturesToMap
    7. Created an event using parallel
    8. Used Show Picture 1-5 any position
    9. Used Plugin Command: BindPictureToMap 1-5 any layer
    10. Used Erase Event
    11. Start game...
    12. Get into battle and go back to map or exit to title and start new game
    13. ...and there you have it.
     
    Last edited by a moderator: Nov 4, 2015
    #13
  14. Shaz

    Shaz Veteran Veteran

    Messages:
    37,706
    Likes Received:
    11,411
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    thanks - I'll check it out myself.


    I wonder if it could be something to do with your image size? I set up the same thing, but just used a battler image in the 5 Show Picture commands. On a default-sized map I couldn't see any issues at all. When I changed the map to 50x50, entering battle and leaving battle were very slow - I'd get a blank screen for several seconds. When I left battle, fps would drop right down but quickly climb again right back up to 60.


    If you temporarily replace your images with small ones (like a battler), do you still see the issue happening? Is it as severe?
     
    Last edited by a moderator: Nov 4, 2015
    #14
  15. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    I replaced my images with the Willowisp battler which is about 25% of the size of the image I used when I reproduced the steps. I noticed a considerable speedup, however its starting to look more and more like a memory issue. I ran it once to check. I managed to get in and out of battle with noticeable improvements but still a horrible slowdown. So then I closed it and tried again but this time the lag was about 10 times worse... but it didnt crash until after i exited a 2nd battle. So I tried play testing a 3rd time just going from the starting map back to the title and starting a new game again... that produced even worse lag than before... It did eventually load but it was too laggy to even mess with.

    I hope a solution to this can be found. I actually need to make the map larger and use about 10 images to do what I want to do... And I need several maps in the same vain.
     
    #15
  16. Bex

    Bex Veteran Veteran

    Messages:
    1,260
    Likes Received:
    291
    First Language:
    German
    Primarily Uses:
    RMMV
    I dont have the MV but maybe the Erase Event interfers with the previos 5th Picture? Do a Wait between the both. test with 60frames if it works decrease it to wanted.

    Or maybe its because u load many Pictures at once in your Internet Browser, try this Eventsetup:

    Show Picture1

    Pluginn command

    wait 4 frames or (more if possible , much more if its not for action stuff 60)

    Show Picture2

    Pluginn command

    wait 4 frames (more if possible , much more if its not for action stuff 60)

    continue by ur own...

    wait 60

    erase event. or change to other eventpage.

    Or its a Human mistake, check all your eventcode again.

    and or Never change event or player grafics in a loop every frame or every few frames,in that loop use switches

    to determine if a change is needed or not. That mistake made many on the vx ace too.
     
    Last edited by a moderator: Nov 4, 2015
    #16
  17. Soryn

    Soryn The Waffle King Veteran

    Messages:
    116
    Likes Received:
    88
    Location:
    Plymouth, UK
    First Language:
    English
    Thanks for your idea... I gave it a try and while it did help a little (not enough) with the loading, the images really have to be displayed at the same time since they are mostly visible at the same time. The wait 60 seconds is an issue due to the fact that the player may get into battle quite easily before those 60 seconds run out which causes more issues than it is meant to help.

    I do believe it to be an error within MV itself unless it is an issue with the Bind Pictures to Map script. Given the disk and ram usage when doing this, it seems like the images are being rewritten more times than they should be.

    I would really like to try the idea Zoltor mentioned about turning them off upon entering battle and then then back on after battle. I just wish I knew how to accomplish that. Otherwise, I'll just have to see what Shaz comes up with or wait for a patch/script fix.
     
    #17
  18. Galenmereth

    Galenmereth I thought what I'd do was Veteran

    Messages:
    2,206
    Likes Received:
    1,914
    Location:
    Norway
    First Language:
    English
    Primarily Uses:
    RMMV
    I have a few updates to my BindPicturesToMap plugin on the agenda, among them optimizations for larger images (cutting them up internally into "chunks" to lessen gpu load on scrolling large maps with multiple large pictures) as well as improved ways to load pictures in general. When doing this I'll also have to perform more extensive performance tests to see if anything fishy is going on. I'm very busy these days so I can't say when I'll have it done, but I want to get it out there as fast as I can.
     
    #18
    Soryn likes this.

Share This Page