General - Reducing Lag

Darthfett said:
Is it the color, or just the fact that they're big and in the way? :p

I'll try and make it more readable. Thanks for the feedback! :)

The color, it's annoying for the eyes, would prefer it in black and then you could always make it bold or something if you want it more highlighted :)
 
Code:
Events
    Unit - A unit enters Region 0001 <gen>
Conditions
Actions
    Unit - Create 1 Footman for Player 1 (Red) at ((Position of (Entering Unit)) offset by 50 towards 90 degrees) facing Default building facing degrees

It looks like one leak, right? But there are actually 2 leaks here; Position of (Entering unit) leaks, but so does the point created by offsetting it.

Oh, that's the thing causing the lag in my map! Thank you, +rep! :)
 
great tutorial.

But I am still a little fuzzy on regions. I am assuming this is ok:

Code:
Trigger
    Events
        Unit - A unit enters Creep1 <gen>
    Conditions
        ((Triggering unit) belongs to an ally of Player 12 (Brown)) Equal to True
    Actions
        Unit - Order (Triggering unit) to Attack-Move To (Center of Creep2 <gen>)

And this is ok too:

Code:
For each (Integer A) from 1 to Crab_Array_Waves[Number_of_Players], do (Actions)
    Loop - Actions
        Unit - Create Creep_Per_Player[Number_of_Players] Creep_Array[WaveCount] for Player 12 (Brown) at (Center of CreepSpawn1 <gen>) facing Default building facing degrees
        Wait 1.00 seconds

My main concern is creating a creep at the Center of a region. Will this leak because it is a center point? or is this ok because I defined the region, CreepSpawn1 <gen>? I am assuming its a possible leak because I am using the "center point" of this region. :confused:

Thanks for the help. Great tutorial.
 
Now you have made it so that you can destroy the leak. Each leaking variable has its own custom script to destroy it however, so you must memorize these lines:

You do not need to destroy a leak from a global variable, because you may override it later, and so it destroys its old value.


Another type of variable that leaks is a Region, but unless the region is not a default region (Playable Map Area), or a Preplaced region (Region XXXX <gen>), it will not leak. However the custom script to destroy a region is:

Custom script: call RemoveRect(udg_*Temp variable name here*)

A Region is not equal to a Rect. But it is referenced as Region in References, and not as Rect, whereas it does a Rect.


A. Units

Again, everytime a unit or hero is created, the game has to load the unit. You can reduce the in-game lag by preplacing all the units, and as soon as the game starts, remove the units. Even dummy casters should be preloaded, otherwise when the first time an ability is cast, it will lag.

B. Abilities

If you add any abilities to units, then you should also create a special unit, that already has the abilities, just for preloading. Just preplace this unit, and remove it as soon as the map initializes. Make sure you preload spellbooks, as they will lag the most if not preloaded.

A : Yes, it will preload.

B : No, it must work for each unit that is able to have the ability.


An another part you should add about this :
Code:
call Preload( <string path>)

You will see it is helpful, it is able to preload .blp, .mdx, .tga .... and anything :p , but can only run at Map Initalization, and for imported files.

So does :

Code:
call PreloadEnd( <a real timeout>)
call PreloadEndEx
call Preloader( <string path>)
call PreloadGenClear
call PreloadGenEnd( <string path>)
call PreloadGenStart
call PreloadRefresh
call PreloadStart


-----New Sections Coming...-----
-Massive Amounts of Objects
-Nullifying Local Variables

Nullifying locals is already done in the tutorial.
 
phenophae said:
great tutorial.

But I am still a little fuzzy on regions. I am assuming this is ok:

Code:
Trigger
    Events
        Unit - A unit enters Creep1 <gen>
    Conditions
        ((Triggering unit) belongs to an ally of Player 12 (Brown)) Equal to True
    Actions
        Unit - Order (Triggering unit) to Attack-Move To (Center of Creep2 <gen>)

This is not ok, because you use the point variable Center of (Region).

Your region is fine though, since it is already created/preplaced.

phenophae said:
And this is ok too:

