1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  4. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Lag spikes and delay.

Discussion in 'World Editor Help Zone' started by Carter_117, Mar 6, 2014.

  1. Carter_117

    Carter_117

    Joined:
    Apr 7, 2010
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Hey, I've recently been starting my first real map heavy in development.
    It's a WW2 map originally set in Europe, lots of triggers for events and lots of units.
    The problem I've run in to is that I have recently expanded the map to the maximum 456x456 and played a game on it, I ran into a problem that has only happened once before and that is massive delay (a minute or longer at it's worse) coming into the map, it appeared once before in the smaller version of the map but we assumed it was either the bot or a player and it dissipated eventually.
    Combined with this is the lag spikes that have appeared due to the lag recently, while this is bearable and mainly only at the start of the map it is also something else I would like to remove or at least make better.
    Thanks for any help it's appreciated! As a note I'd like to mention again that this is my first real map and I know little about some things, it's been a learning experience as well. I know nothing about Jass and I suspect memory leaks as the issue but I have little idea on what they actually are/how to fix them/if they'd be causing this.
     
  2. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Unless you realize something extremely inefficient like spamming hundreds of new objects every 0.01 seconds, leaks only gradually slow the map down.

    At the beginning of a map, you usually initialize data like objects, which puts extra strain. This can be minimized but is fairly normal. Better have some more initialization than lag during the game.

    Well, what shall we say from your description?
     
  3. yip

    yip

    Joined:
    Jan 15, 2014
    Messages:
    69
    Resources:
    0
    Resources:
    0
    Wouldn't hurt to add this.

    Things That Leak


    If your map has a lot of triggers and you're unsure about what leaks are and how to fix them, it's very probable you have a bunch of them...
     
  4. Nichilus

    Nichilus

    Joined:
    Sep 26, 2009
    Messages:
    1,974
    Resources:
    0
    Resources:
    0
    Other possible things that may cause lags are:
    * having looping trigger (e.g. event: every 0,1 seconds) which picks way too many units and iterates through each unit
    * incorrectly set some abilities - e.g. Shockwave with fields set to 0, or just badly set.

    Lag spikes may happen due to you loading new thing for the first time in the game - e.g. you add new ability for the first time in the map - this ability has not yet been add and so it needs to initialize. This may cause lag spike (such things are usually overcome by loading these abilities at the start of the map - it will still lag the game for a bit, but at least it's a controlled lag.
     
  5. Carter_117

    Carter_117

    Joined:
    Apr 7, 2010
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Hmm thank you.

    The biggest issues I can see out of this about lag spikes would probably be unit spawns and income triggers.

    As infantry spawns in groups although I do not thing this one is likely. More likely would be the Chinese Resistance triggers which spawn a lot of infantry every 60 seconds on a looping trigger and are then ordered to move somewhere, I might remove this and see if it helps tomorrow or remove the order to make them move.

    For the start up lag I'll add a loading time somehow, maybe a cinematic that shows each countries goals and such at the beginning or something similar so the map can load things. I know based on the replies and in-game that the way player cores on cities work causes lag on start up and income triggers cause a spike every income cycle, although that doesn't matter to much.

    While I do not doubt memory leaks are a problem in this, I don't think they are the source of these two problems specifically as the spikes were noticeable at the start, while the delay came very suddenly and abruptly.

    I'm going to toss the delay up to simple a bad game or connection for now.
    Thanks for the help! Hopefully things will run smoother.

    Sorry if what I've said has been a bit rambled, gotten a bit late here, again thank you!
     
  6. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,822
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    Are we really talking about lags or are we talking about FPS spikes?
    A lot of people seem to confuse the one for the other.

    If it's the latter, how many destructables (not doodads!) do you have in your map?

    If you have several thousands, I recommend you drop the "destructable hider" library in your map and check if that helps [but read the description properly! It might cause desyncs if not used properly].
     
  7. Carter_117

    Carter_117

    Joined:
    Apr 7, 2010
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Ok the Lag/FPS spike, not to sure which one it was, is fixed.

    However, the delay happens every game once, sorting itself out sometimes but not always. It really does kill the game. Anybody have any idea why this could be happening? I even reduced the map size losing half of the pacific to try and fix it and still nothing. Could it be the triggers or what?
     
  8. BPower

    BPower

    Joined:
    Mar 18, 2012
    Messages:
    1,709
    Resources:
    21
    Spells:
    15
    Tutorials:
    1
    JASS:
    5
    Resources:
    21
    If you don't preload abilities, item, effects you may experience a lag once they occur for the first time.
     
  9. DysfunctionaI

    DysfunctionaI

    Joined:
    Mar 6, 2006
    Messages:
    281
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Oh, are you talking about that thing that happens when too many units have an order, and you can't command another unit until others have finished? Like in maps where huge armies are being massed, such as yours, I'm guessing.
     
  10. Carter_117

    Carter_117

    Joined:
    Apr 7, 2010
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Hmm true. Don't think that is the cause though.

    And perhaps it is the units... There are a lot, but it's not the one where units don't move/shuffle around, it's simply massive delay, even for commands like e.g. -war yellow or even pausing the game and pinging locations on the map.
     
  11. Dat-C3

    Dat-C3

    Joined:
    Mar 15, 2012
    Messages:
    2,477
    Resources:
    10
    Models:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    10
    Sounds like massive leaks or the map went messy after going past 256. The max is 480 tho.
     
  12. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,822
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    You still haven't answered if your "delay" is an actual lag or an FPS spike.

    You can type /fps and monitor the number. On modern machines, it should show a stable 50+ fps.
     
  13. Carter_117

    Carter_117

    Joined:
    Apr 7, 2010
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Played a game today, it is he FPS that is lowering.
     
  14. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,822
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    In that case, either you have too much stuff on the screen or your scripts are too cpu intense (like creating several dozen of units every x seconds). Also avoid periodic enumerations as much as possible.

    Beginners often make the mistake to use "pick every unit in" much more often than is neccessary.
     
  15. Carter_117

    Carter_117

    Joined:
    Apr 7, 2010
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Yeah that makes sense with everything else I've been figuring out/told.

    Alright cheers everyone! It's been a great help, I've begun the process of optimising triggers and fixing leaks.
     
  16. Carter_117

    Carter_117

    Joined:
    Apr 7, 2010
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Yeah that makes sense with everything else I've been figuring out/told.

    Alright cheers everyone! It's been a great help, I've begun the process of optimising triggers and fixing leaks.