Optimization: Event Tick vs Timeline

Hello Everyone,

I’ve heard that excessive use of the Event Tick can be harmful to your FPS and performance. I am currently optimizing and cleaning up my project to make it a lot more manageable. I was wondering if a loopable timeline set to update every few seconds or so would be a replacement. Will having lots of timelines hinder performance? The Timelines would likely fire from an Event Begin Play node connected to a sequencer ( in case I may need to use multiple timelines for various tasks).

If this isn’t the best solution to using Events Ticks, what would be a better way to achieve the same thing?

I am sure I read somewhere timeline is a good replacement for tick, it uses the animation tick instead but it’s not guaranteed to fire every single tick so if you have something that needs to be tick based it may not be right.

I think that timeline is better just because you can fire exec pin a certain interval. For example every 0.5 seconds. So it will be much better that tick, if u have complex logic.

Before going further with optimizations, have you confirmed which Blueprints are in need of optimization? A timeline being fired every Tick may not be as expensive as lots of Nodes firing simultaneously from an Event.

Raise, oh dead thread. Raise from dead to the world of living! :]

I actually think you are wrong!

Don’t forget that you can bind and unbind events to/from Tick.

UTimelineComponent consumes a lot of RAM. imagine having 10 timelines in your actor - it’s around 500bytes wasted RAM per instance!

Instead, you lads can just bind something to tick event, and after it stops executing - unbind it. no RAM will be wasted, as well as Tick preserved clean.
I would like to hear critics about that method if somebody thinks i’m wrong.

4 Likes

I think the real problem with tick is in trying to do too much in the tick interval - especially when you multiply that by several actors. You can link all sorts of things to tick but ultimately if you’re not careful - you’ll get to a point where your execution path doesn’t have time to finish before the next tick starts. There’s a place for tick, obviously, or it wouldn’t be there, but a lot of things can be handled more smoothly using timers and timelines.

Doing to much in tick doesn’t make a difference to doing to much in timelines or timers. Tick will fire every frame, if you do too much your framerate will simply drop. Unless timers and timelines prioritize being on time rather then doing all you ask… ? I guess the latter also just execute everything you put in them.

But indeed, not everything has to be updated every tick. You can set tick interval per actor though, not sure how stable that is. Or use timers.

So the question is, tick, timer or timelines?

I currently do have a timeline for each property i want to animate in an actor. Those actors are spawned from a factory actor, so if i want same change for all it’s children i use a timeline in the factory instead, then foreach from that.

My timelines are mostly just 0-1 ranges where i set play rate to 1/duration to control it’s length, then lerp with that alpha value, setting the initial and target value to a property before i fire the timeline.

I guess i’m almost doing what i would need to do with timers and tick eh.

Ha, seems you can actually set the tick interval of timelines too…

… and you can suspend tick when you don’t need it.

You can also use timers by function name. Just set their interval to whatever frame rate (1/desired frame rate) you want the functions to be updated at. Not everything needs to be on tick. There are plenty of things that do just well at 10-20 ticks per second. They are also a breeze to turn on and off when you don’t need them.

Yeah, the event based timers quickly mess up your graph since they are all public.

Not if they are implemented correctly… I use the hell out of them and have never had any issues like that.

Question, Cannot find an answer for this any where!

Which of the following would be more efficient on say an **escalator **moving? In this Epic training video to create an excalator he uses tick: Making a Simple Converyor Volume | Live Training | Unreal Engine - YouTube
I have watched a few training Videos from Epic that say to never use tick because it is so inefficient. In the comments of one of the videos I asked what you are supposed to use for a line trace if you cannot use tick, but no one responded. I ended up changing my line trace to use Event Timer set to loop at second = .01, would it be better to use an Tick instead of the Event Timer? I changed the Event Timer to .1 but it was too sluggish and had to change it back to .01.

  1. Tick
  2. Event Timer set to loop at second = 1
  3. Event Timer set to loop at second = .1
  4. Event Timer set to loop at second = .01

So not have good answer what good way use, so sad Dudes(

I don’t what is good or bad but If I want to be able to manipulate time in game with Set Global Time dillation it only works with time lines.And its ■■■■ fun. Till it breaks

This isn’t really a question of either or. There’s positives and negatives to each. That’s why they all exist. It’s sort of like asking if you should use a hammer or a screw driver. It depends on what you’re trying to accomplish.

Feel free to correct me if I’m wrong, but this is how I understand the difference between Tick, Timeline and Timer:

Event Tick means your event is being called every frame. As such, the time for a tick is not constant/consistent. If you’re getting 200FPS it means that you’re calling your event 200 times per second. If you’re getting 30 fps, the event is only being called 30 times in that second. This means that your tick rate will constantly be fluctuating and not giving you a precise value. Delta time is used to calculate the time in seconds (really miliseconds) between the last frame rendering and this one) to smooth out the end result of your tick interval so it’s not so chaotic.
To see what this value is, Use the Get World Delta Seconds node and plug it into a print string with a duration of 0 and call that Print String from EventTick and then walk around your level. You’ll see that the World Delta time will give you small fluctuations in value (0.011 to 0.012 for example)

Tick is generally used if you need to make sure the information is updated every frame regardless of the frame rate. It’s not a timer in and of itself, so you need to make sure you’re not thinking of it as one.

A Timer means that you’re aiming for consistent timing. So if you set the timer to loop at 1 second intervals, it means that your event is always going to fire once per second regardless of your frame rate. If you set a timer to loop at 0.1 it means it will fire 10 times in a second and .01 will fire 100 times per second. Therefore a timer can be more expensive than Tick if you set your interval lower than your average frame rate. For example if your FPS is 30 but you set your timer to 0.01 interval, then it will be much more “expensive” than Tick because it’s calling your code more frequently.

This means that a timer is not necessarily less expensive than Tick, because there’s an overhead to a timer as well. For example, it might cost more for the timer to ensure that it’s firing consistently every second when your FPS is choppy. Dips in FPS can result in the timer having to calculate adjustments to ensure that it’s actually firing at the consistent interval that you specify.

A Timeline as pointed out earlier, consumes a certain amount of ram (as I’m sure Timers do too) and it is essentially ticking for a specified duration. The difference being that the Timeline has easy to use controls to stop doing what it’s doing. If you set a timeline to do something on a loop of 1 second, then I believe it means this is more expensive than Event Tick because it’s driven by Tick itself. IE not only are you ticking every second, but you’re also encuring the cost of the Timeline. However, as with a Timer, a Timeline is consistent so it can be useful when you want to make sure something is happening at a consistent rate that is not connected to your current frame rate.

So the answer is, it depends on what you’re doing and what you’re aiming for. If you want something to be firing every frame, then use Event Tick. If you want something to fire at a consistent interval, use a Timer. If you want Something to tick for a specific duration, has easy Stop and Start and Reverse commands and functionality to create curve driven data, use a Timeline.

1 Like