Best way to avoid redrawing text during Scene updates?

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
88
First Language
English
Primarily Uses
RMVXA
This may seem like a dumb question, but I haven't yet found a good solution for this problem. I'll start off with a screencap here:

Essentially I've created a pretty detailed stat window on the right using a large series of draw_text methods in a custom Window_Base child class. In Scene_Skill's update_basic, I made sure to update the detail window to match @item_window.item. Simple.

Now the big issue is that this is a metric s**t ton of text to draw. So much so that it's causing noticeable lag when the Scene is up. Preferably, I'd like this window to update only when the @item_window index is altered, but this has become very difficult to do efficiently. There's also the issue that the detail window needs to show and hide when the @command_window opens/closes. I'll try to keep this simple; I just need a way to avoid redrawing all this text every single frame.

I figure this isn't the first time someone has run into this issue so I hope there's a straightforward answer I'm just overlooking. If anyone needs more details on this Window class, feel free to ask and I'll try to be as detailed as possible. Thanks in advance!
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
You see, you could try to look at the default script example on updating the window help. Like, why don't you ask the window help didn't get redrawn every single frame, but only change when you select a different item?

The method is located in call_update_help and update_help methods in any window that inherited from Window_Selectable, that means including Window_ItemList. If that is what you're looking for. What you need to do is to insert another window that behaves like help window.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
One way is to make a new instance variable called index_old for the item window, on the update method of your scene, only update the text window if the item window's index != index_old... Then alias the select method (or child overwrite it if your command window didnt overwrite it from the parent) and set index_old to be equal to the new index.

Or you could also go Theo's route and only update the text window when the item window's select method is triggered...

You can also view the default scripts related to Scene_Skill since afaik, the default system only updates the skill list window when you're changing categories (skill types)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,584
Latest member
Faustus2501
Top