Delta Time vs. Every Tick

0 favourites
  • 3 posts
From the Asset Store
Sheeky's Power-ups Sounds
$4.20 USD
30% off
75 power-up sound effects; bonus and notification sounds, fanfares, harp glissandi, stabs, clock ticks, etc.
  • Hi folks!

    I am currently creating a platform game on Construct 3. I recently read about the difference between Delta Time coding and regular every tick codes. I am trying to convert all my "every tick" code into Delta Time, slow computer-friendly code. I am having some trouble with this though.

    The first question I have is related to the player character in the game. This is how my main character is currently set up:

    I have a visible character sprite (objBoi) and an invisible rectangular hitbox sprite with the platform behavior (objHitbox).

    The code says that every tick, you set the position of objBoi to objHitbox. Given that basic Construct behaviors by default are coded with Delta T in mind, and the hitbox is platform enabled, is it necessary to change this code to make it low FPS-friendly?

    The second question has to do with angles and Delta T.

    The character in the game is holding a flashlight. The angle of the flashlight follows the mouse cursor. It is currently set up where the base of the cone of light on every tick moves to the base of the flashlight, and its angle on every tick rotates towards the X and Y position on the mouse. This code does not use Delta T for the angle of the flashlight, so I'm afraid that on a slower computer the flashlight would rotate slower. What would be a better way to code the angle of light incorporating Delta T?

    Thank you!

  • Just keep in mind that all behaviors already use dt. If you're using the platform behavior, you don't need to change anything.

    As to your 2nd question... When you have the angle to always face the mouse position, it will still face that direction regardless if your using every tick or dt. There won't be any slowdown...it will just "jump" to that position on next tick.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The second question has to do with angles and Delta T.

    The character in the game is holding a flashlight. The angle of the flashlight follows the mouse cursor. It is currently set up where the base of the cone of light on every tick moves to the base of the flashlight, and its angle on every tick rotates towards the X and Y position on the mouse. This code does not use Delta T for the angle of the flashlight, so I'm afraid that on a slower computer the flashlight would rotate slower. What would be a better way to code the angle of light incorporating Delta T?

    How many degrees are you rotating towards the mouse every tick? If it was 1 degree, then you should use 60*dt degrees. Multiply or divide accordingly if it was not 1 degree.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)