Lag caused by load_header and mouse script?

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
826
Reaction score
346
Primarily Uses
I'm having an issue with lag when I use the mouse cursor in the save screen. I'm using a modified version of Yanfly's Save Engine as well as Amaranth's Super Simple Mouse System.

There is no issue when I use the keyboard. I can bash up/down as fast as I can, and I do not notice any lag. When I try to mouse quickly between file names, however, the mouse becomes very jerky, and it might skip over several of the files. Despite that, F2 does not report any drop in frame rate.

I believe the issue is that when a new file is selected, the current save file's header is reloaded, and the file preview pane is redrawn. If this is the case, I'm looking for some input on the best way to fix this. My current thought is to just create preview windows for every save file when the scene is loaded and just have the current one be visible. The other option is to load the headers for every file into an array and redraw the preview pane based on that data. Or maybe I'm barking up the wrong tree.

Input or suggestions are greatly appreciated.

P.S. Sorry I'm on my phone, so I can't link directly to the scripts. It shouldn't be too important to see them though since I've explained what I believe the problem to be.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,072
First Language
English
I would try pre-loading all data and then draw the windows from there instead of loading the headers everytime.


I wouldn't try drawing all the windows beforehand if it takes a long time and you're probably not going to use half of them anyways.


It's unfortunate that yanfly chose to store EVERYTHING in the header (and in fact appears to be duplicating all of the data from the contents), as the majority of data is not even used.
 
Last edited by a moderator:

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
826
Reaction score
346
Primarily Uses
Oh, I've already removed the unneccesary data. :) I assume it is the repeated file opening in general that is causing the lag issue.

I'll try the preloading method and see if it makes a difference.

Edit: Preloading the headers did not make a difference. After some more testing, it appears the source of the lag is from draw_face. To be specific, the disposing of the bitmap at the end. Bitmaps aren't disposed when character sets or other pictures are blt'd to the window. Is it really neccesary in just this instance?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,533
Reaction score
12,057
First Language
English
Primarily Uses
RMMV
Depending on what version of the mouse script you're using, I was asked in the later versions to make it scroll more slowly. You MAY just need to comment that bit out - the first few lines of the process_mouse_handling method in the 3 window-related classes handle that.
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
826
Reaction score
346
Primarily Uses
I had already noticed that change, but it was occurring before I added that update. Like I said in my edit above, I've figured out the issue is with disposing the bitmap in the draw_face method of Window_Base. I guess my only remaining question is how necessary that dispose is? If I look at other methods in Window_Base like draw_icon or draw_character, they don't bother disposing the temporary bitmap loaded to blt onto the window. draw_face seems to be the only method in Window_Base that feels the need to do so.


I can't say I understand a lot about the memory allocation end of programming languages (if that is even what dispose is about), so I just want to confirm if removing that dispose is a bad thing or if it doesn't really matter.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,533
Reaction score
12,057
First Language
English
Primarily Uses
RMMV
If you do remove it, does the problem go away? If it doesn't, then you better put it back, as something else must be causing it. If the problem does go away, it's worth looking into. (in other words, I don't really know)
 
Last edited by a moderator:

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
826
Reaction score
346
Primarily Uses
Oh yeah, the problem disappears completely as far as I can tell when I remove the dispose call. My only concern is that I've seen some really strange errors pop up seemingly randomly when dispose methods get involved. But unless someone has some input on why that dispose call was even there in the first place, I guess this can be considered solved? I'll just make a mental note if I start getting seemingly random errors down the line.
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
826
Reaction score
346
Primarily Uses
The dispose call isn't in a Yanfly method. It's in the default draw_face method of Window_Base. Same with the default draw_icon and draw_character methods not having one.


[Edit] Looking at the link you posted, that particular error shouldn't occur in these circumstances. The bitmap is just temporarily created in the method so that it can be blt'd to the window's contents. There are no viewports involved. I'll leave the dispose line commented out for the time being and see how it goes.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just finished planning out the skeleton of the main quest line of my new game. I'm so excited for it!
Integrating Jason Perry's japan tile set while listening to Murray Atkinson's Heaven and Earth background music.
I forgot I had an account on rpgmakercentral lol
"What do you think the best place to visit on this cold days?" "Hell..."
Been so busy lately that I wonder if I should slowly start preparing the advent calendar resources so I have enough in december.

Forum statistics

Threads
94,538
Messages
921,723
Members
124,402
Latest member
KINGty
Top