| 04-20-2008, 04:31 PM | #2 |
you should use GetUnitX and GetUnitY for avoid the creation/destruction of locations. also instead of use point with polar offset use directly the formula |
| 04-20-2008, 04:32 PM | #3 |
Beat to the post... Yeah, try to use direct JASS... The only thing I can see that would cause the lag is the fact that there are a bunch of executions at that instance each time, but I don't think that would explain the lag... :\ |
| 04-20-2008, 04:58 PM | #4 |
So it all comes down to mathematics then? |
| 04-20-2008, 05:23 PM | #5 |
i think it's because the creation/destruction and also using fuction with locations, which are slower than the functions using X/Y. and when you use the polar offset you call a function, the same for angle beetween points. it's very slower than use directly this : JASS:local real xa = GetUnitX(<yourUnit>) local real ya = GetUnitY(<yourUnit>) local real xb = GetUnitX(<yourUnit>) local real yb = GetUnitY(<yourUnit>) local real angle = Atan2(yb- ya, xb - xa) set x = x + 128.0 * Cos(angle) set y = y + 128.0 * Sin(angle) |
| 04-20-2008, 05:33 PM | #6 |
I can't imagine this being a math problem. Might have something to do with allocating 36 locations every 20th of a second, even if they are properly removed. |
| 04-20-2008, 08:56 PM | #7 | |
Quote:
That is what I think is the problem. Real coordinates are accurate and don't need to be removed. But the math could be part of the problem. I don't think that Cos and Sin are the fastest functions in the world, are they not? Even in JASS, I think it would still lag a bit but still probably reduce it a bit. On a scale of 1-10, how bad is the lag? (1 = Hardly Noticeable 10 = Extremely choppy movements and extremely laggy) |
| 04-21-2008, 04:34 AM | #8 |
It varies. It runs fine for about 3 out of 10 seconds, then get's bad when the units start attacking. EDIT: Changed the trigger into the JASS version with full math, seems like it has reduced the lag, but now I get a 'necklace' instead of a 'snake'. |
| 04-21-2008, 12:33 PM | #9 |
You made the conversion wrong then. I seriously doubt this trigger is the reason for your lag. Specially if the lag is not constant. |
