PDA

View Full Version : Severe lag when picking unit.


Spartipilo
08-18-2011, 11:47 PM
I was making a map, but i secrewed up with the terrain, so began making it again: copyed everything from the first one to the second, and started the terrain job... BUT now, someway, and somehow, picking the hero pauses the whole game (with lag, not real pause) =/ and after 3/4 segs, the hero is finally given =/

Why is this happening? (Map attached)

I've noticed it has nothing to do with triggers or else, since the lag is there even with all triggers off =/

Dr. Boom
08-19-2011, 12:20 AM
Moin moin =)

This lag you talking about comes from the abilities, the hero have immediately. When you remove them, the lag is gone.
Actually I don't have an idea how to prevent this, because even if you add the abilities with the trigger, the lag comes up

Edit: Well I looked to the abilities .. come on each ability has 50 levels * 5 abilities = 250 data immediately <- this cause the lag!! (I set each ability to only 1 level and lag was gone)

Edit 2: Also you have a lot of trigger mistakes - but this is another topic.

Greetings and Peace
Dr. BøøM

Spartipilo
08-19-2011, 12:42 AM
Thanks!

But there's a reason for that. I want the hero to be able to hold X quantity of skill points. If i set all the skills to lvl 1, the hero is only abe to carry 10 skill points, even if he lvls up and the Skill Points are triggered.

The max lvl is 50, and hero has 5 abilities, so, max skill points available would be 250...

The question is: How can i do this without the lag? :)

Ameranth
08-19-2011, 01:01 AM
What you are experiencing is from the abilities being loaded in.

To circumvent this problem, you need to preload those abilities. In order to do this, create a trigger that will spawn a unit (any unit) and have the trigger add the first ability to this unit, then remove the ability from this unit. Repeat adding/removing abilities from this unit until you've done it for all abilities you want to preload. Now, when all abilities have been done, remove this unit.

This is ideally a trigger run at map initialization, doing this should solve your lag.

EDIT:
Keep in mind that doing this means that your map will load slightly slower, since the lag you are experiencing will instead happen as the map loads.

Spartipilo
08-19-2011, 01:31 AM
Works great, and loading isn't affected that much. I just created/removed the same unit from game on Map Init...

If there's a better way to avoid this problem would be awesome if someone would let us know it.

Mr_Bean
08-19-2011, 07:41 AM
You could also place all your heroes in the World Editor so that they are loaded while the map is loading. You would then remove these units with triggers at map initialization. This would, however, increase loading time quite a lot.

- Mr_Bean

DeathChef
08-19-2011, 09:21 AM
You don't remove units but explode them instead or they will cause a leak.

defskull
08-19-2011, 09:25 AM
You don't remove units but explode them instead or they will cause a leak.

Latest research by DSG (if I'm not mistaken) stated that, removal of unit by using the Unit - Remove action does not leak.

DeathChef
08-19-2011, 09:29 AM
Latest research by DSG (if I'm not mistaken) stated that, removal of unit by using the Unit - Remove action does not leak.
That's good to know so now I know that it Isn't bad to use remove unit event:)

Mr_Bean
08-19-2011, 10:29 AM
That's good to know so now I know that it Isn't bad to use remove unit event:)

Remove unit action* :grin:

Spartipilo
08-19-2011, 02:16 PM
Mr Bean, does that way proves to be better than adding/removen via trigger at Map Initialization?... seems similar to me

Ameranth
08-19-2011, 08:46 PM
Both the methods given are relatively the same, however, as you get to a larger amount of abilities that you want to preload, it will become best to use the method I explained earlier.

Mr_Bean
08-20-2011, 08:16 AM
Mr Bean, does that way proves to be better than adding/removen via trigger at Map Initialization?... seems similar to me

I just find it easier to do. They're basically the same, just depends. My way has a longer loading time but no delay in-game while loading them. Ameranth has a shorter loading time but delay in-game while the heroes and abilities load.

Ameranth
08-20-2011, 11:18 AM
Any trigger activity happening on map initialization will take place as the map is loading, thus it appears to load slower, but when the players enter the game, there will be no delay.

The only exception to this is when trigger actions occur after a wait action placed in a map initialization trigger.

Mr_Bean
08-20-2011, 11:49 AM
Oh okay, I never knew that.