Help with performance issues! (Demo provided)

Discussion in 'RPG Maker VX Ace' started by Sophism, Oct 28, 2014.

  1. Sophism

    Sophism Veteran Veteran

    Messages:
    36
    Likes Received:
    6
    First Language:
    English
    I'm feeling pretty bummed right now... my project's main hub map has severe performance issues during night time, when all its light sources are turned on. I've combed through the map several times doing optimization passes, but there's only so much I can remove before it starts detracting from how I envision the map to look and function.

    I had a previous thread regarding this issue, but I figured I might perhaps get more specific help if I were to post a small demo, containing only the bare minimum for the hub map in question to work properly. I've stripped it down as much as I could, but I did keep a couple of bells and whistles, simply because they might be part of the problem.

    If anyone with some free time could take a look at my project and tell me what I'm doing wrong, and perhaps offer me some insight on how to potentially alleviate the stark FPS drops, it would be greatly appreciated! (I am aware at the very least that the Tile Swap method I'm using for doors is terrible. I did it this way simply because I couldn't find a better solution to handle shifting them from darkened to lit, independently of their state.)

    Anyway, here's the link. Hopefully ~25 MB isn't too big for those with draconian data caps.

    (Link removed for now. I'll upload an updated version at some point.)

    Thanks beforehand!
     
    Last edited by a moderator: Nov 20, 2014
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,446
    Likes Received:
    6,491
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I haven't downloaded the project, but if you say that the lag starts when the lights are turned on...


    What are you using for the light? If you're using Khas' Lighting script - iirc that script is known to be very resource hungry and often causes lag if more than a few light sources are placed.
     
    #2
  3. Sophism

    Sophism Veteran Veteran

    Messages:
    36
    Likes Received:
    6
    First Language:
    English
    I'm using Zeus' Lights & Shadows script. I did try Khas' ages ago, and like you said, found it to be a huge resource hog. Zeus' worked splendidly until about halfway through working on the hub map, and then it suddenly halved the FPS. And soon afterwards, halved it again.

    I reduced the number of light sources as much as I could, even going so far as having malfunctioning lamp posts to justify it, but there's only so much I can remove without making the map way too dark.
     
    #3
  4. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,550
    Likes Received:
    2,902
    Location:
    Philippines
    First Language:
    Tagalog
    How big is the map? If you can't do without lightings, maybe you can do with making the maps smaller? Lighting scripts are inherently power hungry, no matter which one you use... You can try my Lanthanum lights and see if it does work a bit better, it has an option to frameskip the lighting update so that it doesn't update every frame...
     
    Last edited by a moderator: Oct 28, 2014
    #4
  5. Sophism

    Sophism Veteran Veteran

    Messages:
    36
    Likes Received:
    6
    First Language:
    English
    The map is 180x120. I can't easily section it off into separate screens, but I did try using Hime's Connected Maps script, and while it did wonders for the performance, it also completely broke her Tile Swap script, and it couldn't handle setting a transition into any section other than the top left one without breaking all the connections.

    Thanks for suggesting your lighting script. I'll be sure to look into it.
     
    #5
  6. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,550
    Likes Received:
    2,902
    Location:
    Philippines
    First Language:
    Tagalog
    That's pretty huge IMHO. Even on the default map size, I get lag with using a lighting script... XD
     
    #6
  7. Sophism

    Sophism Veteran Veteran

    Messages:
    36
    Likes Received:
    6
    First Language:
    English
    I did try your lighting script, but I seemed to get about a 10% decrease in performance per light after the first five even in the demo. God, how I wish the RPG Maker engine used proper hardware acceleration.  :(

    Honestly though, I don't think it's just the lighting that is causing my performance problems, although it's definitely compounding the issue. It's entirely possible the way I handled buildings becoming transparent when you walk behind them, (Specifically because of the hedge maze in that map.) is causing problems too. I'd once again love some suggestions on optimization in general.

    I realize that these are big boards with a lot of comers and goers, so it's unrealistic (And a little bit selfish of me.) to expect people to spend their own free time downloading and looking through a project that might never get finished. I intend to actually bring this to fruition no matter what, but a little push in the right direction would mean the world to me, and would likely save me at least a month of work if I were to be forced to redesign the entire hub map from the ground up.
     
    #7
  8. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,550
    Likes Received:
    2,902
    Location:
    Philippines
    First Language:
    Tagalog
    Anything graphics related takes quite a lot of power in RM since it only uses the CPU... The only way that I know of is to really reduce the things that update so often.
     
    #8
  9. Sophism

    Sophism Veteran Veteran

    Messages:
    36
    Likes Received:
    6
    First Language:
    English
    Thanks for the replies, Adiktuz. It's a little disheartening that no one looked into the actual project and tell me if there's anything else I can do. :(  (Other than light scripts being resource hogs, which I kind of already knew.) But I understand that I may be asking for too much here.

    I guess I'll bump this up to ask a couple of questions at least.

    Would it be worth investing time replicating the entire map as a parallax? If anyone is knowledgeable in that area, I'd love to know if it's feasible to use a parallax as big as my mansion exterior map. And would the light script still cause tremendous performance drops if there aren't any tiles being rendered?

    As usual, any help is appreciated.
     
    #9
  10. cabfe

    cabfe Cool Cat Veteran

    Messages:
    2,305
    Likes Received:
    2,385
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMVXA
    I tried on my old computer (and got 6 fps on average).

    So, first thing I tested was to disable a lot of scripts and effects: almost no increase. At best I got 7-8 fps.

    And then I realized that you have 420 events on your map.

    So I create a copy and place my new starting point there. With zero events.

    I got nearly 60 fps.

    I then added only one event, your first "startup" event.

    I got between 45-50 fps.

    A drop, but not a big one.

    That was a quick test, but I think the problem doesn't come from the scripts but from the huge number of events on the map.
     
    #10
  11. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    12,104
    Likes Received:
    12,287
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    Gave it a test, didn't feel too laggy on my computer to me. But, silly question, how do you check the FPS on RPGMaker?
     
    #11
  12. Shaz

    Shaz Veteran Veteran

    Messages:
    37,712
    Likes Received:
    11,421
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Question ... if you disable the lighting script, does the issue still happen when you switch to night mode? It could be your events themselves and not the script that's causing the lag.


    What's the deal with setting it to night and activating the lighting script - do you use an event to do that, set to parallel process? Any chance that event is not being erased or switched to a new page afterwards (so is continually activating the lighting script, 60 times a second)?


    @bgillisp, it's one of the function keys - F2 I think, but I can't check as I'm at work and don't have Ace with me.
     
    Last edited by a moderator: Nov 4, 2014
    #12
  13. Susan

    Susan Veteran Veteran

    Messages:
    2,766
    Likes Received:
    8,389
    Location:
    somewhere on this planet~
    First Language:
    No idea...
    Primarily Uses:
    RMMV
    The following could affect your FPS

    1) The size of your map (180 x 120).

    2) Activating pictures.

    3) The vast amount of events you have on the map.

    4) The many parallel process active on the map.

    5) The minimap script.

    6) The lighting script.

    7) Your computer's specs.

    Regarding parallax mapping, I have used one that was around 300 x 300 with 100 events with random movements. Only added on animated battler scripts and fix picture script. No parallel events. Didn't notice any lag. So maybe it could help.
     
    #13
    Marsigne and Dalph like this.
  14. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    12,104
    Likes Received:
    12,287
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    Ok, tried it again now that I know how to determine FPS, got 49 - 50 FPS at day, 9 - 11 FPS at night. Have you considered Yami's Anti-Lag script? I used that on a lagging map of mine and people report little lag anymore. Maybe it will help?
     
    #14
  15. Shaz

    Shaz Veteran Veteran

    Messages:
    37,712
    Likes Received:
    11,421
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    An antilag script would only affect it if it was events causing the issue. In that case, I suggest it's better to identify WHICH events, as they may be badly written. And if it IS a parallel process event as I suggested above, an antilag script wouldn't make a difference. (not that I'm against them - I use one and think they're a good idea - I'd actually like to improve mine based on discussions I've seen involving other scripters)


    ie - if it's events, it MAY be possible to solve the issue without adding more scripts.
     
    #15
  16. Sophism

    Sophism Veteran Veteran

    Messages:
    36
    Likes Received:
    6
    First Language:
    English
    First off all, thanks everyone for all the input! Now this lets me know that even in a best case scenario, no one is getting acceptable performance at night, and on an older computer, even daytime was unacceptably low.
     

     
    Yeah, I had a feeling the number of events would be problematic, so I just went through the entire map again, focusing only on every single event I have.
     
    I had to use some to make it so in this area...

    [​IMG]
    ...the player can walk over or below the edges of that elevation, depending on whether they're on lower or higher ground. But then I noticed that I did the same thing for the wooden railings in the servant's house, and in that case it was absolutely not needed. (In my sleep-deprived state when working on it, I completely forgot to set the star tiles for the railings to not be passable from the left.) Fixing this didn't do much, but I'm sure it helps.
     
    The most glaring problem is probably the way I'm handling transparency when the player walks behind walls. They're all set Parallel Process since they have to activate when the player sets foot in the regions behind a building or say one of the hedge maze's many walls. The biggest culprit in that regard is the maze. Since I wanted to have a hide-and-seek mini game happen there at some point, I had to separate the labyrinth into several regional clusters... it was the only way I could think of to do it properly... but I might be forced to just make it so whenever the player steps behind any of the walls in the maze, they all go transparent.
     
    As for the startup event dropping your framerate, I'm willing to bet it has to do with the film grain effect. The startup event turns that switch on by default, but when the project is further along, I intend to incorporate that visual filter as a toggle option in a settings menu.
     

     
    Just disabling the lighting script doesn't really work, because every light source uses some script calls exclusive to it, such as light.clear and whatnot. As for the lights being activated only at night, this is the way it handles that:

    [​IMG]
    None of them use Parallel Process triggers, but I'm unsure if the method Zeus uses for his setup tags basically turn them into parallel processes anyway. Removing every single light source in the map other than the player's candle, without changing anything else about the other events yields me anywhere between 20 to 35 FPS, depending on location, but I know that isn't exactly the same test you were asking for.

     
    The size of the map is definitely a part of the problem, although not one I can likely fix at this point.
     
    The activating pictures are pretty much the parallel processes themselves with very few exceptions, yeah. There are 40 of them in the hedge maze alone, which is once again pushing me into sacrificing the idea of having the maze walls be separated into clusters, and just making it one big image for every wall at once.
     
    The minimap was one of the first things I tested, and it barely impacted FPS. (I think I gained 1-2 FPS with it on or off, a sacrifice I'm more than willing to make.)
     
    The lighting script is for sure impacting the FPS quite a bit, despite my best efforts to reduce the number of light sources to the bare minimum I could handle.
     
    I'm glad to hear that parallax mapping seems viable even in a bigger map. (Holy cow, 300 x 300!) If after all my adjustments I still can't get a big improvement, I'm gonna be forced to try redoing the entire thing as a parallax.
     

     
    I do have Mog's Anti-Lag running, and it does wonders. (Just not miracles. :p )
     
    #16
  17. Susan

    Susan Veteran Veteran

    Messages:
    2,766
    Likes Received:
    8,389
    Location:
    somewhere on this planet~
    First Language:
    No idea...
    Primarily Uses:
    RMMV
    To reduce the amount of parallel processes for your maze game, try placing all your region related conditional branches in one parallel process event.

    Place them separately as though you are making separate events.

    I don't know how much this will impact your FPS, but at least it will reduce the number of running events on the map.

    Referring my parallax map, it is simply a test project I made to test out the hi res dll limits.

    There are no pictures, other running scripts or parallel processes.

    You can create a parallax map equivalent to your map using only one or two tiles, then place only events on that map and see if it will improve your FPS.

    I will try that out later on after work to see if it makes any difference & let you know the result so that you will not waste your time remapping everything.
     
    #17
    Marsigne, Dalph and Sophism like this.
  18. Sophism

    Sophism Veteran Veteran

    Messages:
    36
    Likes Received:
    6
    First Language:
    English
    I really appreciate the help Susan! With the assistance from you and the other posters I've actually managed to make some progress optimizing the hub map, and soon I might be able to move on to the rest of the game. Being stuck rebuilding it over and over for the last month and a half (And getting basically no improvement after each iteration.) was sapping my willpower fast.

    Merging all the image parallel processes into one did help quite a bit. While it's still far from ideal, it upped my FPS away from the most resource-intensive area of the map (Right next to the fountain, where it still drops down to 15.) to the 35-40 range. If I were to further merge all the maze walls into one, (Which I'd really rather not do.) it would increase the FPS next to the fountain to 25, and away from it into the 45-50 range.

    Now, investigating why the fountain area is so problematic, it seems to be related to the way I'm handling seats. It has always bugged me how in most games you can either never be able to sit on a chair or you just walk over them as if they were any other tile. So I created events that turn the character in the right direction, then fixes their direction facing that way, but still allows them to slide over on a bench, and once they step out of the seat, it removes the direction fix so that they can move around normally.

    This is the general parallel process that handles the direction fix being turned off, as well as seats facing up:

    [​IMG]
    Because of the way I had to layer the chairs, I was forced to create a blank event with the back of the chair graphic split from the actual tile, and with the Through flag turned on. Unfortunately the Through flag makes it so Player Touch doesn't work anymore, so I was then forced to set a region aside to accomplish it.

    And this is an example of the events I used for the other seats:

    [​IMG]
    There may be a way to do what I want - Having characters turn the right direction when sitting on a chair or bench, then being unable to turn around while on that tile. - without using so many events, but I can't think of one.  :unsure:

    Completely removing all of them would more than likely give at least some increase in performance next to the fountain in the park area. I'm just not ready to throw away the seats idea yet.
     
    Last edited by a moderator: Nov 5, 2014
    #18
  19. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    12,104
    Likes Received:
    12,287
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    I think I've found your problem, based on your posts above. Its the high number of parallel processes you have. The reason is, they run *every* frame update, regardless of whether they are needed or not (and I don't think an anti-lag script will stop that from happening either). So if you have 60 or so of them on a map, they will be checked every time, then the screen updates. That will slow the game down regardless of whatever else you do.

    My suggestion would be to 1) Put all the parallel processes into 1. Most maps I do don't lag with only 1 running (though I do have one with 1 parallel process + 400 events that gets sluggish at times, but not to the degree you are talking about), and 2) Zones that *have* to have a high number of processes, put them as a separate hub (like the park area). That should help fix the problem.
     
    Last edited by a moderator: Nov 5, 2014
    #19
  20. Susan

    Susan Veteran Veteran

    Messages:
    2,766
    Likes Received:
    8,389
    Location:
    somewhere on this planet~
    First Language:
    No idea...
    Primarily Uses:
    RMMV
    Sorry for taking so long to reply. I was testing out a few things (besides falling asleep).

    1) Parallax mapping option :

    Pros:+ It does seem to increase your FPS (a little) when used with empty graphics tiles from the map editor.

    + It can help reduce the amount of events you have to place on the map in order to achieve your desired effect.
    -> e.g the back facing benches can be placed with a star passability tile, rather than an event (thus increasing FPS in the localized area).

    Cons:
    - Does not seem to increase FPS by much, only 0-5 FPS.
    - You would have to remake your whole map in an image processing program (although Hime's Map Screenshot script could help lessen that load).
    - You would have to re-set passabilities on empty graphic tiles & remap those via the map editor.-

    - The light effects seem to be treated as separate entities from the tiles, so no improvement there.
    2) Fountain area lag:

    - Removing those events would definitely give some FPS increase, up to 15 for me.
    - You don't have to throw away the seats idea, you can use terrain tags on the seats according to direction and use a parallel process the same way you did with regions.
    Others:

    - Tsukihime has recently updated her Connected Maps script to support player/event transfer, but I doubt that'll help you.
    - The player seems to have a 'moving mirror image' seen on empty tiles. Could you try switching that effect off and check the FPS?
    - Your map events & light related events are definitely causing a lot of lag.
    - I'll check to see what else can be edited, changed or condensed.
    - Will let you know if I've reached a standstill though.
     
    #20
    Marsigne, Dalph and Sophism like this.

Share This Page