Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Blizzard on January 09, 2008, 08:30:06 am

Title: [XP] Blizz-ABS Event Anti-Lag
Post by: Blizzard on January 09, 2008, 08:30:06 am
Blizz-ABS Event Anti-Lag
Authors: Blizzard
Version: 3.3
Type: Performance Improving System
Key Term: Game Utility

Introduction

This script will decrease the lag caused by events on the map by disabling the update of events beyond the visible screen when their sprite is not visible on the screen anymore. All graphical sprites for events are substituted with a controller that handles those sprites. If an event's update is disabled, the event's sprite will be disposed and completely removed from the memory. "Auto-Start" and "Parallel Process" events are NOT affected by this script. If a character is moving outside of the screen, he will be updated as event, but not as sprite.

This work is licensed under BSD License 2.0:
QuoteCopyright (c) Boris "Blizzard" Mikić
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1.  Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.

2.  Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

3.  Neither the name of the copyright holder nor the names of its contributors
    may be used to endorse or promote products derived from this software
    without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

You may use this script for both non-commercial and commercial products without limitations as long as you fulfill the conditions presented by the above license. The "complete" way to give credit is to include the license somewhere in your product (e.g. in the credits screen), but a "simple" way is also acceptable. The "simple" way to give credit is as follows:
QuoteBlizz-ABS Event Anti-Lag (ABSEAL) licensed under BSD License 2.0, Copyright (c) Boris "Blizzard" Mikić

Alternatively, if your font doesn't support diacritic characters, you may use this variant:
QuoteBlizz-ABS Event Anti-Lag (ABSEAL) licensed under BSD License 2.0, Copyright (c) Boris "Blizzard" Mikic

In general other similar variants are allowed as long as it is clear who the creator is (e.g. "ABSEAL created by Blizzard" is acceptable). But if possible, prefer to use one of the two variants listed above.

If you fail to give credit and/or claim that this work was created by you, this may result in legal action and/or payment of damages even though this work is free of charge to use normally.


Features

In comparison to other scripts:
v2.0
v3.0
v3.0b
v3.1
v3.2
v3.3


Screenshots

N/A for this sort of script.

Demo

