Project1
标题:
为什么有时候会很卡?
[打印本页]
作者:
Lufsdadsc
时间:
2012-12-9 17:17
标题:
为什么有时候会很卡?
各位大神,行走的时候很卡,是怎么回事?
作者:
喵呜喵5
时间:
2012-12-9 17:57
敲一下F2看看标题栏上显示的桢率是否为60FPS,如果不是……
事件过多、电脑配置太差、后台程序开太多……
作者:
j433463
时间:
2012-12-9 18:54
本帖最后由 j433463 于 2012-12-9 18:56 编辑
我有使用两个脚本,觉得行走卡的情况比较减轻,一个是在 6R 这儿看到的防 lag 脚本,
一个是在国外 RGSS3 论坛上看到的 Mithran Picture Bug Fix 脚本,用来清除 Bitmap 的癈弃图片,
不妨试试吧:
防lag脚本 --
#==============================================================================
# ☆ HAR - Anti Lag (Dispose) Animation (v1.0)
# 日期:2012/09/23
#==============================================================================
# -- 作者: Moghunter
# -- 翻译: Harinlen
# -- 等级: 系统底层级
# -- 依赖关系: 无
# -- 适用范围: RPG Maker VX Ace
# -- 不兼容脚本: 暂无
#==============================================================================
# ☆ 声明
# 此脚本非本人所作,请保留作者信息。
#==============================================================================
# ☆ 用途
# 此脚本将删除锁定(滞后)有关的动画。
#
# 在执行过程中的RPG Maker VX ACE需要相当长的时间读取或删除(配置)。 (图像,声音
# 或视频)。最后结果就是你的游戏变得非常卡,这个脚本的能力就是将动画同时播放。简单
# 的说,就是让动画同时播放的能力。
#==============================================================================
# ☆ 用法
# 在Main前面插入一个脚本页,把此代码扔进去即可。
#==============================================================================
# ☆ 注意
# 此脚本不删除锁定时间的动画效果,只是删除了和时间有所联系的动画效果。
# (雾,原文就是此意思。)
#==============================================================================
#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :animation_garbage
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_initialize initialize
def initialize
@animation_garbage = []
mog_anti_lag_animation_initialize
end
end
#===============================================================================
# ■ Game System
#===============================================================================
class Game_System
attr_accessor :anti_lag_animation
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_antilag_animation_initialize initialize
def initialize
@anti_lag_animation = true
mog_antilag_animation_initialize
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
#--------------------------------------------------------------------------
# ● Call
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_call call
def call(scene_class)
mog_anti_lag_animation_call(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Goto
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_goto goto
def goto(scene_class)
mog_anti_lag_animation_goto(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Dispose Animation Garbage
#--------------------------------------------------------------------------
def dispose_animation_garbage
return if $game_temp.animation_garbage == nil
for animation in $game_temp.animation_garbage
animation.dispose
end
$game_temp.animation_garbage = nil
end
end
#==============================================================================
# ■ Game Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_setup setup
def setup(map_id)
SceneManager.dispose_animation_garbage
mog_anti_lag_animation_setup(map_id)
end
end
#==============================================================================
# ■ Scene Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_terminate terminate
def terminate
mog_anti_lag_animation_terminate
SceneManager.dispose_animation_garbage
end
end
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● Dispose Animation
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_dispose_animation dispose_animation
def dispose_animation
if $game_system.anti_lag_animation
execute_animation_garbage
return
end
mog_anti_lag_animation_dispose_animation
end
#--------------------------------------------------------------------------
# ● Execute Animation Garbage
#--------------------------------------------------------------------------
def execute_animation_garbage
$game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
if @ani_bitmap1
@@_reference_count[@ani_bitmap1] -= 1
if @@_reference_count[@ani_bitmap1] == 0
$game_temp.animation_garbage.push(@ani_bitmap1)
end
end
if @ani_bitmap2
@@_reference_count[@ani_bitmap2] -= 1
if @@_reference_count[@ani_bitmap2] == 0
$game_temp.animation_garbage.push(@ani_bitmap2)
end
end
if @ani_sprites
@ani_sprites.each {|sprite| sprite.dispose }
@ani_sprites = nil
@animation = nil
end
@ani_bitmap1 = nil
@ani_bitmap2 = nil
end
end
$rgss3_mog_anti_lag_animation = true
复制代码
Mithran Picture Bug Fix --
#==============================================================================
# ▼ 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
复制代码
作者:
c248611
时间:
2012-12-9 21:07
2L解决了
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1