RGSS3 Plane

Tayruu

・ ゚*。・゚(幸)
Veteran
Joined
Apr 27, 2014
Messages
38
Reaction score
63
First Language
English
Primarily Uses
RM2k
I've found this script is incompatible with Victor's Fog script. ... well, "incompatible" isn't exactly the right word. It works, but it updates at a higher frequency than it should be, which causes it to "slide" around the screen at an accelerated rate. If I divide the ox/oy in the fog script by 2, the speed is okay, but the fogs stutter instead.

It leads me to wonder if the script is incorrectly assigning ox/oy.

A quick test in another project, and I'm pretty sure my planes are updating at a slightly faster rate than they should be. I'm not sure if it's the same rate, or what it is.

Altering the ox/oy in this script to be val.to_f/2 helped, but again I had some stuttering.

EDIT: It occurs to me now that altering the ox/oy definitions is actually the wrong way to approach this. While it might work for pan effects, one time setting gets thrown off if I divide it. What needs to be fixed is the update rate, but I don't see a way to deal with it.
 
Last edited by a moderator:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
I've tested several times and it seems to me that this script isn't compatible with Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars(which needs Yanfly Engine Ace - Ace Battle Engine) even without any extra dlls. The hp bars just don't show at all.

Although this script's order in the list obviously doesn't matter here, I tired all the 3 orderings(top, middle, bottom) and nothing changed. I've also tried to set ANIMATE_HP_GAUGE as both true and false, but bothing changed again. (So actually I've tested 6 combinations lol)

The hp bars are implemented using a new class which is inherited from Viewport. The below method initialize the hp bar instances:

#-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(battler, sprite, type) @battler = battler @base_sprite = sprite @type = type dw = YEA::BATTLE::ENEMY_GAUGE_WIDTH dw += 2 if @type == :back @start_width = dw dh = YEA::BATTLE::ENEMY_GAUGE_HEIGHT dh += 2 if @type == :back rect = Rect.new(0, 0, dw, dh) @current_hp = @battler.hp @current_mhp = @battler.mhp @target_gauge_width = target_gauge_width @gauge_rate = 1.0 setup_original_hide_gauge super(rect) self.z = 125 create_gauge_sprites self.visible = false update_position end
The below method creates the plane containing the bitmap used to draw the hp bars:

#-------------------------------------------------------------------------- # create_gauge_sprites #-------------------------------------------------------------------------- def create_gauge_sprites @sprite = Plane.new(self) dw = self.rect.width * 2 @sprite.bitmap = Bitmap.new(dw, self.rect.height) case @type when :back colour1 = Colour.text_colour(@battler.enemy.back_gauge_colour) colour2 = Colour.text_colour(@battler.enemy.back_gauge_colour) when :hp colour1 = Colour.text_colour(@battler.enemy.hp_gauge_colour1) colour2 = Colour.text_colour(@battler.enemy.hp_gauge_colour2) end dx = 0 dy = 0 dw = self.rect.width dh = self.rect.height @gauge_width = target_gauge_width @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2) @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1) @visible_counter = 0 end
After briefly reading this script's Plane implementations, I tried to edit the below method from:

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # bitmap # Get the tile bitmap of this instance of Plane. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- def bitmap @bitmap end
To:

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # bitmap # Get the tile bitmap of this instance of Plane. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- def bitmap @sprite.bitmap end
And the HP bars come back.

With ANIMATE_HP_GAUGE as true, their displays are as if the enemies' hps constantly reducing per frame, the reduction begins from full hp to 0 hp, and then the hp "comes" back at full and get reduced again, causing an endless reduction-reset-to-full loop.

The below method implements ANIMATE_HP_GAUGE:

#-------------------------------------------------------------------------- # update #-------------------------------------------------------------------------- def update super self.visible = gauge_visible? @sprite.ox += 4 if YEA::BATTLE::ANIMATE_HP_GAUGE update_position update_gauge @visible_counter -= 1 end
With ANIMATE_HP_GAUGE as false, everything works fine.

I tried to fix the issues myself, but as my above attempt clearly failed, and I still only know little about Plane, I think I need help on this one :)

P.S.: My wild guess is that the issues have something to do with the below method of this script:

Code:
  #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  # bitmap=  #   Set the tile bitmap of this instance of Plane.  #   bmp : Bitmap  #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  def bitmap=(bmp)    error_disposed if disposed?    if bmp.nil?      @sprite.bitmap = nil      return @bitmap = nil    end       w, h = vrect.width, vrect.height       nw = bmp.width <= 100 ? 2 : 3    nh = bmp.height <= 100 ? 2 : 3       dx = [(w / bmp.width).ceil, 1].max * nw    dy = [(h / bmp.height).ceil, 1].max * nh     bw = dx * bmp.width    bh = dy * bmp.height     @bitmap = bmp    key = [vrect.to_a, bmp.name]    if Cache.has_plane?(key)      @sprite.bitmap = Cache.plane(key)    else      @sprite.bitmap = Bitmap.new(bw, bh)           dx.times do |x|        dy.times do |y|          @sprite.bitmap.blt(x * bmp.width, y * bmp.height, @bitmap, @bitmap.rect)        end      end      Cache.add_plane(key, @sprite.bitmap)    end  end
 
