设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 82|回复: 0

[转载发布] Lune Ultimate Anti-Lag

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9068

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58857
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68819

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    Lune Ultimate Anti-Lag
     
    Introduction
    This script will improve the games performance and handle better against parallel programming, multiple events and graphical systems/scripts
     
    Features
    - Corrected the classical bug in Anti-lags when teleporting other events
    - Handles smartly the FPS to adjust to the needs of each map and players PC
    - The classical anti-lag also present, in which events out of the map are only updated at your will
    - Increases the RPG Maker priority over other programs
     
    Portuguese user? Access the portuguese script here
     
    Screenshots
    Not necessary
     
     
    How to Use
    Put it above main and configure the script as necessary
     
    Script
     
     

    Spoiler#=======================================================#         Lune Ultimate Anti-Lag# Author: Raizen# Compatible with: RMVXAce# Comunity: centrorpg.com# This script allows a very well balanced anti-lag, in which# considers the own PC of the player, using a smart frame-skipper# to slow lags,#========================================================#To update constantly the event, put a commentary on the first# command of the script written :update:module Anti_conf#==============================================================================# ** Configurations#------------------------------------------------------------------------------#  Configure what is necessary for a better performance.#==============================================================================# Choose how the script will act.# <=====Quality============================Performance=====># 1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20# Default = 10Fr = 10# Configure the FPS rate (default = 60)Fps = 60# Configure the minimum FPS rate (default = 25)Mini = 25# Quantity of frames the anti-lag will study,# the higher the time, the more precise the script, # but will take longer to load the anti-lagTime = 60end=beginFunctions on this Anti-Lag* Common event positioning bug fixed* Smart Frame Skipper* updates what is only necessary* helps to lower lags from visual system/scripts* Changes its behavior according to the players PC* Increases the RPG Maker priority over other programs=end#=================================================================##=================================================================##====================  Alias methods =============================## command_203          => Game_Interpreter# start                => Scene_Map# update               => Scene_Map# perform_transfer     => Scene_Map#=================================================================##====================  Rewrite methods ===========================## update_events        => Game_Map# update_one_event     => Spriteset_Map#=================================================================##========================  New methods ===========================## need_to_update?      => Game_Event# near_the_screen?     => Sprite_Character# call_position_event  => Scene_Map# skip_calculate       => Scene_Map# update_one_event     => Spriteset_Map#=================================================================##=================================================================# #==============================================================================#============================  Início do Script!  =============================#==============================================================================#==============================================================================# ** Scene_Map#------------------------------------------------------------------------------#  Esta classe executa o processamento da tela de mapa.#============================================================================== class Scene_Map < Scene_Basealias lune_skip_start startalias lune_skip_update updatealias lune_perform perform_transfer  #--------------------------------------------------------------------------  # * Inicialização do processo  #--------------------------------------------------------------------------  def start    Graphics.frame_rate = Anti_conf::Fps    @update_skip = false    @count_up = 0    lune_skip_start  end  #--------------------------------------------------------------------------  # * Execução da transferência  #--------------------------------------------------------------------------  def perform_transfer    $get_new_ids = Array.new    Graphics.frame_rate = Anti_conf::Fps    lune_perform    @count_up = 0    @update_skip = false  end  #--------------------------------------------------------------------------  # * Atualização da tela  #--------------------------------------------------------------------------  def update    @update_skip ? lune_skip_update : skip_calculate  end  #--------------------------------------------------------------------------  # * Atualização de um personagem especifico  #--------------------------------------------------------------------------  def call_position_event(id)    @spriteset.update_one_event(id)  end  #--------------------------------------------------------------------------  # * Calcula o tempo necessário para rodar o update do Scene_Map  #--------------------------------------------------------------------------    def skip_calculate    @count_up += 1    return unless @count_up >= Anti_conf::Time    auto_skip = Time.now    lune_skip_update    old_skip = Time.now    get_skip = old_skip - auto_skip    Graphics.frame_rate -= (get_skip * Graphics.frame_rate * 2 * Anti_conf::Fr - 1).to_i    Graphics.frame_rate = [Graphics.frame_rate, Anti_conf::Mini].max    @update_skip = true  endend  #==============================================================================# ** Scene_Base#------------------------------------------------------------------------------#  Esta é a superclasse de todas as cenas do jogo.#==============================================================================class Scene_Basealias skipper_main main  #--------------------------------------------------------------------------  # * Processamento principal  #--------------------------------------------------------------------------  def main    @fr_cont = 0    skipper_main  end  #--------------------------------------------------------------------------  # * Execução da transição  #--------------------------------------------------------------------------  def perform_transition    Graphics.transition(transition_speed * Graphics.frame_rate / 60)  end  #--------------------------------------------------------------------------  # * Atualização da tela (básico)  #--------------------------------------------------------------------------  def update_basic    if @fr_cont >= 60      Graphics.update             @fr_cont -= 60    end    @fr_cont += Graphics.frame_rate    update_all_windows    Input.update  endend #==============================================================================# ** Aumento da prioridade do rpg maker#------------------------------------------------------------------------------Lune_high = Win32API.new("kernel32", "SetPriorityClass", "pi", "i")Lune_high.call(-1, 0x90)#============================================================================== #==============================================================================# ** Game_Event#------------------------------------------------------------------------------#  Esta classe gerencia os eventos. Ela controla funções incluindo a mudança# de páginas de event por condições determinadas, e processos paralelos.# Esta classe é usada internamente pela classe Game_Map. #============================================================================== class Game_Event < Game_Character  #--------------------------------------------------------------------------  # * necessário atualizar?  #--------------------------------------------------------------------------  def need_to_update?    return false unless @list    ax = $game_map.adjust_x(@real_x) - 8    ay = $game_map.adjust_y(@real_y) - 6    ax.between?(-9, 9) && ay.between?(-7, 7) || @list[0].parameters.include?(':update:')  endend #==============================================================================# ** Sprite_Character#------------------------------------------------------------------------------#  Este sprite é usado para mostrar personagens. Ele observa uma instância# da classe Game_Character e automaticamente muda as condições do sprite.#============================================================================== class Sprite_Character < Sprite_Base  #--------------------------------------------------------------------------  # * Evento próximo a tela?  #--------------------------------------------------------------------------  def near_the_screen?    ax = $game_map.adjust_x(@character.x) - 8    ay = $game_map.adjust_y(@character.y) - 6    ax.between?(-11, 11) && ay.between?(-8, 8)  endend#==============================================================================# ** Game_Event#------------------------------------------------------------------------------#  Esta classe gerencia os eventos. Ela controla funções incluindo a mudança# de páginas de event por condições determinadas, e processos paralelos.# Esta classe é usada internamente pela classe Game_Map. #============================================================================== class Game_Event < Game_Characteralias lune_ant_initialize initialize  #--------------------------------------------------------------------------  # * Inicialização do objeto  #     event : RPG::Event  #--------------------------------------------------------------------------  def initialize(*args, &block)    lune_ant_initialize(*args, &block)    $get_new_ids.push(@event.id)  endend #==============================================================================# ** Game_Interpreter#------------------------------------------------------------------------------#  Um interpretador para executar os comandos de evento. Esta classe é usada# internamente pelas classes Game_Map, Game_Troop e Game_Event.#============================================================================== class Game_Interpreteralias lune_lag_command_203 command_203  #--------------------------------------------------------------------------  # Definir posição do evento  #--------------------------------------------------------------------------  def command_203    lune_lag_command_203    SceneManager.scene.call_position_event($get_new_ids.index(@event_id))  endend#==============================================================================# ** Game_Map#------------------------------------------------------------------------------#  Esta classe gerencia o mapa. Inclui funções de rolagem e definição de # passagens. A instância desta classe é referenciada por $game_map.#============================================================================== class Game_Map  #--------------------------------------------------------------------------  # * Atualização dos comandos dos eventos  #--------------------------------------------------------------------------  def update_events    @events.each_value {|event| event.update if event.need_to_update?}    @common_events.each {|event| event.update}  endend  $get_new_ids = Array.new#==============================================================================# ** Spriteset_Map#------------------------------------------------------------------------------#  Esta classe reune os sprites da tela de mapa e tilesets. Esta classe é# usada internamente pela classe Scene_Map. #==============================================================================class Spriteset_Map  #--------------------------------------------------------------------------  # * Atualização dos personagens  #--------------------------------------------------------------------------  def update_characters    refresh_characters if @map_id != $game_map.map_id    @character_sprites.each {|sprite| sprite.update if sprite.near_the_screen? }  end  #--------------------------------------------------------------------------  # * Atualização de algum personagem remoto  #--------------------------------------------------------------------------  def update_one_event(id)    @character_sprites[id].update  endend



     
     

     
     
     
    FAQ
    Does it bugs the event position?
    Answer is in the topic
     
    If the FPS drops isn't it the same to just let the program decide?
     No, example, if you let your FPS drop to 20 without the anti-lag, it will be very unconstant the graphics frames, and will appear really "laggy", with the anti-lag it will set to 30 about, and will be way smoother the game.
     
    Credit and Thanks
    - Raizen- TheoAllen - for helping in bug fixing  



    本贴来自国际rpgmaker官方论坛作者:Raizen处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/lune-ultimate-anti-lag.9828/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-8 12:26 , Processed in 0.067195 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表