- Joined
- Jul 10, 2007
- Messages
- 6,306
so, I've tried to solve a way to do this and all of my solutions have thus far sucked. My latest one couldn't even handle 80 units...
So, does anyone have any genius ideas? : )
My last solution created a grid of rects across the map.
x dimension / 128 rects
y dimension / 256 rects
it added these rects to two alternating regions (alternated as x (column) changed).
So essentially, this could determine when a unit moved a certain distance. It's accuracy was kind of meh (1 to rt(128^2*2)), but it has much less overhead than a timer =).
So yea, that's the grid thing. This meant that as a unit moved from one 128x128 tile to another, it'd do it's thing =). Useful for ranged auras that have stats depending on the range I guess =P.
The real problem in my Morale system with this lies in the iteration. If there are 100 units all moving at the same time, it requires 9900 iterations (100*99).
Every single unit gets a unit group, and all other units are added to that unit group. For example, if there were 100 units, then each unit group would have 99 units and there would be 100 unit groups. This means that the maximium iterations would be 100*99, and unit groups are slow to iterate through to begin with (but forced to use them).
So, does anyone know of any better ways, or it this just impossible to do in WC3? >.>
So, does anyone have any genius ideas? : )
My last solution created a grid of rects across the map.
x dimension / 128 rects
y dimension / 256 rects
it added these rects to two alternating regions (alternated as x (column) changed).
So essentially, this could determine when a unit moved a certain distance. It's accuracy was kind of meh (1 to rt(128^2*2)), but it has much less overhead than a timer =).
So yea, that's the grid thing. This meant that as a unit moved from one 128x128 tile to another, it'd do it's thing =). Useful for ranged auras that have stats depending on the range I guess =P.
The real problem in my Morale system with this lies in the iteration. If there are 100 units all moving at the same time, it requires 9900 iterations (100*99).
Every single unit gets a unit group, and all other units are added to that unit group. For example, if there were 100 units, then each unit group would have 99 units and there would be 100 unit groups. This means that the maximium iterations would be 100*99, and unit groups are slow to iterate through to begin with (but forced to use them).
So, does anyone know of any better ways, or it this just impossible to do in WC3? >.>