| 09-15-2008, 08:29 PM | #1 | |
Alright, I've always been really uptight about using Periodic Timers in my (GUI) triggers for custom race abilities, because I was under the impression that more than 1-2 would slow down the game noticeably (which I was trying to avoid). So I've been using stuff like "Unit is Attacked" and "Unit is given an Order", or "Unit Casts a Spell", etc, to detect different things for different spells, where perhaps a Periodic Timer would've been better/cleaner/faster/etc. Then Szythe comes on and says (source post): Quote:
~~~ So my question is, what can you tell me about the usage of Periodic Timers? Specifically, how many can I have before the game slows down (if ever?), and what kinds of things done with Periodic Timers that can be bad? (for reference, I would normally be using this to keep custom Auras updated on affected units, and stuff like that... ?) Help would be appreciated (i.e. +Rep). |
| 09-15-2008, 09:28 PM | #2 |
If you do use periodic timers, make sure you never use .01 intervals. .03-.05 is much better, and you can't tell the difference. |
| 09-15-2008, 09:28 PM | #3 | ||
Quote:
What exactly are you doing/planning on doing with periodic timers/triggers though? Might be able to give a more specific answer since there's going to be an obvious difference between setting some variables and doing a small few actions vs. doing a bunch of fancy things EDIT: Oops, didn't see this bit Quote:
|
| 09-15-2008, 09:34 PM | #4 |
The problem is not how many timers you have running in a game, but how heavy is the code run in the looping functions. |
| 09-16-2008, 12:08 AM | #5 |
What about coordinate/angular calculations (in general)? Say SquareRoot, Cos, Sin, Atan2, etc.? Just curious, because in my spell I'm knocking units into each other and often the timer will need to change angles / distances (with a .035 interval) if the target unit moves around. |
| 09-16-2008, 12:40 AM | #6 |
SquareRoot ain't too fast, but the trig functions are lightning fast, faster than an empty function call. |
| 09-16-2008, 12:42 AM | #7 |
Nope, no lag. Nice spell too, I really like it. EDIT: hmm, squareroot is damn useful, I'm assuming Pow(base, (1/2)) is even slower? |
| 09-16-2008, 02:12 AM | #8 | |
Quote:
wc3 engine weakness is basically handling a lot of units, especially instant moving them at any rate also. If there is a map which is capable to have 80 projectiles without lagg, I would like to see that myself. I don't believe that is nothing until I see it with my own eyes. ______________ Personally I prefer to use casting/attacked events and such, I try to avoid timers myself. I develop ways to use ingame stuff as much as possible. Simple example: Projectile system without periodic trigger for detection Eliminate the need for triggered projectile detection, by adding ability which units which kills the projectiles within certain range (modified phönix fire). Instead of having 2 rapid periodics, you have only 1 for projectile trigger. Just an example.... |
| 09-16-2008, 03:41 AM | #9 |
I have had trouble getting more then 60-70 at a time going at .035 with non-exquisite math and physics, along with a groupenum or two there is no way I can see 150 working, even when simply moving them in a straight line with no fluff, WC3 don't work that well |
| 09-16-2008, 04:37 AM | #10 |
Ok, these are some examples of triggers that could be "optimized" with periodic event timers: Trigger: Trigger: Stuff like that? Might be more... |
| 09-16-2008, 06:45 AM | #11 | |
Quote:
0.025 is the lowest that makes any noticeable visual difference. |
| 09-16-2008, 11:43 AM | #12 |
Lithany I get problems with moving 40 "projectiles" and it lagg extremely with 0.05. I don't understand why you claim moving 80 projectile isn't noticeable. I use GUI so it may be major, but I would like to see the code with my own eyes which makes moving 80 projectiles smoothly, cuz my movement trigger is extremely laggy. |
| 09-16-2008, 12:12 PM | #13 | |
If you use GUI, you obviously don't care about performance. TKF, I've had hundreds of units moving smoothly without any problem. Quote:
I presume a lot more so. SquareRoot shouldn't be that slow, but you rarely need it (better to compare the squares). Pow needs to be more general, so is slower. |
| 09-16-2008, 12:21 PM | #14 |
Kyrbi0, you have two problems:
|
| 09-16-2008, 01:08 PM | #15 | |
Quote:
|
