#Does removing units after death improve performance?
1 messages · Page 1 of 1 (latest)
They are removed automatically.
You don't need to be removing them manually unless you gave them weird modifiers or something
Thanks, that's what I suspected. Made little sense to remove them because they're already dead anyway
I mean, they die, play their death animation, then go below the ground, where they are removed completely
Yeah. I'd assume it would only be an issue if a modifier the unit has isn't removed on death, but alas
They might not be removed if you give them SetUnitCanRespawn
as they're waiting to be resurrected essentially
That's a good point, makes sense, will keep it in mind
npc_dota_thinker units a.k.a. thinkers are sometimes not removed automatically. That's why you can see Valve examples (siltbreaker, aghs lab etc.) use UTIL_Remove very often for thinkers. I use ForceKill for thinkers because it's safer. So the person that told you 'that removing units after they die with UTIL_Remove would free them ' probably thought of thinkers instead of normal units.
Valve guides say that thinkers MUST be removed manually.
They not removed if have permanent modifiers for example
I'm not sure I understand the concept of npc_dota_thinker? Do you have an example of where you use ForceKill on these thinkers that I can take a look at?
An easy example is using CreateModifierThinker. What it does is create a unit of type npc_dota_thinker and then assign it the chosen modifier.
If that modifier is permanent (e.g has no duration) then it will never be removed, along with the thinker it is assigned to.
Found 1 function for createmodifierthinker
🇸 CreateModifierThinker(caster: CDOTA_BaseNPC|nil, ability: CDOTABaseAbility|nil, modifierName: string, paramTable: table|nil, origin: Vector, teamNumber: DOTATeam_t, phantomBlocker: bool): CDOTA_BaseNPC
Create a modifier not associated with an NPC.
Seems like the description is a lie lol.
Oh right, I've seen it before but I never use it, so I guess it's not something I have to worry about then?
I only use StartIntervalThink
It's useful for things that are placed on a location, e.g. Disruptor's Static Storm - you make a modifier that ticks and does the damage and has an aura that silences/mutes enemies inside, yada yada yada
The StartIntervalThink is not relevant to this discussion
I just create units manually and kill them afterwards
I suppose that's inefficient but oh well
It's the same as doing this, really
The best thing to do is actually to find a solution that has nothing to do with a modifier
For instance you could just have a timer/context thinker deal damage in that area while the particle and sound are playing
This way you're not spawning units at all which is what Dota's engine is so terrible with
Right, that makes sense
I remember Dota IMBA implemented Batrider's Firefly thing and that always caused immense lags whenever people used it in a game
It created a modifier thinker every 0.5 seconds IIRC which made up the trail of fire
And each of those were auras for debuffing units to take damage periodically
And of course there was a talent to extend the duration even more