In real-world game programming I use a system to separate the (infinite) game world into a grid, with each square in the grid being a cell where objects are added and removed from based on their location.
This is not applicable in wc3 because Jass is too slow (crigges and me did heavy benchmarking). Group enums are way faster in almost all cases.
Im not even convinced that immolation or let alone phoenix fire are faster then periodic enumerations. They seem like pretty CPU intense abilities to me - and remember that abilities also create additional unwanted overhead (firing several events, if you run a damage detection engine then even more overhead is added). Plus buffs and debuffs are always delayed.
Before we praise phoenix fire as the holy grail of collision detection, someone HAS to run a benchmark first.
With no art, zero missile speed (which means instant) i dont think there is too much overhead, but of course we have to test it.
I just said from a functionality standpoint it makes no problems and kari didnt tell me about fps drops.
How is buff/debuffing delayed and how does it matter?
The buff is instantly applied and removed again, you dont notice it ingame and i doubt removing an ability is much overheard.
You need damage detection for the collisions sherlock, but this is the point ofthe buff. It tells you if the last current damage event was triggered by phoenix fire or smth else.
Yes you have to add an if to that in your damageDetection, again not rly a problem.
e:
Depends on the map, really. But even at non-constant move rates it can be pre-calculated when doing the maths.
Doing the maths is imho the go-to approach for all non-homing missiles. The advantages are clear:
1) You run collision detection at O(n) complexity just once per missile, not periodically. Plus, it can be highly optimized by shortcut conditions.
2) The collision radius can be completely dynamic
3) The collision point is precise and deterministic and not just approximated with a precision depending on the period of enumerations/ability ticks
4) Collision detection performs flawlessly even for small, fast moving projectiles.
Btw, point 3) is a neccessity if you want to support reflective bullets. Any method approximating the intersection point will completely mess up reflection angles.
I said linear too, let's just keep it an static, since the missile is taking a static route. Of course it is possible for more to some degree, but except for very fast bullets, pointless.
Even in Warlock where missile-missile collision is used and many projectiles move at constant/linear speeds it's all destroyed by any gravity spell.
It's just not common and boring to have static missiles.
As I said, in any real map that is not a minigame, you need dynamic collision detection.
Missiles can be affected by other spells, terrain deformations, other forces like dynamic wind, values of the missiles can change during the travel, and then you would have to recalculate intersection point at every change, which is surely slower when having a bunch of missiles/collideable objects.
Then again you always have user interaction, which almost always involves moving a unit or something. and that unit usually should collide with the missiles.
to 3) the collision point would only be precise if you start another timer with the exact timeout, else it is obstructed by the animation period you are using.
4) small fast moving projectiles should be handled differently anyways, that's why popular physics engines have bullet modes or presets that use continuous collision detection.
That could also be done by simply interpolating the distance the bullet misses to check. This would pretty much be the only time where the pre calculation really is useful.
All in all, I think that periodic approaches (except for homing missiles) are just pure lazyness. Do the maths, it's totally worth it, both for performance reasons and for accuracy.
I highly doubt it, as stated before. Almost any map has units in them that move dynamically. Almost no map has missile-missile collision, and if it has (warlock, stygian, aim and evade) the missiles react to other dynamic forces, removing the purpose of pre calculation.
Even bullet deflection often has to be dynamic, e.g. if you can place shields/barricades during the flight of the missile. It is just not done with 1 calculation at start.