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

Get help using Construct 2

Post » Fri Dec 18, 2015 2:34 am

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.
B
25
S
11
G
3
Posts: 191
Reputation: 3,902

Post » Fri Dec 18, 2015 2:38 am

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.
Moderator
B
111
S
41
G
20
Posts: 1,586
Reputation: 19,046

Post » Fri Dec 18, 2015 2:41 am

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?
B
25
S
11
G
3
Posts: 191
Reputation: 3,902

Post » Fri Dec 18, 2015 4:14 am

Dt would be detrimental in this. If dt was zero aka frame/ fps rate 0, then it wouldn't move at all.
Image ImageImage
B
164
S
49
G
138
Posts: 7,946
Reputation: 91,858

Post » Fri Dec 18, 2015 4:15 am

Thanks @newt <3
B
25
S
11
G
3
Posts: 191
Reputation: 3,902

Post » Fri Dec 18, 2015 4:53 am

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.
B
64
S
10
G
8
Posts: 1,957
Reputation: 9,236

Post » Fri Dec 18, 2015 9:44 am

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.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786


Return to How do I....?

Who is online

Users browsing this forum: BobOfAMillion, ladjuric, mekonbekon, Romalex360 and 2 guests