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

what is better to avoid lag and have better performance

Status
Not open for further replies.
Level 3
Joined
Mar 4, 2013
Messages
35
scenario 1:

you finish casting a spell,it creates like 10 units (dummys) and you dont do anything to remove them, you just gave them an expiration timer of 1-2 seconds, this means these units will dissapear from the map after a while (depends on your map configuration, on mine it is 20 seconds) (when the dead bodys dissapear)

keep in mind there could times where theres like 4 people casting these spells on the screen

scenario 2:

you finish casting a spell,it creates like 10 units (dummys) but this time you create another trigger to remove their "dead bodys" 2 seconds after they die

keep in mind the trigger will run around 10 times after each spell is casted

  • Event
    • Unit - A unit dies
    • Conditions
      • (Unit-type of (Triggering unit)) equal to Dummy94
    • Acciones
      • Wait 2.00 seconds
      • Unit - Remove (Triggering unit) from the game
hope you guys understand
 
Level 3
Joined
Mar 4, 2013
Messages
35
Set the death type of the dummies to can't raise, does not decay. Additionally, you can shorten the death time also. No need for a trigger that removes a dummy unit.

wouldnt there just be invisible dead bodys with "can't raise, does not decay" or something that counts as a dead unit

dead bodys still count as units from what i know so i want them removed as fast as possible

and no i cant lower it from 20 seconds, i need it that way for something else
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Don't use waits with a global variable, it'll get overwritten, just remove it immediately on death event or use a local variable with your waits.
I was wrong here, I apologize.
 
Last edited:
Don't use waits with a global variable, it'll get overwritten, just remove it immediately on death event or use a local variable with your waits.

There is no global variable.

@TO

Option one create one dummy at map init. Move that dummy to position and do whatever u need to. This way only one unit gets created for that spell even if that spell is used thousands of times.

Option 2 Same as above but instead create 10 dummies if the first option doesn't work.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Oh, yeah, sorry bout that. What I was trying to say was don't use Triggering Unit with waits.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
I guess the reason you started this thread is, that you already experience huge fps drops or lags in your map.

Handling 40 units during the same time shouldn't be a problem at all, if the code is written proper.
I think that you will gain a much higher performance boost, if you improve your the way your spell is beeing executed than removing dead units from the game.

If you you really want to remove every dead unit a few seconds after death. I would do it this way:

Run two timers. Timer one expires every e.g 2 seconds and picks every dead unit, these are unit with life < 0.405. The store them in a array unit variable.
The seconds timer starts, when Timer one expires e.g 1.5 seconds. On expire you remove every stored unit with a loop from the game.
Using a filter might be usefull, as maybe you don't want to remove every dead unit.

Personally i wouldn't want to remove dead units manually from game and rather would go with Maker's advice.
 
Status
Not open for further replies.
Top