Blizz-ABSEAL Demo (https://downloads.chaos-project.com/scripts/Blizz-ABSEAL.zip)

Script

Just make a new script above main and paste this code into it.
Script Download (https://downloads.chaos-project.com/scripts/Blizz-ABSEAL.txt)

Instructions

Inside the script in the first comment.

Compatibility

99% compatible with SDK v1.x. 80% compatible with SDK v2.x. Can cause incompatibility issues with map graphic manipulating scripts. This script comes UNDER all scripts that manipulate the Sprite_Character class. Can cause problems with Scripts that manipulate instances of the Sprite_Character class from the "outside".

Credits and Thanks


Author's Notes

This EAL is a simplified version of Blizz-ABS's original EAL. If you are using Blizz-ABS, please remove this script. Blizz-ABS has the full version of Blizz-ABSEAL built-in.

If you find any bugs, please report them here:
http://forum.chaos-project.com

That's it! N-Joy! =D
Title: Re: [XP] Blizz-ABSEAL
Post by: Blizzard on May 09, 2008, 12:26:23 pm
Blizz-ABS 3.0 is up. :3

Blizz-ABSEAL 3.0b is up. >.<

MORE POWERFUL THAN EVER
Title: Re: [XP] Blizz-ABSEAL
Post by: Fantasist on December 10, 2008, 01:29:12 pm
I made a script to play animations over events on the map. It's not working with the sprite control of Blizz-ABSEAL. Sprite_Character#loop_animation isn't available b/c Sprite_Character is no longer an RPG::Sprite. If I comment the sprite control part in Blizz-ABSEAL, it works fine. I'm using version 3.0b. Any suggestions?

class Spriteset_Map
 
  def animate(id=0, anim_id=98)
    if id > 0
     @character_sprites.each {|sprite_character|
      if sprite_character.character.id == id
        sprite_character.loop_anim=anim_id
      end}
    else
      @character_sprites.each {|sprite_character|
      if sprite_character.character.is_a?(Game_Player)
        sprite_character.loop_anim=anim_id
      end}
    end
  end
 
end

class Sprite_Character
 
  def loop_anim=(id=nil)
    anim = id ? $data_animations[id] : nil
    loop_animation(anim)
  end
 
end

class Scene_Map
  attr_reader :spriteset
end



PS: First (non-author) post, yay ^_^'
Title: Re: [XP] Blizz-ABSEAL
Post by: Blizzard on December 10, 2008, 04:02:52 pm
You can put it in Control_Sprite_Character for Blizz-ABSEAL to work. Just check out the code of the script, it's not complicated.
Title: Re: [XP] Blizz-ABSEAL
Post by: Fantasist on December 11, 2008, 07:05:16 am
By 'it', you mean the code for loop_animation from RPG::Sprite? Or do you mean this:
def loop_anim=(id=nil)
    anim = id ? $data_animations[id] : nil
    loop_animation(anim)
  end


Or God forbid, do you mean Ulta XD
Title: Re: [XP] Blizz-ABSEAL
Post by: Blizzard on December 11, 2008, 07:09:53 am
Add this additionally below Blizz-ABSEAL:

class Control_Sprite_Character
 
  def loop_anim=(id=nil)
    @sprite.loop_anim = id if @sprite != nil
  end
 
end


Your own code goes above Blizz-ABSEAL.

Also, instead of "if sprite_character.character.is_a?(Game_Player)" better use "if sprite_character.character == $game_player". This would make it better working with Blizz-ABS even though Blizz-ABS actually has loop animations implemented "character.loop_animation_id = ID". >.<
Title: Re: [XP] Blizz-ABSEAL
Post by: Fantasist on December 11, 2008, 07:18:29 am
Thanks Bliz, that solved the problem :)

QuoteAlso, instead of "if sprite_character.character.is_a?(Game_Player)" better use "if sprite_character.character == $game_player". This would make it better working with Blizz-ABS even though Blizz-ABS actually has loop animations implemented "character.loop_animation_id = ID". >.<


I'll do that. I wanted to implement the "character.loop_animation_id" thing, but I figured it's not necessary. btw, it's not for the BABS game, it's for QC :P
Title: Re: [XP] Blizz-ABSEAL
Post by: Blizzard on June 22, 2011, 01:33:30 pm
It should, there is no reason that it doesn't.
It might not work properly with Mode 7, but it might work out if you change the the order of your scripts.
Title: Re: [XP] Blizz-ABSEAL
Post by: Apidcloud on August 22, 2011, 12:23:01 pm
Gratz for the script lool xD
I really heard good comments about it already =)

Also, the demo that you posted works really well eheheh

Btw, once, a friend of mine said that if the event name was 'noupdate' it wouldn't be updated or something...Know anything about this?
Thanks and congratz once more =)
Title: Re: [XP] Blizz-ABSEAL
Post by: Magus on August 22, 2011, 01:01:58 pm
Blizz abseal doesn't really work right for 2.8 O_O. I have to manually use script calls to disable and enable blizzabs ._. For maps and what not
Title: Re: [XP] Blizz-ABSEAL
Post by: Blizzard on August 22, 2011, 05:35:47 pm
You don't use this script if you are using Blizz-ABS.
Title: Re: [XP] Blizz-ABSEAL
Post by: Apidcloud on August 22, 2011, 09:54:27 pm
Quote from: Blizzard on January 09, 2008, 08:30:06 am
This EAL is a simplified version of Blizz-ABS's original EAL. If you are using Blizz-ABS, please remove this script. Blizz-ABS has the full version of Blizz-ABSEAL built-in.

Quote from: Magus on August 22, 2011, 01:01:58 pm
Blizz abseal doesn't really work right for 2.8 O_O. I have to manually use script calls to disable and enable blizzabs ._. For maps and what not


