• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Looking for Tips on Reducing Lag

Status
Not open for further replies.
Level 4
Joined
Aug 1, 2007
Messages
66
I'm looking for tips on reducing some lag in my map. I've noticed it on initialization, when you choose your hero, and on item combinations. I've linked my map cuz there's alot of triggers involved. My map is uploaded in the map development section here:

http://www.hiveworkshop.com/forums/f202/king-queen-104763/

My item combination triggers are all in 3 really long triggers. One for when a unit gets an item, one for when they lose an item, and one for when they use an item. Might it help to break them down into smaller triggers or use some sort of item combination system? Thanks for any help.
 
Level 10
Joined
Jun 26, 2005
Messages
236
Two Tips:

- To reduce initialization lag, do all initial stuff over a longer period of time. You might have played Island Defence... there's a cinematic while the map loads stuff over time.

- To reduce first-time hero selection lag, preload the heroes. That involves creating each hero involved in your map, and removing them.
 
Level 4
Joined
Aug 1, 2007
Messages
66
I like the cinematic idea, I was contemplating doing something like that to point out objectives to people. As for creating the heros, do you mean just make a trigger create all the heros on the map then remove them during the setup process?
 
Level 6
Joined
Sep 5, 2007
Messages
264
"Preloading" = Creating a unit, item, ability (dummy unit with ability), etc. and giving them a VERY short lifespan, IE: 0.01 seconds, so as to remove them once the map actually starts up. This process stops the inital lag when using the said unit, item, ability,etc. the first time because they have technically been USED before (already loaded into memory).

Hope this clears things up. :thumbs_up:
 
Level 5
Joined
Jan 6, 2006
Messages
106
I like the cinematic idea, I was contemplating doing something like that to point out objectives to people. As for creating the heros, do you mean just make a trigger create all the heros on the map then remove them during the setup process?

You can either incorporate them directly into the map, which will result in increased loading time, or just make a trigger as you have said. But remember, NEVER add the heroes during Map Initialization. Wait at least the initializing functions to finish running before you preload your heroes.
 
Level 4
Joined
Aug 1, 2007
Messages
66
Thanks alot for the tips guys, I'll try it both ways and see which way I like the best. I've started learning JASS by converting all my triggers to text and going through trying to make things more efficient, moving all of the funtions except the triggers actions and conditions into the map script and getting rid of some duplicate functions. I'm up to my item triggers now and would like to find an efficient item combination system. I've looked through the systems in the spell section, but none of seem to be really badass according to the feedback. Any suggestions for this?
 
Level 5
Joined
Jan 6, 2006
Messages
106
Why never in Map Initialization??? It works for me... :confused:

I just give them an expiration of 0.01 seconds, they load properly (yes, slightly increased loading time) but, it gets rid of "hero selection lag". Where's the issue???

I found out that usually that if I insert performance demanding actions into the map initialization, it will usually cause server splits in multiplayer.

I'm still not sure the same thing applies to everyone, though.
 
Level 9
Joined
Oct 28, 2007
Messages
435
Removing memory leaks created by locations and special effects also helps a lot. I don't know how much you know JASS. There is a good here somewhere totorial somewhere. Umm basically whenever you use a location for instance:
unit - Create [Footman] at [position of bloodmage 001] facing 60 degrees or something
Whenever you have a location like in the above example the position of the bloodmage it stores the location.

That "location" then take up memory (ram) and cause lag. You might not have realised this because you might only have a small amount of referances to locations, but if you have a timer running every 0.04 seconds, leaking every time - you will have mayor lag.

To remove this location you need to follow these two steps.
1: First you should for instance in the above example set a variable to that location
2: Your action
3: Have a custom script. Add "call RemoveLocation(udg_your variable name)"
whenever you rever to variables in custom script you should add udg_ before it

So it will look like this: (I created a variable TempLocation for this)

set TempLocation=Get (bloodmage) postion
Create Footman at TempLocation facing 60
CustomScript(call RemoveLocation(udg_TempLocation))

Specail effects also leak, but you only need to:
Destroy Special Effect (last created special effect)

For other stuff that leak and a better explanation. Search under the totorials for removing leaks or things that leak.
 
Status
Not open for further replies.
Top