Battle hp and mp bars cause fps drop

SweetMeltyLove

Veteran
Veteran
Joined
May 4, 2015
Messages
113
Reaction score
155
First Language
English
Primarily Uses
RMVXA
During battle I was getting 25~40 fps so I decided to investigate what was causing it. After a little bit I found out it's the hp and mp bars that cause it. Disabling them raised my fps to 55~57


With a little more snooping around, I found out it's the update_rate function the culprit. Seems like simply calculating IF the bar should update is enough to cause the fps drop


This is update_rate:


def update_rate
rate = [(@rate - real_rate).abs, setting[:ani_rate]].min
@rate += @rate > real_rate ? -rate : rate
refresh if rate > 0
end


But replacing it with


def update_rate
refresh
end


Is enough to raise the fps from 30 to 50


Same thing with the HP and MP numbers. After changing all of this I now get 58 or 59 fps constantly in battle. The only downside is that the bar width doesn't slide down anymore
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
It seems odd to me that simple math and logical comparisons would cause the engine to chug that much more than actually refreshing the graphics every time the math/logic runs, though I suppose it's possible if you're using an ancient or crammed-to-the-gills computer or the refresh itself does a super-quick eval on whether to actually process the re-draw.  I haven't looked at the script in question so I couldn't say for sure.


I've had a lot of success in Ace with Vlue's very lightweight Enemy HP Bars script; I use it in the same project as Luna Engine (above all of the Luna Engine scripts).  Not that this is meant to solve your problem, and it's great that you brought this possible inefficiency in the scripts to Archeia's attention - but if you need HP Bars and can't afford the slowdown you're seeing, this could be a good stopgap for you.
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
I don't get any FPS drops so I don't know how to help with that one exactly :x
 

SweetMeltyLove

Veteran
Veteran
Joined
May 4, 2015
Messages
113
Reaction score
155
First Language
English
Primarily Uses
RMVXA
It seems odd to me that simple math and logical comparisons would cause the engine to chug that much more than actually refreshing the graphics every time the math/logic runs, though I suppose it's possible if you're using an ancient or crammed-to-the-gills computer or the refresh itself does a super-quick eval on whether to actually process the re-draw.  I haven't looked at the script in question so I couldn't say for sure.


My PC is pretty decent (4gb ram, 1ghz processor, good gpu)

I've had a lot of success in Ace with Vlue's very lightweight Enemy HP Bars script; I use it in the same project as Luna Engine (above all of the Luna Engine scripts).  Not that this is meant to solve your problem, and it's great that you brought this possible inefficiency in the scripts to Archeia's attention - but if you need HP Bars and can't afford the slowdown you're seeing, this could be a good stopgap for you.


The problem here is with the player's status info, i'm not using any enemy bars

I don't get any FPS drops so I don't know how to help with that one exactly :x


Might be some weird interaction with some other script then. But hey it's running really well now so it's all fine
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
The problem here is with the player's status info, i'm not using any enemy bars
My bad for the misunderstanding; I thought you were talking about enemy bars for some reason.  But with this understood, I can say that I do use the Luna Engine's actor HUD bars (picture mode, even), have similar computer specs to you, and have not seen any lag whatsoever in my game's battles - in fact, the battle system is the only thing in my game that's constantly running at a smooth 59-60 FPS.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top