*Points to epicness*

Title: Re: [XP] Blizz-ABSEAL
Post by: Magus on August 30, 2011, 04:34:16 pm
No, I'm talking about the Blizz-abseal that's built into Blizz-abs.  It's not working right for some reason, but I've gotten used to disabling and enabling things manually.
Title: Re: [XP] Blizz-ABSEAL
Post by: Blizzard on August 30, 2011, 04:37:41 pm
IDK, you should post that in the Blizz-ABS thread then so winkio can take a look at it. This thread is for the separate Blizz-ABSEAL script, unrelated to Blizz-ABS.
Title: Re: [XP] Blizz-ABSEAL
Post by: Magus on August 30, 2011, 04:38:28 pm
Ok.  I'll just copy and paste a few points from here.
Title: Re: [XP] Blizz-ABSEAL
Post by: Poe on December 04, 2011, 05:36:35 pm
maybe i'm doing something wrong here... i'm having some trouble understanding this bit:

QuoteIf a character is moving outside of the screen, he will be updated as event, but not as sprite.


so events outside of screen are supposed to still get their movement code updated? because i tried that and the event stays at the same location until i move into range (unless i set it to parallel process, but that kinda defies the point).
Title: Re: [XP] Blizz-ABSEAL
Post by: ForeverZer0 on December 04, 2011, 05:53:30 pm
Do you have AUTO_KILL set to false?
Title: Re: [XP] Blizz-ABSEAL
Post by: Poe on December 05, 2011, 02:32:54 pm
i've tried both false and true, same behavior, the event only starts moving when the player moves into visual range.

i put it in a completely fresh project because i thought it might be caused by a pathfinding script but the same thing happens (or doesn't happen).
Title: Re: [XP] Blizz-ABSEAL
Post by: LiTTleDRAgo on December 06, 2011, 11:59:17 pm
try remove this part

Quote
  alias upd_player_abseal_later update
  def update
    upd_player_abseal_later if self.update? || self.moving?
  end



that part of code is too evil
Title: Re: [XP] Blizz-ABSEAL
Post by: ForeverZer0 on December 07, 2011, 12:32:23 am
Umm... I think deleting that part effectively makes the script do absolutely nothing. The whole point is to catch the update method, and stop it from working if its not needed. By removing that part, it will just behave normally, and the script becomes just a bunch of worthless text in the editor.
Title: Re: [XP] Blizz-ABSEAL
Post by: LiTTleDRAgo on December 07, 2011, 10:13:37 am
ah..... then, how about adding this line ?

Quote
  def update?
    return true if NO_ABSEAL_IDS.include?($game_map.map_id)
    return true if [3, 4].include?(self.trigger)
    return true if @move_route_index < @move_route.list.size
    return false if AUTO_KILL && @character_name == '' && @tile_id < 384
    return false if @real_x >= $game_map.display_x + 20 * 128 - @sprite_size[0]
    return false if @real_x < $game_map.display_x - @sprite_size[1]
    return false if @real_y >= $game_map.display_y + 15 * 128 - @sprite_size[2]
    return false if @real_y < $game_map.display_y - @sprite_size[3]
    return true
  end
Title: Re: [XP] Blizz-ABSEAL
Post by: Poe on December 07, 2011, 01:42:55 pm
that did it, thanks.:)
Title: Re: [XP] Blizz-ABSEAL
Post by: Blizzard on December 07, 2011, 02:53:18 pm
Quote from: ForeverZer0 on December 07, 2011, 12:32:23 am
Umm... I think deleting that part effectively makes the script do absolutely nothing. The whole point is to catch the update method, and stop it from working if its not needed. By removing that part, it will just behave normally, and the script becomes just a bunch of worthless text in the editor.


Actually I'm not entirely sure about that. Events will keep being updated, but their sprites still won't. Obviously, you're still right about an update overhead for events.
Title: Re: [XP] Blizz-ABSEAL
Post by: ForeverZer0 on December 07, 2011, 02:57:39 pm
Ah yes, sprite updating is handled in Spriteset_Map, not through the event.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: syldocaine on June 20, 2013, 02:56:04 pm
First at all this masterpiece of work rescued my whole project from being a lag chaos.

