Picture Bug Fix
Authors: Raizen884, Johnbolton, Gab!
Version: 1.0
Type: Bug Fix
IntroductionWhile I was beta testing for VXAce, I noticed that after a specific amount of picture disposal the game will start lagging. This is more obvious when you disposed 4 1280x1280 pictures and a few smaller amounts. The sad thing is that the lag is permanent. Trying Cache.clear with GC.start didn't help me with this problem. Luckily, a few guys from CentroRPGmaker found out about this and has created a fix. They also shared it with the English community and I figured I'll post it in here as well.
Note: This has already been reported to Eb! And we're not sure yet if this fix will be applied, but just in case :)
Features
- Clears Pictures that you already disposed to avoid permanent lag.
ScreenshotsN/A
DemoNo demo.
Script[SPOILER]
#==============================================================================
# Picture Bug Fix
#------------------------------------------------------------------------------
# Author : Raizen884
# Credits : JohnBolton, Gab!
# Community : www.centrorpgmaker.com
# This script corrects a bug in the default scripts in which pictures continued
# to be updated even after they were erased, which caused lag.
#------------------------------------------------------------------------------
# Place this script above all other scripts in the Materials section.
#==============================================================================
class Sprite_Picture < Sprite
def update
super
if @picture.name != ""
update_bitmap
update_origin
update_position
update_zoom
update_other
else
self.bitmap.dispose if self.bitmap != nil
end
end
end
[/SPOILER]
InstructionsIn the script.
CompatibilityShould work with anything.
Credits and Thanks
- Raizen884
- Johnbolton
- Gab!
- Touchfuzzy - for the proper script formatting.
Author's NotesThere were 2 members which were trying to fix this, me and JohnBolton, it took some time because there was no error log, but JohnBolton, which has some scripts here found where was the problem. Also special thanks for Gab! which helped us out also, even though it is a very small script, it took some time to find where was the problem.
Enjoy! :)
Picture Bug Fix
Author: Mithran
Version: 1.0
Type: Bug Fix
IntroductionThe problem is caused when a picture is erased it holds an assoicated "picture" object in memory as long as you stay on the same scene. Every time that picture object comes up, it creates a NEW blank bitmap, every frame, basically if you want it to lag, create a lot of blank pictures when they get garbage collected, it lags. Each erased picture creates a single 32x32 blank bitmap to associate itself with, every frame, same with any picture shown as (none). Since the lag is caused by garbage collection, which is basically uncontrollabe with Ruby.
The reason why it constantly creates new blank pictures is because the base scripts check for the picture name. And if it's "" (aka no picture name), it keeps creating. When a picture is erased, it sets to ""
Features
- Clears Pictures that you already disposed to avoid permanent lag.
ScreenshotsN/A
DemoNo demo.
Script[SPOILER]
#==============================================================================
# ? Mithran Picture Bug Fix
# -- Created: 3/12/2012
#==============================================================================
# The problem is caused when a picture is erased it holds an assoicated "picture"
# object in memory as long as you stay on the same scene. Every time that picture
# object comes up, it creates a NEW blank bitmap, every frame, basically if you
# want it to lag, create a lot of blank pictures when they get garbage collected,
# it lags.
# Each erased picture creates a single 32x32 blank bitmap to associate
# itself with, every frame, same with any picture shown as (none). Since the lag
# is caused by garbage collection, which is basically uncontrollabe with Ruby.
#
# The reason why it constantly creates new blank pictures is because the base
# scripts check for the picture name. And if it's "" (aka no picture name),
# it keeps creating. When a picture is erased, it sets to ""
#
# This script fixes that.
#==============================================================================
class Sprite_Picture
def update_bitmap
if @picture.name != @pic_name
self.bitmap = Cache.picture(@picture.name)
end
@pic_name = @picture.name
end
end
class Spriteset_Map
def update_pictures
$game_map.screen.pictures.each do |pic|
@picture_sprites[pic.number] ||= Sprite_Picture.new(@viewport2, pic)
@picture_sprites[pic.number].update
if pic.name == ""
$game_map.screen.pictures.remove(pic.number)
@picture_sprites[pic.number].dispose
@picture_sprites[pic.number] = nil
end
end
end
end
class Game_Pictures
def remove(index)
@data[index] = nil
end
end
InstructionsIn the script.
CompatibilityShould work with anything.
Credits and Thanks
Author's NotesThe difference with this one and the previous one is that it doesn't remove the stored picture data. It's still a stored empty image.
[/list]
I'm kind of confused, do I get both or just the second one? I read the descriptions of both and still not sure if I need them both.
Just get the 2nd one if you're using the Japanese version :3
I am using English version.