If Event Tick is being called every frame, does that mean that if i have better pc and have some high fps, my event tick will be called more often than someones who have low fps rate?
Every time event tick is firing i get healed for 20 hp. and it passed 5 frame in 1 second… that means 100hp healed.
Now, someone has bad pc and he got 2 frames in 1 second, and he got healed for 40 hp.
In online gameing this is bad.
So, if i have online game, does that mean i should have universal LAN or INTERNET frame-rate, or some kind of universal event tick for every player so there are no such “bugs” lets call them like that, that someone gets healed more becose he got better pc and his fps?
Is my assumption right, and if it is how would that be fixed in ue? What should i use instead of event tick?
If not, please explain me where i make mistakes…
That’s right, that’s how Ticks work.
For such things as healing etc. you can use timers, for example. They are based on time, not frame rate.
Yes, tick is executed on every frame, more frames = more ticks, so every change you do there will be dependent on number of frames rendered in specific time spans (some games does that, most prime UE4 example is Street Fighter V and many other fighting games which depends on frame precise input and they slow down on slower FPS and tries to keep consistent 60FPS). And this is why Delta Time (also know as Delta Secounds) argument in tick event exists, which is estimated time that passed between frames, allowing you to scale changes in tick to time that passed, like this:
X = X + (Y*DeltaTime)
This will change Y variable as “change per sec” value as DeltaTime having time span between ticks in secouds multiplying any value to it will scale it to time passed. so if Y will be 20, X will increase 20 every second.
Maximum delta time in UE4 is 400ms (if im not mistaken), after that game state will freeze as next tick will always get 400ms delta time. UE4 also use delta time for any time flow control altering systems, like time dilation, UE4 will fake actors that there less time has passed between ticks by decreasing delta time while in reality it is executed in normal pace and as result there ticking code that use delta time will slow down the actor. Engine also pauses actors by simply not ticking them and actors freeze.
As Tuerer mentioned there also timers, those are also dependent on time alteration but there logic is separate from tick management code.