View Full Version : Tick and System Resources

Euphoric Beaver
7th Nov 2001, 11:05 AM
I once heard that it's best not to use Tick too much as it can drain system resources.
But I was planning on using a Tick function to make a projectile go smaller as it ends its life.
Would this be expensive in resources as there would most proberly be quite a few of these fellers flying around?

Also, is Tick automatically called? I remember seeing an Enable Tick; or something like that.

7th Nov 2001, 11:21 AM
Why not just make the animated texture get progressivley smaller then lock it on the last frame? O_o

Euphoric Beaver
7th Nov 2001, 12:30 PM
Can you change the rate at which the texture animation goes through?

Also I wanted to make the projectile do less damage if it's near it's death, so I'm thinking only a Tick function can achieve this.

7th Nov 2001, 01:08 PM
Tick is called once per frame (on clients---dedicated servers tick according to the NetServerMaxTickRate setting), so you shouldn't perform lengthy tasks in Tick. That's all. Simply recalculating some parameters isn't a problem in Tick.

There are a couple of actor properties that affect whether Tick is called for that actor or not; for instance, actors with bStatic set to true won't use Tick (and Timer, for that matter) at all. Enable('Tick') is only needed if Tick has previously disabled with Disable('Tick').

Texture animation speed can be modified by the texture's MinFrameRate and MaxFrameRate properties, but I don't think that's a practical solution for your problem.

Euphoric Beaver
8th Nov 2001, 03:06 AM
As it turns out I can't use Tick because I thought the LifeSpan variable in the default properties was the countdown. :p

However after talking to Pap, he suggested using a Timer and set it at a 1.0 delay.

So I tried to do this and realised that Timer is already taken in the code and at a 0.2 delay. :(

1) Is it possible to have more then two timers?
2) If not, how can I make the DrawScale go smaller as it nears its death?

8th Nov 2001, 03:22 AM
No. (But you could use Tick to keep track of elapsed time yourself.)

Have a look at ShockrifleWave, for instance.

Euphoric Beaver
8th Nov 2001, 05:45 AM
I'm not quite sure what I should be looking for in ShockRifleWave.

Okay if you peeps had a projectile that you wanted to go smaller untill it's 5 second life ended. How would you do it?
Code please. :D

8th Nov 2001, 05:56 AM
ShockrifleWave expands its mesh during its lifetime.
var() DrawScaleMin;

simulated function Tick(float TimeDelta) {
DrawScale = (default.DrawScale - DrawScaleMin) * LifeSpan / default.LifeSpan + DrawScaleMin;

defaultproperties {

Untested, but I suppose it works. Substitute the default values for DrawScale and DrawScaleMin with your actual values.

8th Nov 2001, 02:08 PM
You can use separate timers if you put them in separate states.
The whole "class" is a state, and can have one timer, but you can define states, like: state flying
and there you can have a new timer.
I'ts like a whole new codingplace/program...
But you have to start it in there too
In fact, states can hols a copy of ANY funtion at all.
Another method is to use the same function, if the timing is the same.
It's also possible with some hacking to use it if it's different, but that's hard...

Euphoric Beaver
8th Nov 2001, 02:54 PM
Thanks. :D:tup:
The code worked after some small adjustments. :)

And thanks Pap. Very interesting. I'll have to do some experiments. :hmm: