| 02-09-2009, 09:56 PM | #1 |
I'm planning to execute periodicly actions and checks for some (6 to 8) units. First part of calculations will be done by my camera system, that detects terrain's occlusion and calculates the appropriated angle of attack (short period, about 0.03s). The rest concerns my physic system, that calculates the slope of the ground where the unit stands, to adjusts its movespeed (0.5s ?). Additional calculations could be done when the physic system detects a steep slope, a fall, a jump... (shorter timer period than 2nd part, about 0.03s) Several methods can be envisaged but I really need to determine wich is the best solution to my problem. One timer A single timer triggers both camera's calculations and physic checks. Plus a possible use of a "timing" variable, to only perfom slope checks every X times. Two timers A timer for the camera. A timer for physics, the period of this one could be changed to a shorter one when a move is started. I'm also interested by alternative methods. Thx |
| 02-09-2009, 10:49 PM | #2 |
I go for 2 timers, one for the camera and other for physics. This will reduce any chance of lag. |
| 02-09-2009, 11:10 PM | #3 |
An other question came to me ; in general, should I use only one timer that runs actions over units stored in an array, or one timer by unit (for a reasonable amount of units) ? |
| 02-09-2009, 11:24 PM | #4 |
You could try using a group and ForGroup() calls and remove and add units as necessary. |
| 02-09-2009, 11:27 PM | #5 | |
Quote:
well i would say every different task should have own timer... |
| 02-10-2009, 02:46 AM | #6 |
Each as a system, each should have its own timer, being independent of the other (2 timers). You can, however, make them use another system/utility that does the timer operations (1 timer). |
| 02-10-2009, 06:20 AM | #7 |
Can a (big?) number of active timers cause lag? or only heavy linked calculations involve performance reduction? |
