• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Lag spikes and delay.

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2010
Messages
84
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.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
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?
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
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...
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
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.
 
Level 4
Joined
Apr 7, 2010
Messages
84
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!
 
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].
 
Level 4
Joined
Apr 7, 2010
Messages
84
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?
 
Level 4
Joined
Apr 7, 2010
Messages
84
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.
 
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.
 
Level 4
Joined
Apr 7, 2010
Messages
84
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.
 
Level 4
Joined
Apr 7, 2010
Messages
84
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.
 
Status
Not open for further replies.
Top