Save-Point
BIG MAPS and Anti-Lag - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: BIG MAPS and Anti-Lag (/thread-8067.html)



BIG MAPS and Anti-Lag - Melana - 06-04-2020

Okay, I tested this script in my game and tried to connect the 25 120x120 maps of my first area to one big map.
The result is kinda odd: The game begins to lag but only when I move vertically. Moving right or left doesn't create any lag.
And the lag seems to be caused by events (especially moving events) so maybe my anti lag script has issues with the Bigmap script. 25 500x500 maps without any event was no problem. x.x


RE: BIG MAPS - DerVVulfman - 06-04-2020

Hm. I guess that depends on the Anti-Lag script.... and how many events you have running. Well, I haven't tested it with all anti-Lag, nor tested event capacity.

You went to a full 2500x2500 tile map? Schweet!

But I have to say that I've never encountered the issue you're having with vertical movement. There should be no difference with movement at all as the system literally crafts a new virtual map and doesn't actually alter the movement system other than teleporting. Character speed and movement is typically governed by the Game_Character class, and I touched neither Game_Character, Game_Player nor their related sprites and spriteset systems.


RE: BIG MAPS - Melana - 06-04-2020

I'm using the one from Near Fantastica. I'm not sure if it works together with the new big map so maybe all events are being updated all the time.
There are around 300 events on one map so there should be ~7500 in total. Some of them are moving plus updating dynamic sound effects and light effects. But usually the anti lag script only updates the stuff in range of the player so my guess is it's not working properly. A normal 500x500 map with 999 moving events is no problem at all.
If I include only 10 or 15 of the maps it runs smooth without any lag and even 25 or even more empty maps don't cause any lag. So it's definetely an event issue.

The vertical movement thing is weird. While moving horizontal the game runs in 60 fps. When moving vertical it drops down to 19-20.^^

This is the script, if you are interested.

Content Hidden



RE: BIG MAPS and Anti-Lag - DerVVulfman - 06-05-2020

As it is more akin to getting two scripts to work together, code support seemed more fitting. Winking

Yeah, Jaime's work is excellent for a jumping off point. Some of it still has valid uses, and way less complicated. This being very much different to over-complicated works that do the job super well... but only a freakin' NASA Technicians can figure it out. Tongue sticking out

There are a number of anti-lag systems. And if I were to have around 1000 events, sure. Granted, you are limited to 999 events per map anyway, and they never thought anyone would go beyond. Oh, you edited it... and made it extend out to grab MORE events in a shot. It didn't restrict but went the other way.

Now I coulda brought up Amaranth's... or Lambchop's when she was at RMXP.Org (now HBGames)> Wow, I'm going back a decade there. And I still have her on facebook. But, her system does not really go beyond 1000 events either.

So enter Zeriab's. Yep, the Huggin' King's Anti-Lag system did MUCH better than the others. Compared to the others, it is massive, hitting Game_Map... Character... Player... and more. But it did much much better. Oh, and what I said about NASA Technicians????

What was my test? It was a 9x9 grid of 500x500 tile maps. Of those, five have 998 chicken events all walking around. That's a lot of chickens. Well, they all had 998 events, but lag hit. Each re-test, I deleted a map and recreated one without events. First all 9 with 998.... on down.

With Zeriab's Anti-Lag, I suffer no lag with 5 maps of 998. And with 6 maps of 998, I suffer only 20% lag. So I think 5000 events is the magic number. And 6000 is pushing it. Just remember that Big Maps is making one array of ALL of the events of all your maps. It's not sorting through one batch of 999 and another of 999. It is sorting through them ALL in one shot every so often.

And here's Zeriab's script. Definitely have it before Big Maps:
Are you a NASA Technician?



RE: BIG MAPS and Anti-Lag - Melana - 06-06-2020

Okay I did some testing and it's insane. Together with the HiddenChest Engine I can run 37000 events with Zeriabs anti lag system. So I had 7x5 maps with 999 events plus 2 more full and 3 empty maps in the bigmap.
And even beyond 37000 the lag isn't that much but makes playing too annoying for my taste. And it can crash if too many stuff is on the screen so I think keeping it below 35000~37000 might be a good idea.
With the Near Fantastica script it ended at around 5000 events.

I had to comment out the following lines because they throw this error in HiddenChest

[Image: pSkXaNd.png]

(693-705)
Code:
#  Checks if the event is never to be updated. (For decoration)
    for pattern in NEVER_UPDATE_NAME_PATTERNS
      if (pattern.is_a?(String) && name.include?(pattern)) ||
        !(pattern =~ name).nil?
        self.never_update = true
      end
    end
  #   Checks if the event is to be always updated.
    for pattern in ALWAYS_UPDATE_NAME_PATTERNS
      if (pattern.is_a?(String) && name.include?(pattern)) ||
        !(pattern =~ name).nil?
        self.always_update = true
      end
    end

Now I only need to make Zeriabs script compatible with my game. There are some nasty errors so far but I will try to fix them now.


RE: BIG MAPS and Anti-Lag - kyonides - 06-06-2020

Something people usually forget is that operators in Ruby are a bit weird.

and follows the logical order, i.e. if check1 and check2

&& does it in the reverse order, e.g. if check2 && check1

There operator precedence DOES matter! && has a higher precedence than and.

So print name and pattern to verify which one isn't a string and when one of them is a regular expression or Regexp instead. Why? That's because the scripter forgot that passing a single string, whether it's the first or second parameter, to a match operator will always throw a TypeError in Ruby. That should NOT happen at all. This happens when you include strings and regular expressions. Laughing In my humble opinion he should have picked just one of them to reduce the number of tests needed to run the method.

Solution? I guess it could be something like...

Code:
if (pattern.is_a?(String) and name.include?(pattern)) ||
        (pattern.is_a?(Regexp) and !(pattern =~ name).nil?)

I don't think name should ever be a Regexp. Not even a mad scientist like Mad Scientist would ever dare to make it a regular expression.


RE: BIG MAPS and Anti-Lag - DerVVulfman - 06-07-2020

That block of code is what allows you to add the codes [N] and [A] which lets you make events 'Never' update and 'Always' update. That should be quite simple. Odd.


RE: BIG MAPS and Anti-Lag - Melana - 06-07-2020

Thank you for that fix. Now it also works with HiddenChest. The newer ruby version seems to be more sensitive. It worked with the normal RMXP exe before.
I was also able to fix most of the incompatibilities. Now I only need to figure out how to make it work with the higher resolution fix.

Edit: Fixed ^^

Now my first area is one big map and it's fantastic. It feels so much better to fly around when everything is seamless. Thank you very for your help :)


RE: BIG MAPS and Anti-Lag - DerVVulfman - 06-09-2020

Just a little heads up. The "SPECIAL_UPDATE_IDS" feature that Zeriab added seems a bit... iffy to me. Doesn't really work so well. BUT hey, tell me I'm wrong here. But make an event and erase its name. It acts as if it is a 'Never Update' event too, right?