• 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.

Creating units & lag

Status
Not open for further replies.
Level 2
Joined
May 5, 2008
Messages
16
I have made quite a large map in which creeps (about 60) spawn every minute. It causes a short lag :sad:and I don't know how to fix it. Do you have any ideas?

PS. This delay or lag is noticable mainly for host
PS2. When the map was smaller everything was fine.
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Making many units at the same time creates a little lag. To fix it you could add a little wait. Like
  • Spawn
  • Events
    • Every 60 seconds
  • Conditions
  • Actions
    • For each integer a 1 - 10
      • Unit - Create 6 YOUR UNIT at YOUR POINT facing some degrees
      • Wait 0.1 seconds
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Preload the unit's model at the start of the map, that will reduce the very first lag.

Removing all leaks will also help reduce lag.

Having fewer units will also reduce lag, as if you have 1000s of units on the map it takes longer to make a new one.

Using a timer to delay the creation of the units so it is not instant will also reduce delay.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Having a wait of 0.0 i less then 0.1 (and there still is a wait). Waiting -1 is even less(just one Idea less).
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
By PurplePoot
But yeah, triggersleepaction(aka wait) is quite inaccurate.
But sometimes it is useful.
Like in this trigger.
P.s. 0 is a lot more easier/faster to write/remember than "-4294967296" ;)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
spiwn you left out that 0 is also more space (smaller file size) efficent as it takes up less characters in the script file.

TriggerSleepAction() is basically only good for when you need something loosly timed and just need a break to prevent lag or slow down a chain of actions (like on map load or when loading a boss or something). For long waits it is recomended to use the PolledWait function blizzard made as it uses a combination of timer and sleep action to remain closer syncronised.

Sleep action of 1 minute may be as long as 2 minutes or more.
Polled wait will only be slighly more than 1 minutes.
Timer will be as close to 1 minute as possiable in WC3.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
That is true, but ... er ... has no relevance to this thread(who said anything about long waits) :)
Having less lag was the purpose of the thread(it is even in the name) ;)
Using the trigger that The_Reborn_Devil posted would be sufficient. Using a 0 or -1 wait(triggersleepaction) would make the units spawn faster and lag would still be reduced.
P.s. I have nothing against your post, people that do not know that can learn some stuff but but it is off topic(most of it :D )
I think the topic has bean "fulfilled" by now.
 
Status
Not open for further replies.
Top