Last edited by a moderator:

azuma01

Villager
Member
Joined
Jul 16, 2015
Messages
6
Reaction score
0
First Language
Ruby
Primarily Uses
I gess it is better to get an answer later than never...

but before, I will quote the first line of code

RGSS3Plane = Planethis mean than we can use the original Plane class like this : "RGSS3Plane.new"

So, to fix Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars script (or any script than use old Plane class) simply replace all "Plane" to "RGSS3Plane" in these said scripts.

I've found this script is incompatible with Victor's Fog script. ... well, "incompatible" isn't exactly the right word. It works, but it updates at a higher frequency than it should be, which causes it to "slide" around the screen at an accelerated rate. If I divide the ox/oy in the fog script by 2, the speed is okay, but the fogs stutter instead.

It leads me to wonder if the script is incorrectly assigning ox/oy.
not exacly, if the fogs moves like a plane do, the speed is based on the bitmap size. This rewrite of the Plane class always set his bitmap to be at least 4 times bigger.

for exemple :

pl = Plane.newbmp = Cache.system('Window')pl.bitmap = bmpp bmp.rect, pl.bitmap.rectthis will ouput :

(0, 0, 128, 128) # original bitmap(0, 0, 1920, 1152) # PlaneSO the Plane bitmap is 135 times bigger than the original bitmap
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Unfortunately, doing what you wrote (using the old one instead of the new one) will kill the FPS yet again in the case of big planes.


I am using this script because of the huge FPS boost it provides.


I have no idea if those small HP bars of Yanfly will have any impact on FPS, but a battle background on a 1024x768 resolution in Theo's SBS will drop my FPS by ~30, which is a huge difference (45 with the new plane class, ~12 with the old one). Even thou it fixes the battle camera, using it is not worth the FPS drop for me.


Also, the last time I checked, a plane's bitmap is a simple empty bitmap with the size of the plane's viewport itself. That empty bitmap will get filled with the assigned picture, and the plane scrolls it after. I might be wrong thou, since I never actually used the old plane class, but I am pretty sure that is how the new one operates.


In the case of the new class, the bigger the viewport of the plane, the bigger will be it's bitmap's rect.


And the smaller the assigned picture, the bigger will be the performance cost in the case of planes with big viewports (like a full screen plane). So, it is better to have a bigger picture for your planes than a smaller one, at least with this new plane class.
 

azuma01

Villager
Member
Joined
Jul 16, 2015
Messages
6
Reaction score
0
First Language
Ruby
Primarily Uses
Of course using the old Plane is suicidal in the case of big planes, but, in the case of Yanfly Enemy HP Bars case, the viewport size is below the 'standard' screen size. The old plane don't do much harm.

After taking a look to the HP bars script, I found why the bars dont show up : The bitmap is assigned to the plane then, after, draw the bars over it. The visible plane bitmap is never updated... So it display a big empty bitmap.

Here a quick patch

# This is a Compatibility Patch for FenixFyreX's Plane class rewrite and # Yanfly Battle Engine Add-On: Enemy HP Bars# By Azuma-01# check for the HP bar script and the Plane rewrite scriptsif ($imported||={})["YEA-EnemyHPBars"] && Object.const_defined?:)RGSS3Plane)  class Enemy_HP_Gauge_Viewport    #overwrite    def create_gauge_sprites      @sprite = Plane.new(self)      dw = self.rect.width * 2      bmp=Bitmap.new(dw, self.rect.height)      case @type      when :back        colour1 = Colour.text_colour(@battler.enemy.back_gauge_colour)        colour2 = Colour.text_colour(@battler.enemy.back_gauge_colour)      when :hp        colour1 = Colour.text_colour(@battler.enemy.hp_gauge_colour1)        colour2 = Colour.text_colour(@battler.enemy.hp_gauge_colour2)      end      dx = 0      dy = 0      dw = self.rect.width      dh = self.rect.height      @gauge_width = target_gauge_width      bmp.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2)      bmp.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1)      @visible_counter = 0      @sprite.bitmap = bmp    end  endend
Also, with some digging here and there, I realised than the plane cache is mostly useless : the Spriteset_Map dispose all his parallax bitmap (line 212). Result => the cache hold a bunch of disposed bitmap...

A quick fix for every one :) :

# This is a Fix for FenixFyreX's Plane rewrite cache system# it prevent Spriteset_Map to dispose the parallax bitmap# if the bitmap is in the cache.# By Azuma-01if Object.const_defined?:)RGSS3Plane)  class Spriteset_Map    # overwrite    def update_parallax      if @parallax_name != $game_map.parallax_name        @parallax_name = $game_map.parallax_name        @parallax.bitmap.dispose if @parallax.bitmap && !Cache.plane_cache.value?(@parallax.bitmap)        @parallax.bitmap = Cache.parallax(@parallax_name)        Graphics.frame_reset      end      @parallax.ox = $game_map.parallax_ox(@parallax.bitmap)      @parallax.oy = $game_map.parallax_oy(@parallax.bitmap)    end  endend
@Sixth : You should take a look to your Spriteset_Battle class and make sure than you do not dispose your plane bitmaps if they exists in the cache.
 
Last edited by a moderator:

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,583
Latest member
write2dgray
Top