Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Resources Consumption Meter
#4
One of the most expensive functions in RPG Maker is the Window#draw_text function. Even if a window is not visible, calling these draw commands would still consume resources.

One way to diagnose the problem is figure out which scene (or scenes) have the worse lag. Are you experiencing a slowdown on the map, in battle, or in a specific menu screen? Does this scene have a large window with a lot of things that get redrawn?

Other things to look for...
  • Scripts with a bunch of complex math calculations.
  • Scripts with a bunch of draw / draw_text functions.
  • Scripts that redraw gradient bars constantly.
  • Scripts which may be constantly re-sorting an array.
  • Two or more scripts which may be contradicting each other's functions.
  • Scripts which have recursion issues; do you randomly get Stack Level Too Deep?

If you want to profile a specific block of code you can do...

Code:
time = Time.now

# ...The function...

puts("Execution Time: #{Time.now - time}")

...which should tell you how long it takes for a function to complete. Most functions should take fractions of a second. If it takes a half second or longer, you've probably found the culprit (or one of many culprits.)

A HUD is an easy example of a script which can lag if not done correctly. For instance, if the HUD constantly redraws HP and SP (even when those values haven't changed), it will lag. If Hero 1's HP changes, but the entire HUD gets redrawn from that single change, that can cause lag too. Clearing the rect of only the item that needs to be redrawn, and redrawing only that item, is more economical than redrawing everybody's everything because of 1 person's change.

Hope this helps. Best of luck to you.
[Image: Button-BOTB.png]
[Image: Save-Point.gif][Image: Button-You-Tube2.png][Image: Button-Sound-Cloud2.png][Image: Button-Audio-Mack2.png]
[Image: LS-Banner.gif]
NEW ALBUM OUT NOW!

Reply }


Messages In This Thread
Resources Consumption Meter - by Whisper - 05-27-2023, 01:26 AM
RE: Resources Consumption Meter - by kyonides - 05-27-2023, 01:59 AM
RE: Resources Consumption Meter - by DerVVulfman - 05-27-2023, 04:52 AM
RE: Resources Consumption Meter - by Kain Nobel - 05-27-2023, 08:59 AM
RE: Resources Consumption Meter - by Whisper - 05-27-2023, 10:17 PM
RE: Resources Consumption Meter - by kyonides - 05-27-2023, 10:43 PM
RE: Resources Consumption Meter - by Whisper - 05-29-2023, 03:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Custom meter problem daylights 13 14,316 08-12-2013, 03:34 AM
Last Post: daylights



Users browsing this thread: