I am working on a map where I want full control of casting animations and abilities. There won't even be the regular attacks in it.
However, I am still at a very early stage. I'm just importing / building systems to be used as building blocks down the road. I'm using only JASS in the native wc3 map editor. I'm fairly well versed in it. Pseudo code or JASS are preferred if you are trying to explain a code strategy to me.
I thought of two ways to handle abilities. They will generally have a duration to them but need to be capable of handling cases where they are interrupted (most likely due to a stun effect). For example, the first enemy I will implement is a giant beetle who charges at the player units. If it gets stunned, I want it to stop charging and slide a little bit in the direction it was charging (can't just stop so suddenly so easily and I want it to look smooth - I already have knockback system in place).
Note that I don't plan to have a ton of units fighting at the same time - maybe around 50-100 at once will be an absolute upper limit (though it's undecided in this early stage of development - doubt it will get that high but who knows).
Method 1
Create a timer that handles the entire charge (or other ability), firing frequently to create smooth movement and apply its effects. If the unit is affected by something that should stop it, recycle the timer and handle the "interrupted" case (for the beetle, apply a small knockback in the direction it was charging).
Method 2
Create a system where I input triggers to fire with just one central timer to handle each currently active ability. I know the trigger condition trick to increase performance (don't use trigger action, just use trigger condition and always return false) but I have no idea if firing a trigger every 0.03 seconds for every active ability will cause any problems, or if it will be slower or faster than method 1.
TL;DR: What will have better performance: A new timer for each instance of an ability or one central timer where I fire a trigger for each instance of the same ability?
However, I am still at a very early stage. I'm just importing / building systems to be used as building blocks down the road. I'm using only JASS in the native wc3 map editor. I'm fairly well versed in it. Pseudo code or JASS are preferred if you are trying to explain a code strategy to me.
I thought of two ways to handle abilities. They will generally have a duration to them but need to be capable of handling cases where they are interrupted (most likely due to a stun effect). For example, the first enemy I will implement is a giant beetle who charges at the player units. If it gets stunned, I want it to stop charging and slide a little bit in the direction it was charging (can't just stop so suddenly so easily and I want it to look smooth - I already have knockback system in place).
Note that I don't plan to have a ton of units fighting at the same time - maybe around 50-100 at once will be an absolute upper limit (though it's undecided in this early stage of development - doubt it will get that high but who knows).
Method 1
Create a timer that handles the entire charge (or other ability), firing frequently to create smooth movement and apply its effects. If the unit is affected by something that should stop it, recycle the timer and handle the "interrupted" case (for the beetle, apply a small knockback in the direction it was charging).
Method 2
Create a system where I input triggers to fire with just one central timer to handle each currently active ability. I know the trigger condition trick to increase performance (don't use trigger action, just use trigger condition and always return false) but I have no idea if firing a trigger every 0.03 seconds for every active ability will cause any problems, or if it will be slower or faster than method 1.
TL;DR: What will have better performance: A new timer for each instance of an ability or one central timer where I fire a trigger for each instance of the same ability?