Code:
For each (Integer A) from 1 to Crab_Array_Waves[Number_of_Players], do (Actions)
    Loop - Actions
        Unit - Create Creep_Per_Player[Number_of_Players] Creep_Array[WaveCount] for Player 12 (Brown) at (Center of CreepSpawn1 <gen>) facing Default building facing degrees
        Wait 1.00 seconds

My main concern is creating a creep at the Center of a region. Will this leak because it is a center point? or is this ok because I defined the region, CreepSpawn1 <gen>? I am assuming its a possible leak because I am using the "center point" of this region. :confused:

Thanks for the help. Great tutorial.

Again, you leaked a point variable because it is taking the center point of a Region. Your region is fine, again because it is already created/preplaced.

You do not need to destroy a leak from a global variable, because you may override it later, and so it destroys its old value.

Yes you do need to destroy a leak from a global variable. If you don't, and it is overwritten, then it is left in the memory, and you have no way to reference to it. The variable basically just points to the actual value stored in your memory, it is not the actual value itself, just a variable that points to it.

Chocobo said:
B : No, it must work for each unit that is able to have the ability.

If you add any abilities to units, then you should also create a special unit, that already has the abilities, just for preloading.

The ability itself is the only thing that has to be preloaded. You don't have to preload each unit that could have the ability added during the game, with the ability on it, just the ability itself. What lags is that the game has to load the ability when it is added.

Chocobo said:
An another part you should add about this :

Code:
call Preload( <string path>)

Thanks for the tip, i'll add it in. :)

Chocobo said:
Nullifying locals is already done in the tutorial.

Yes, that is an old post. I'll edit it. :p
 
Nulling strings is pointless. Once a string is created, the leak is permament (though don't remain after loading) - it is an engine optimisation, triggers can't control it.
 
Nulling strings is pointless. Once a string is created, the leak is permament (though don't remain after loading) - it is an engine optimisation, triggers can't control it.

Nope. A string takes ever at least 1 bit, but everytime you add substring, it increase by 4 bytes the total amount taken.
 
Nope. A string takes ever at least 1 bit, but everytime you add substring, it increase by 4 bytes the total amount taken.

String variables are not objects. They are 4 byte pointers which point to indexed strings in the engine. Those indexed strings are the 'leaks' - they cannot be removed in game. Every unique string generates one, and is assigned an index, which is what the string variable is (the pointer).

The total amount taken for each string variable is 4 bytes, but for each new unique string, some more memory is also permamently used up. It amounts to ~0.22kb I believe for an 8 character string, though my memory could be failing me a bit as I did the tests a long time ago.

Basically, it uses a similar system to handles, but the string objects don't ever get destroyed.
 
That looks like it would leak. It's using a point directly instead of a variable. I'm not entirely sure since I'm new at this :)

Question:
I have a trigger that checks if the someone selected a hero by entering a region. Should I remove this trigger later on (like after 3 minutes) to reduce lag? Also how do I reference triggers in JASS/custom script?

P.S. Awesome tutorial! *bows*
 

when i use
Code:
call DestroyGroup (udg_*Temp variable name here*)
why i have errors?
this is my trigger
Code:
Set Activ_players = (All players controlled by a User player)
Player Group - Pick every player in Activ_players and do (Actions)
    Loop - Actions
        Dialog - Show Nation_question for (Picked player)
Custom script:   call DestroyGroup(udg_Activ_players)
if i use DestroyForce then i dont have error.... why?
 
Theres been a problem.. even when i did all that use the optimizer and fixed the leaks.. my map still lags.. it lags really bad.. and i know its not my connection because when i host any other map its fine.. :(
 
Theres been a problem.. even when i did all that use the optimizer and fixed the leaks.. my map still lags.. it lags really bad.. and i know its not my connection because when i host any other map its fine.. :(

Do you have Massive Amounts of Objects, and are you preloading everything?

Even having the camera zoomed out counts as having Massive Amounts of Objects.
 
Does the "Wander" ability leak? I think ive removed all memory leaks in my city simulator map but it still laggs like hell after two hours... The only thing i can come up with is that the Wander ability leaks, because ive got tons of units using that ability...

Gr8 tutorial btw =)

bump
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top