HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Which would be better?

03-08-2008, 03:36 PM#1
darkwulfv
In terms of general efficiency, which set up would work best?

Scenario: I have an AoS with a lot of different spawns, many of which have abilities that I plan on casting when the spawns attack (like fireballs and flame strikes, healings, etc. etc. so on and so forth).

Option 1:
I have 1 'master' trigger for each of the computers. (3, in my case). This trigger fires whenever a unit is attacked and checks that the attacker is for the proper computer. If it is, it is then run through a long If/Then for every unit that has an ability on that team (probably nearing 15ish by the final development). When it reaches the right UnitID, it calls a function that pertains to the unit.

Option 2:
Make individual triggers for every unit type that all fire when a unit is attacked.

Option 3:
Similar to option one. The difference is that this one runs a trigger for the unit, so that the trigger doesn't have to fire on attack; rather, it only fires when told to. However, I see a disadvantage in that I'd have to use a handle system to transfer data, whereas that wouldn't be needed in Option 1.


So, let me know what you think. Because my AoS has different wave types (having different units in them), I thought I would just turn off the triggers for the units not in those waves, but then I remembered they might still be fighting when that happens, thus messing it up.

Oh, and a question. If a unit uses an autocast spell (on autocast) like slow for example, that fires a "Unit starts the effect of an ability", right? If so, I might consider giving my units autocast spells and then just using abilities when they do. The problem I'm seeing with that is that I'd have to base them off of negative autocast spells... of which there are very few, and even then I don't think 4 different units will cast a "slow" based spell on a single unit... Unless the buff never showed up... Hmmm...
03-08-2008, 03:47 PM#2
Captain Griffen
I'd go option one. A properly set up binary search tree will cut the number of checks to log(n). However, given that checks of non-array variables are basically zero cost, even that wouldn't be needed.

Make sure that you put those checks in the condition, though, so you don't create needless threads.
03-08-2008, 04:02 PM#3
Rising_Dusk
Quote:
Oh, and a question. If a unit uses an autocast spell (on autocast) like slow for example, that fires a "Unit starts the effect of an ability", right?
Yes.

And the first option, definitely.
03-08-2008, 06:27 PM#4
darkwulfv
Quote:
Make sure that you put those checks in the condition, though, so you don't create needless threads.
So in the condition check both that the unit is of the proper computer player and that it's a unit w/ an ability?

And thanks for your help, both of you.
03-08-2008, 06:46 PM#5
Rising_Dusk
Quote:
So in the condition check both that the unit is of the proper computer player and that it's a unit w/ an ability?
Yeap.