Is it really bad to move on a grid without dt?

  • I'm probably missing something, but are there any drawbacks to moving your player by, say, 32px increments without taking dt into account?

    Something like:

    OnPress Right-

    ----> set X = self.X +32

    It's precise and it should never give you weird decimals. Are there any situations where this will break the game? Any extreme cases, where this action will not work properly?

    And if so, what is an easy fix to take dt into account? A lerp(selfX, (self.x+32), 60*dt) isn't instantaneous enough. Or is it? Is there a definitive answer?

    Thank you in advance, it's been bugging me this whole Ludum Dare.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want your game objects to move at the same speed regardless of framerate, then you should use dt. If you just want your object to move 32 pixels every time you press some key, there's no need for dt.

  • Thank you linkman2004! That is indeed all I need: teleporting 32 pixels away with each keypress. So there's no hidden danger in doing it like that?

  • Dt would be detrimental in this. If dt was zero aka frame/ fps rate 0, then it wouldn't move at all.

  • Thanks newt <3

  • the only issue might arise if you're mixing dt stuff with non-dt stuff (behaviours are usually made to work with time delta). If you don't use any dt stuff in your game, the only change is your game will "slowdown" instead of become choppy at low framerates. Slow down is usually preferable IMO, but depending on what kind of game you're making having dt might be important. It's kind of unnecessary and can be game breaking in a lot of cases though.

  • Yeah there is no problem, although I personally prefer the movements between grid positions to be smoothed instead of being instant, but that's just visuals.

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