Hi everyone.
Still working on my aMazing Balls TD, trying to optimize it again.
The Handle Counter shows there are leaks, but i null all my handles, and remove / destroy all unused units, destructables and timers. And no-one seems to have found a leak in the trigger I posted recently.
So I decided to take another approach to gain performance (and maybe removing leaks indirectly in the process) :
Until recently, I was using a trigger to autocast all my non hardcoded autocast tower abilities.
But the event I used was the Player Event "A Unit is Attacked" for the player owning the creeps (Balls).
As I explained in other posts, I already have an intensive EVENT_UNIT_DAMAGED added to a trigger for each Ball, so this other "attacked" event does not help.
The abilities the towers need to autocast have no target (one targets the position of the casting tower to emulate an AOE stun with no terrain deformation, so it does not need to have a target).
So I decided to use a HashTable that will save (for each tower that has one of these autocasts) a trigger for the tower, and the order for the autocast ability specific to that tower.
The idea is to avoid generic event to improve performance, and also being able to destroy the trigger attached to the tower when this tower is sold / upgraded or removed from the game.
Before i completely rework these triggers, I need information only JASS EXPERTS can give :
1) From this old 2017 thread : ConditionalTriggerExecute vs TriggerEvaluate
You can read that Trigger Condition "Will be destroyed if trigger is destroyed". The link for the proof is unfortunately dead.
So can any expert confirm this ? This would prevent a lot of hassle saving the conditions for these triggers (and all other triggers using conditions only) in order to remove them before the triggers are destroyed.
2) The native I use is
Of course, I would only need the triggers to be evaluated when a Ball comes in range of the tower, not any other unit.
- so is it better to use the filter from the event registration, or just add another test in the trigger condition ? (performance wise)
If the filter is better, how do I use it ? Filter( function UnitIsABall) ?
Thats it. If anyone has enough knowledge in Jass to answer these two simple questions with no doubt, I would be really grateful.
Thank you,
Take care.
Still working on my aMazing Balls TD, trying to optimize it again.
The Handle Counter shows there are leaks, but i null all my handles, and remove / destroy all unused units, destructables and timers. And no-one seems to have found a leak in the trigger I posted recently.
So I decided to take another approach to gain performance (and maybe removing leaks indirectly in the process) :
Until recently, I was using a trigger to autocast all my non hardcoded autocast tower abilities.
But the event I used was the Player Event "A Unit is Attacked" for the player owning the creeps (Balls).
As I explained in other posts, I already have an intensive EVENT_UNIT_DAMAGED added to a trigger for each Ball, so this other "attacked" event does not help.
The abilities the towers need to autocast have no target (one targets the position of the casting tower to emulate an AOE stun with no terrain deformation, so it does not need to have a target).
So I decided to use a HashTable that will save (for each tower that has one of these autocasts) a trigger for the tower, and the order for the autocast ability specific to that tower.
The idea is to avoid generic event to improve performance, and also being able to destroy the trigger attached to the tower when this tower is sold / upgraded or removed from the game.
Before i completely rework these triggers, I need information only JASS EXPERTS can give :
1) From this old 2017 thread : ConditionalTriggerExecute vs TriggerEvaluate
You can read that Trigger Condition "Will be destroyed if trigger is destroyed". The link for the proof is unfortunately dead.
So can any expert confirm this ? This would prevent a lot of hassle saving the conditions for these triggers (and all other triggers using conditions only) in order to remove them before the triggers are destroyed.
2) The native I use is
native TriggerRegisterUnitInRange takes trigger whichTrigger, unit whichUnit, real range, boolexpr filter returns event
Of course, I would only need the triggers to be evaluated when a Ball comes in range of the tower, not any other unit.
- so is it better to use the filter from the event registration, or just add another test in the trigger condition ? (performance wise)
If the filter is better, how do I use it ? Filter( function UnitIsABall) ?
Thats it. If anyone has enough knowledge in Jass to answer these two simple questions with no doubt, I would be really grateful.
Thank you,
Take care.