Introduction
If you are looking for an anti-lag script that will keep your FPS at 100% most of the time, this is the script for you.
This script eradicates redundancies and erroneous materials that were in previously created anti-lag scripts. Your game should be 40% faster than it was when you were using the other anti-lag scripts.
This script is not for beginners. To achieve good anti-lag, you're going to need to modify your base Game_Map and Spriteset_Map classes. This is not an SDK script and it requires fewer lines of code to implement.
This script is an optimization of Near's, sandgolem's, and Helmut's anti-lag scripts. I created this because each of these scripts has great stuff, but none of them really fixed the anti-lag problem completely.
Ready to get started? Let's make your game faster!
Update Game_Map
1. Open your game and script editor.
2. In Game_Map, in the update method (def update), replace the following line with the code snippet below.
Replace this:
for event in @events.values
event.update
end
With this:
3. At the bottom of the Game_Map class, add the following method called in_range (def in_range). (Make sure to add this before the last end tag in the class)
Update Spriteset_Map
1. In Spriteset_Map, in the update method (def update), replace the following line with the code snippet below.
Replace this:
for sprite in @character_sprites
sprite.update
end
With this:
3. At the bottom of the Spriteset_Map class, add the followind method called in_range (def in_range). (Make sure to add this before the last end tag)
Credits
If any credit should be given, send it to Near, sandgolem, and Helmut. They got this ball rolling.
If you are looking for an anti-lag script that will keep your FPS at 100% most of the time, this is the script for you.
This script eradicates redundancies and erroneous materials that were in previously created anti-lag scripts. Your game should be 40% faster than it was when you were using the other anti-lag scripts.
This script is not for beginners. To achieve good anti-lag, you're going to need to modify your base Game_Map and Spriteset_Map classes. This is not an SDK script and it requires fewer lines of code to implement.
This script is an optimization of Near's, sandgolem's, and Helmut's anti-lag scripts. I created this because each of these scripts has great stuff, but none of them really fixed the anti-lag problem completely.
Ready to get started? Let's make your game faster!
Update Game_Map
1. Open your game and script editor.
2. In Game_Map, in the update method (def update), replace the following line with the code snippet below.
Replace this:
for event in @events.values
event.update
end
With this:
Code:
for event in @events.values
if in_range?(event) or event.trigger == 3 or event.trigger == 4
event.update
end
end
3. At the bottom of the Game_Map class, add the following method called in_range (def in_range). (Make sure to add this before the last end tag in the class)
Code:
#--------------------------------------------------------------------------
# â— Check if events are in range (ANTI-LAG)
#--------------------------------------------------------------------------
def in_range?(object)
diff_x = ($game_map.display_x - object.real_x).abs # absolute value
diff_y = ($game_map.display_x - object.real_x).abs # absolute value
width = 128 * 24 # size * tiles
height = 128 * 19 # size * tiles
return !((diff_x > width) or (diff_y > height))
end
Update Spriteset_Map
1. In Spriteset_Map, in the update method (def update), replace the following line with the code snippet below.
Replace this:
for sprite in @character_sprites
sprite.update
end
With this:
Code:
for sprite in @character_sprites
if in_range?(sprite.character)
sprite.update
end
end
3. At the bottom of the Spriteset_Map class, add the followind method called in_range (def in_range). (Make sure to add this before the last end tag)
Code:
#--------------------------------------------------------------------------
# â— Check if events are in range (ANTI-LAG)
#--------------------------------------------------------------------------
def in_range?(object)
diff_x = ($game_player.real_x - object.real_x).abs # absolute value
diff_y = ($game_player.real_y - object.real_y).abs # absolute value
width = 128 * 24 # size * tiles
height = 128 * 19 # size * tiles
return !((diff_x > width) or (diff_y > height))
end
Credits
If any credit should be given, send it to Near, sandgolem, and Helmut. They got this ball rolling.