But i have one question: Is there a way to fix it that big sprites pop up if im walking from north to south for example the big waggons from the standart RTP?
It's not that big problem but it would be cool.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Kise on May 05, 2015, 10:31:39 am
Looks really good, but I can't use it because of this error - http://ifotos.pl/z/wwnexrh/ Any ideas how I can fix that?
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: KK20 on May 05, 2015, 02:43:39 pm
This is an error related to RGSS3, not the script itself. Because you are using XPA, you should refer to the XPA topic instead as the "superclass mismatch" error has been reported and solved multiple times now.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Zangetsu on July 06, 2015, 11:01:39 pm
Hi, I am having a problem.

Is this script compatible to the "Emotions script" by Ánemus? It seems to have an error...

I will paste the code here if it helps. :)

#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>SCRIPT<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
#                        Emotions Script                        #
#                by Ánemus (www.arcadiumrpg.net)                #
#                                                               #
#  This script shows emotions over the player or over the other #
#                     characters of the map.                    #
#                                                               #
#                  $scene.emotion(id,ev,image)                  #
#                                                               #
#           For any comments: anemus@arcadiumrpg.net            #
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>SETTINGS<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
# Number of Repetitions or LOOP:                                #
# That's the number of times the animation of the emotion will  #
# repeat. I recomend 1, because bigger numbers are just way to  #
# repetitive.                                                   #
LOOP = 1
#                                                               #
# Delay:                                                        #
# That's the slowness of the animation. I recomend 3 or 4,      #
# smaller numbers are like flashes, so they aren't really       #
# useful.                                                       #
DELAY = 5
#                                                               #
# Deafult file for emotions:                                    #
# This is a tool to make it easier to use, this way you just    #
# write the id of the animation and the event where you want to #
# show it.
DEFAULTFILE = "Balloon"
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>INSTRUCTIONS<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
# Whenever you want to use it just use Call Script command      #
# then write:                                                   #
# $scene.emotion(id, ev, image)                                 #
# Being id the number of the emotion in the file (the top one is#
# the 0 and the lowest one the 9), ev the event over which you  #
# are showing the emotion (being -1 for the player and any      #
# other number for events, and image, that is the image file    #
# that you are using for the emotions. This file is to be placed#
# on Pictures folder and should be 256x320 px.                  #
#                                                               #
# Some tips:                                                    #
# If you are using the emotion file specified in DEFAULTFILE    #
# you dont need to include it in the sentence.                  #
# $scene.emotion(id, ev)                                        #
# Now if you are using the default file and also placing the    #
# emotion on the main character, the sentence is reduced to:    #
# $scene.emotion(id)                                            #
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>END<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#

#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>CODE<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
class Sprite_Character < RPG::Sprite
  alias :old_updateEmo :update
  def update
    old_updateEmo
    if @frames != nil
      @pic.x = (@character.screen_x + 5)
      @pic.y = (@character.screen_y - @ph - @ch.to_i+2)
      if @frames > (1 + LOOP*7)*DELAY
        @pic.zoom_x = 0.6
        @pic.zoom_y = 0.6
        @pic.opacity = 100
        @frames -= 1
        return
      elsif @frames > (LOOP*7)*DELAY
        @pic.zoom_x = 1
        @pic.zoom_y = 1
        @pic.opacity = 255
        @frames -= 1
        @iframe = 1
        @gota = 0
        return
      elsif @frames == 0
        @frames = nil
        @pic.bitmap.dispose
        @pic.dispose
        @picid = nil
        return
      else
        @pic.bitmap.clear
        @pic.bitmap.blt(0,0,RPG::Cache.picture(@picig),Rect.new(@iframe*32, @picid*32, 32, 32))
        @pic.zoom_x = 1
        @pic.zoom_y = 1
        @pic.opacity = 255
        @frames -= 1
        if @gota == DELAY
          @iframe += 1
          if @iframe > 7
            @iframe = 1
          end
          @gota = 0
        end
        @gota +=1
      end
    end
  end
  def emotion (id,ig="Balloon",wt=false)
    @frames = (2 + LOOP*7)*DELAY
    @picid = id > 9 ? 9 : id
    @picig = ig
    @pic = Sprite.new
    @pic.bitmap = Bitmap.new(32,32)
    @pic.bitmap.blt(0, 0, RPG::Cache.picture(@picig), Rect.new(0,32*@picid,32,32))
    @pic.ox = @pic.bitmap.width / 2
    @pic.oy = @ph = @pic.bitmap.height / 2
    @pic.z = 100
    if wt
      return @frames
    else
      return 0
    end
  end
  def dispose
    super
    if @pic != nil
      @pic.bitmap.dispose
      @pic.dispose
    end
  end
end
class Spriteset_Map
  def emotion (id,ev=-1,ig=DEFAULTFILE,wt=false)
    if ev.to_i > -1
      @frames = @character_sprites[ev].emotion (id,ig,wt)
    else
      @frames = @character_sprites[@character_sprites.size - 1].emotion(id,ig,wt)
    end
    return @frames
  end
end
class Scene_Map
  def emotion (id,ev=-1,ig=DEFAULTFILE,wt=false)
    $game_system.map_interpreter.wait_count = @spriteset.emotion (id,ev,ig,wt)
  end
end
class Interpreter
  def wait_count=(frames)
    @wait_count = frames.to_i
  end
end
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Blizzard on July 07, 2015, 02:01:25 am
Try putting it below or above the script, opposite from what you have now.
Also, <3 for your username.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Zangetsu on July 11, 2015, 04:17:47 am
Thanks Blizzard :D

Unfortunately the script doesn't seem compatible, but I'll probably try with another project soon! I like this script a lot ;)
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Kise on March 13, 2018, 01:11:21 pm
I think you have incorrect version of the script in the thread, it's the same as in demo. Events are disappearing on screen edges. Tested on new project.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: KK20 on March 13, 2018, 01:18:16 pm
What in the grave-digging world are you talking about?
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Kise on March 13, 2018, 01:24:20 pm
ABSEAL's demo has slightly modified version to show how this script works, events are disapearing on the edges on the screen. Script linked directly in the thread is the same.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Blizzard on March 13, 2018, 01:37:14 pm
Yes, the demo is setup to show how the script works by reducing the the boundary within the screen so it's visible.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Kise on March 13, 2018, 01:53:30 pm
Script under this link http://downloads.chaos-project.com/scripts/Blizz-ABSEAL.txt and in the demo are identical. They both reduce the boundary within the screen.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Jaiden on March 13, 2018, 02:19:26 pm
Quote from: Kise on March 13, 2018, 01:53:30 pm
Script under this link http://downloads.chaos-project.com/scripts/Blizz-ABSEAL.txt and in the demo are identical. They both reduce the boundary within the screen.

I do believe that's the point. You're supposed to get an idea of how it works and then modify the configuration of the script to fit your needs.
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Kise on March 13, 2018, 02:32:27 pm
That's not the case. Message in demo says '[..]This demo uses slightly modified version of ABSEAL. Instead of cutting off everything beyond the screen, ABSEAL will now cut off everything that is beyond the dark border[..]"
Title: Re: [XP] Blizz-ABS Event Anti-Lag
Post by: Blizzard on March 13, 2018, 02:41:49 pm
You are right. I accidentally copied the modified version into the script that was meant for distribution. I uploaded v3.2 and added the EXTEND_TILES options which makes it easier to control this if I ever mess up again. The demo uses a value of -1 EXTEND_TILES while a value of 0 should be the default.

Make sure to do a browser cache clear by pressing CTRL+F5 to make sure the browsers downloads the new file. It should say v3.2 in the header.