RmXP chipset lag?

Started by Kiwa, November 14, 2013, 08:37:10 am

Previous topic - Next topic

Kiwa

I didn't want to make an entire thread for just this but i guess i will.
If im posting in the wrong area please fix it for me :P

I'm running BABS and im trying to make detailed maps. using 2 different chipsets on different maps of cores.
Excuse the stock art...i plan to change it before moving on (this is my largest delay.... graphics and lag)

My question is... are chipsets causing lag?
Using 'Grassland' i have all 3 layers heavily used up and use panoramic ....and i can contain a lot of mobs before i get lag.
but 'Fort Im' seems to lag like hell. even just using 1 layer.
(i know darker colors may be harder to process..but really..is it causing this?"
EX:
No Lag
Spoiler: ShowHide









Severe Lag:
Spoiler: ShowHide








You can see in 'grass lands' with 3 decently heavy layers and 6 mobs ...really no lag.

but no mobs in 'fortress in'...a lot of lag. ESP if i walk on an angle with the 8way walking on from babs.
The lag more than doubles if there's a second layer or 3rd. and if there's an event such as a mob or switch...forget it.. its almost unplayable.
Im a bit concerned about this in the long run. i actually plan to hand draw some chipsets  but if there is something to steer clear of with.
but is it as simple as darker colors? or what?

my computer isn't amazing but it can handle gaming at some level. so im a bit surprised to see this problem. even with no enemies 'Fortress In'  chugs like a train. but i really don't think its the fault of my laptop.

A while ago i read a post about updating the script using VX system.. would that actually help this issue? im also afraid of it damaging my code.
anywhoo..any help is appreciated. Thanks :D

WhiteRose

Blizz-ABS, though well-optimized, sometimes will lag if you have very, very large maps. I'm not sure if that is the cause of this particular lag, but it's at least something to try - are the maps most affected those that are very large?

Kiwa

Yeah.. I remember long ago Blizz said 50x50 is probably the best choice.
so all the pictures using 'Grass lands' are 50x50
'Fortress In' however is 60x60.

I've made a copy of that map that is using 'Fortress In' and removed ALL layers and events other than the first layer (floor tile) and it still lagged. but I havent tried minimizing it to a 50x50 map. it used to be 90x90 i chopped it to 60x60 but i cant remember if it helped.

So to answer the question..yes they are large..but the laggy one is only a small fraction larger.

Since i want dungeons to be loaded with puzzles and events (simple or not) this will be a tough task. i need to find a way to optimize this lol.

Kiwa

I actually just did a lot of playing around with it.
I made a new blank map..same chip set. it was ok. added event monsters.. it was ok.

so i copied it.. reduced it to 50x50...no help

so i reduced it to nothing but 1 layer...floor and wall tiles.... with and without events.

still lagged.

I did however notice if i hold Ctrl....it will not lag...at all.

I'm wondering if the processing cant handle so many 'X' tiles. since this place is a dungeon / maze maybe having too many XXOXX patterns on the screen at once is hard for it to cope with.

the grasslands maps had pretty much only tree trunks as impassible.


KK20

Ah, I noticed that "holding CTRL for debug hax0r walking" removed the lag as well. I should go look for what is causing that.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

winkio

holding control stops the passability check from occuring, so that must be where the lag is.  Out of curiosity, does this happen with intelligent passability enabled or disabled?

Heretic86

From the screenshots, Im noticing other graphical enhancements.  If those graphical enhancements, like on-screen mini maps or health bars are constantly refreshing (erasing and completely redrawing), that could be causing lag.  Also too many events does cause lag.  You may need a Framerate Optimizer so events that are too far away dont eat up resources. 

You could try temporarily disabling the on screen stuff, unless those are addons by Blizz, as he does his stuff "right", where any graphics are only redrawn when they need to be and not on every frame.

You could try looking in the Script Database and take a look at the framerate optimizers.  Let us know if youre trying one and its buggy or causing you issues so we can fix them.

Ive never had ANY sort of an issue resulting from Tilesets themselves, even animated autotiles.  Many of the tilesets I've been using are absolutely massive, and they dont cause lag the way you've described, and they are excessively detailed as well.  Take a look at my Once More, With Feeling and examine the details.  Demo is quite old and really needs to be updated (minor eventing bugfixes).  The maps arent too big, so nothing thats 500x500, but very intricate and complex.  It'll probably take you about 5 minutes to run through "Northern Forest" which is 51x50 and maybe 20 minutes to find your way to the top of "Lightgeist Mountain" which is only 50x80.  That being said, "Once ..." is an example that its nothing to do with Chipset / Tilesets causing lag because both maps use tilesets that are huge, 16000 pixels tall as opposed to the defaults that are around 1000 pixels tall.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Blizzard

November 16, 2013, 04:14:27 am #7 Last Edit: November 16, 2013, 04:15:41 am by Blizzard
Lol, I'd never keep constantly refreshing something. It's not the HUD.
It it doesn't happen when holding CTRL, it's the passability test. And if it's the passabiltiy test, it's most likely due to a large number of events, because tile passability testing has a constant complexity O(1).
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Kiwa

Thanks for the large amount of replies! <3

Well i don't in any way blame blizz. If it weren't for him (or any of you for that matter) i'd never even be able to come this far. i hope that's clear.
if anything its my misunderstandings and lack of skills that are causing issues.

So after reading all these goodies from everyone.

@winko I turned it on now.. i did NOT have it on for some reason.  i'm sure at some point i forgot to save that when i turned it on.. and noobed it. its on now. thanks :D

@KK20......<3

@Heretic86 Thanks for the long and thought out post. i found this was my mistake. (explanation below) Thanks for the love.

@Blizz. You are 100% correct. i thought by chance it was the chip set. when i started hitting Ctrl and it was smooth made me think it was an interference issue. ALSO!
As i have stated for a long time, i wanted this game to have puzzles....which costs events...at the cost of lag. (so much so...that i lost count)
I know that events cause lag hard in XP.. but i figured ABSEAL would help that (by shutting down events off screen..perhaps its only monsters. hence why i can load my map with 10-20 monsters and have 6 on screen with no lag.). so i had about 16 events (non monster) on the page. plus a parallel common event.
this was with no monsters. lol.
the funny thing is.. the lag wasn't as bad near the events which also mislead me. it seemed to lag harder just off screen in heavy tiled areas.

As always Thanks fellas. I hope this thread can also help others having the same "issues".


Any suggestions for making puzzles while minimizing events? or should i just make smaller maps for dungeons and set aside 10 switches and variables?
by simple math that ive done up the world as it is now has 251 accessible 50x50 maps (not completed yet, naturally..) so im at no shortage of maps for the time being.

Blizzard

You can disable Blizz-ABS during that map, it might help a bit.

I'm not sure why it would lag when the events are off screen, but event update takes its tool. I used a special script in my own game where I could create lightweight events that are updates only partially, but they also had limited functionality. It worked out pretty well. If you have a lot of static events that don't really do anything, this kind of script could improve performance.

You should definitely split dungeons into several maps.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Kiwa

That Script may be useful... perhaps i can combine that with lowering the size of the map and increasing quantity of maps.

Really...the first dungeon is really simple.. i wanna slowly build my limits ...so as an example of some of the "puzzles"

1. kill the correct mob that drops the key (basic)
2. Team switches say 4 switches.. something like... you have to have 2 ppl stand on a switch on one side of the door... step off it closes. then 1 guy go threw  and press a 3rd switch ...then rotate switches till everyone can get in.

3. Pull a switch it opens A and C but closes B..so on so forth.

these are some of the basics for the first dungeon...simple.
i have some interesting ideas..but not sure how they can play out with eventing.

even with eventing i had some trouble making switches you can stand on and move off it and have the switch pop up again. i had to use other events around it then limit the position of the switch conveniently with trigger events so i didnt make too many events.. lol

Heretic86

November 16, 2013, 09:04:31 pm #11 Last Edit: November 16, 2013, 09:07:05 pm by Heretic86
You could try one of these scripts to see if it helps the lag:

Blizz Anti Lag:  http://forum.chaos-project.com/index.php/topic,104.0.html
Another Anti Lag: http://forum.chaos-project.com/index.php/topic,12291.0.html

For your switch difficulty, you could try using Simple Event Sensor:

http://forum.chaos-project.com/index.php/topic,8581.0.html

In your Switch Event Name, put in <sensor=1> instead of 4, and use two pages.

Page 1 has your "Up" position.  Enable Direction Fix.  Set Trigger to "Action Button"
Page 2 has your "Down" position.  Page Condition Self Switch D.  Enable Direction Fix here also.  Trigger to Action Button also.

This is where it gets a little tricky.  Set "Trigger" to "Action Button".  Just trust me on that.  To the right of where it shows your Button Graphic, there is a section called "Autonomous Movement".  Set "Freq" to highest.  Set "Type" to Custom, then hit the button just below "Type" that says "Move Route...".  In the window that comes up, uncheck "Repeat Action".  If "Repeat Action" is not checked when you first open the window, then you are in the wrong Move Rotue Window.  There are two ways to do Move Route.  One is on the Left next to your Page Graphic, that is the one we want.  The other is over on the Right where you double click and it shows in the "List of Event Commands", that is the one we do NOT want.  Now, in your "Move Route" window, the one where "Repeat Action" is initially checked by default, you should see all of those buttons for "Move Up", "Turn Down", etc.  There is a Button on there that says "Script".  Click on Script.  In the Script box, put in the word "start".  No Quotes, all lower case.  Hit ok.  Click Script again.  This time, put in "@trigger = -1", again, no quotes in the box.  

Your Move Route should now look like this:

$>Script: start
$>Script: @trigger = -1

The word "start" will work like an Autorun, where everything in the "List of Event Commands" to the right will run as soon as this Page is active.  The page change is controlled by Simple Event Sensor so you do not have to do anything to change those self switches, as that is what the Sensor is for.  The script that says "@trigger = -1" will prevent the Player from being able to press the Action Button to execute the list of event commands.  Basically, its an Invalid Trigger so the Player wont be able to trigger the "List of Event Commands" by using the Action Button, so it only triggers when that Page first becomes active, due to the Script that says "start".  I'll explain Triggers briefly.

@trigger = 0 is "Action Button"
@trigger = 1 is "Player Touch"
@trigger = 2 is "Event Touch" (Useful for Enemies that approach the Player)
@trigger = 3 is "Autorun"
@trigger = 4 is "Parallel Process"

When @trigger = -1, none of those work, so it basically disables triggering altogether, so the only way for the Event to fire off its "List of Event Commands" is by a manual trigger, which is where "start" comes into play.  Dont worry about having to reset @trigger, when the Player moves off of the switch, then steps back on to the switch, it will retrigger properly.

Now, over on the Right, set up your "List of Event Commands" to do what ever you want them to do.  All of this stuff will run as soon as the player steps on the Switch.  You can even set up the switch to change Graphics so it plays a "going down" type of animation when the player triggers it, if you wish.  Since the Event Commands enable you to do stuff with other Events, you can pretty much make anything happen here.

The reason I gave you this very complex way of doing things is that it gets you used to pushing the engine well beyond its designed limits.  It should show you that the real limits dont come from the engine itself, only your imagination.  You get exactly what you want when you want it.  A Button that can do ANYTHING that doesnt give "False Triggers" (such as player hitting the Action Button while standing on the Switch).

Side note: Sensor is so incredibly useful that I honestly believe that in any later version of RPG Maker, it should be built in.  It may not seem very useful at first, but when you realize that it can be used as everything from a simple Enemy AI to a Button Controller and even a Door Controller (walk away from door and door closes), you begin to see the true power of Sensors.  Thank LittleDrago if you do decide to use Sensors.  Im working on my own type of Sensor that isnt ready for release yet, but the basic concept is exactly the same.

I hope this helps.  Let us know if you have any trouble with the Anti Lag scripts.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

Thanks for the wall of text Heretic, but I don't think it'll help for this case.

Just tested this "passability" stuff out. Because we are told that the map contains no events, I was able to pinpoint the problem to the passable? methods in Map_Actor and Map_Battler. The one in Map_Actor is called first followed by Map_Battler.
Code for those two methods: ShowHide


  def passable?(x, y, d)
    puts "Map actor"
    # calculate new coordinates
    nx = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    ny = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    # impassable if new coordinates not valid
    return false unless $game_map.self_valid?(nx, ny)
    # impassable if paralyzed
    return false if self.restriction == 4
    # passable if actor and pressing CTRL in DEBUG mode
    return true if $DEBUG && Input.press?(Input::CTRL) || @through
    # passability depends on basic testing
    return super
  end


  def passable?(x, y, d)
    puts "Map Battler"
    # calculate new coordinates
    nx = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    ny = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    # impassable if standing on impassable tile
    return false unless $game_map.self_passable?(x, y, d, self)
    # get pixel movement rate
    pix = $BlizzABS.pixel
    # if impassable in all directions
    unless $game_map.direction_passable?(nx, ny, 10 - d) &&
        $game_map.direction_passable?(nx, ny+pix-1, 10 - d) &&
        $game_map.direction_passable?(nx+pix-1, ny, 10 - d) &&
        $game_map.direction_passable?(nx+pix-1, ny+pix-1, 10 - d)
      # impassable
      return false
    end
    # new real coordinates
    rx, ry = nx * 128 / pix, ny * 128 / pix
    # get all events
    events = $game_map.events_only
    # rectangle
    rect = Rect.new(nx, ny, pix, pix)
    # if any event in the way
    if events.any? {|event|
        !event.through && event.character_name != '' &&
        $BlizzABS.util.rect_intersection(rect, event.phitbox)}
            #Rect.new(event.x * pix, event.y * pix, pix, pix))}
      # impassable
      return false
    end
    # if any battler that is not self or an event in the way
    if ($game_map.events.values - [self] - events).any? {|battler|
        !battler.through && battler.character_name != '' &&
        $BlizzABS.util.rect_intersection(rect, battler.phitbox)}
            #Rect.new(battler.x, battler.y, pix, pix))}
      # impassable
      return false
    end
    # passable so far
    return true
  end

Holding CTRL, as you can see, will only call Map_Actor#passable?. Thus, the problem exists somewhere in Map_Battler#passable?. That's all I have so far.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Kiwa

@Heretic86:
Im gonna look into that more and give it a shot. took a quick look at the script you linked.. looks great. infact i have many ideas for that one.

@KK20:
Don't dig too into it KK20. I think it was my fault completely. i have been kidna putzing around with this for weeks on and off.
i remember making many dupes of the map.  I'm not sure what i did or didn't do but i can't replicate that lag again with no monsters and even a few events. its running smooth.
I still do get chugs with some odd 10+  (not an exact number) events without monsters...when i hold Ctrl it WILL stop the lag from events.
however i can't get the same lag on just an empty 50x50 floor tiled map.

Sorry if i wasted your time with that. (unless you did find something somehow lol). im gonna continue to try making these maps to see if i can replicate it.

@Heretic86 again:

I'm gonna try the anti lag script as well with the heavy evented area...see if it helps as well as the other info you posted.
Thanks for the help everyone.

Side note* Im working on the hand drawn art as well atm. im working on the 'Fighter01' as a base. im going to finish hand drawing it and hand color it. then scan it and use photoshop to size it. i hope it turns out well. if it does i plan to do nearly the whole game in this manner. chars and chipsets at least. icons may stay mouse drawn.

Heretic86

@KK20 -  Most of that wall of text was for his Floor Switch.

I havent played with Blizz ABS too much, but so I dont have a clue if that would cause it or not.  But since passable? was mentioned, I've had issues with the default version of it for a while now, mostly because of Event checking.  Every time passable is checked, every single Event is also checked.  That adds up quick.  If you recall, I took a crack at events_at_xy(x, y) as a means of optimizing passable? so not every event is checked, just ones at a location.  It was an effort to use Hashes over Arrays for performance, but I ended up with the opposite results and had worse performance.  Im now thinking maybe using Tables (one dimensional array) that Enterbrain uses for a lot of the $data objects and taking another crack at it?  Not specifically for Kiwa's trouble, but as a replacement for checking all events by using events_at_xy with Tables instead?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

winkio

events_at is not going to be more efficient, because it also loops through all events.  If you are looking to make a custom script, there are two easy directions to go:

1.  Keep a list of non through events that you loop through for passability.
2.  Setup a quadtree for every map and keep events in the tree, which will allow you to find a subset of events that you need to check for every region on the map.

Heretic86

Well, what Im thinking is iterate each event during map setup.  Then as each event moves, use the Event update to update the maps position in the table.  That way it doesnt iterate two objects over one, which would definitely be inefficient.  Then it is a matter of replacing inefficent code with more efficient checks.  For example, passable? typically calls to:

for event in $game_map.events
  if event.x == x and event.y == y
    (some code)
  end
end

Replace with

events_at_xy(x, y) which returns only event ids where x and y match table values instead of iterating thru the entire $game_map.events hash.  I tried it before with hashes and it did function, but as mentioned, it did get more of a performance hit as opposed to a gain.  Im probably going about it the wrong way, but I still believe it can be way more efficient...
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)