Tick and System Resources

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Euphoric Beaver

impeccably groomed
Apr 19, 2001
3,158
0
0
Great Britain
www.euphoric-beaver.me.uk
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.
 

Mychaeel

New Member
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

impeccably groomed
Apr 19, 2001
3,158
0
0
Great Britain
www.euphoric-beaver.me.uk
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?
 

Mychaeel

New Member
ShockrifleWave expands its mesh during its lifetime.
Code:
var() DrawScaleMin;

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

defaultproperties {
  DrawScale=8.0
  DrawScaleMin=1.0
  }

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

Papapishu

我是康
Jun 18, 2001
2,043
0
0
42
void
www.vovoid.com
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...