Hello. I have a background layer (tile) and a foreground layer (sprite objects) that form my parallax scrolling. It’s working well, but I think I need to use DeltaTime() for values like this that are being updated every frame. Attempts to change my simple expressions to use DeltaTime() stop the layers scrolling at all. The foreground even jitters. Two questions:
Do I need to worry about using DT for these actions?
If I do need to use DT here, what should be in the ‘set to’ fields for the below? Thank you.
Edit: I’m using the smooth camera behaviour on the character (a platformer character). It all works great, but I’m just concerned I’m not doing it ‘right’.
Hi, as you wrote, DeltaTime() is not necessary to get your back- and foreground moving. It is also not used in the example projects with parallax backgrounds:
I think as long as you don’t run into any problems, there is no need to “improve” something that works as intended.
Thank you. Those examples are reassuring. The game runs smoothly on my PC, but I was concerned about lower-end machines and the need for delta time to help mitigate that, but as the official examples don’t use DT I think I can sleep soundly tonight Thanks again.
TimeDelta() change per frame execution into real time execution based on frames
So in other words if you make TimeDelta() timer in your game
Counting 30 sec
It will be really 30 sec
And not 30 sec if your game runs at exact same framerate all the time
So if you make ONE aspect of your game run on TimeDelta
For example cooldown for your spell cast
Imainge 3 sec timer
EVEN if your game lag/drop fps
You will be able to cast spell after 3 sec
Giving you unfair advantage
For example your game is running at 60 fps
You made TimeDelta() timer for counting 3 secs down after you cast your spell before you can cast it again
Your game dropped to 30 fps
You cast spell
What should happen is now instead of 3 secs you need to wait 6 secs before you can recast spell
Cause your game is running at half its original speed
BUT since you are using TImeDelta you will be able to cast that spell after 3 secs of real time
So in real game time you would be able to cast that spell after 1.5 sec
Allowing you to cast this spell again sooner than you should be able to
If your whole game is not built around TimeDelta i would find it stupid to use it
THAT IS IF I UNDERSTAND TIME DELTA CORRECTLY AND I CAN BE MISTAKEN
Imagine game like mario
There is time and you want to speedrun your level
Or make version of level made for speedrunners where time is key component here
If you would use TimeDelta you would punish players with low end devices since they would get higher time value for finishing your level cause your TimeDelta do not care that game lags
And so game runs slower yet time is counted properly regardless of how game run
AGAIN
That all is only true if i did understand time delta correctly
Personally i just add 1 to some variable and use that as my timer
Or use TImerFromStart() as timer