Smoother sprite movement...
Posted: Sun Jan 25, 2009 6:14 pm
Hey everyone,
This is a general game coding question and not specific to libnds, but since it's the library I'm working with I figured I'd post here. I'm working on the acceleration of a running sprite character, i.e. starting slowly and increasing in velocity.
I'm working with 2 different methods and have basically the same issue with both. The issue is trying to achieve a smoother sprite movement when working with certain speeds. With both counters and fixed points, you can get movement that does moves 1 pixel every other vbl, every 3rd (with counters...) or every 4th smoothly. You can easily get 2 pixels per vbl, 3, or 4 etc...
My issue is with something in-between. The jump in speed to me, at least for my games needs, from 1:1 to 2:1 (pixels:vbl) is too much. What I want is 1.5:1 or 3:2.
With fixed points ( using bit shift by 8 ) having a velocity of 384 (1.5) would be the correct amount, but the issue is that movement ends up being 1 pixel, 2 pixels, 1 pixel, 2 pixels and so on. Pretty choppy if you ask me...
With counters, I can move 2 pixels after waiting 3 vbls... which I thought would be much better, but still definitely noticeably choppier than moving 1:1 or 1:2 or 2:1, etc...
So is this just the nature of the beast, or am I missing something obvious? What I was trying to achieve, was a transition from 1:2, 2:3, then 1:1. The choppiness at 2:3 is pretty noticeable...
This is a general game coding question and not specific to libnds, but since it's the library I'm working with I figured I'd post here. I'm working on the acceleration of a running sprite character, i.e. starting slowly and increasing in velocity.
I'm working with 2 different methods and have basically the same issue with both. The issue is trying to achieve a smoother sprite movement when working with certain speeds. With both counters and fixed points, you can get movement that does moves 1 pixel every other vbl, every 3rd (with counters...) or every 4th smoothly. You can easily get 2 pixels per vbl, 3, or 4 etc...
My issue is with something in-between. The jump in speed to me, at least for my games needs, from 1:1 to 2:1 (pixels:vbl) is too much. What I want is 1.5:1 or 3:2.
With fixed points ( using bit shift by 8 ) having a velocity of 384 (1.5) would be the correct amount, but the issue is that movement ends up being 1 pixel, 2 pixels, 1 pixel, 2 pixels and so on. Pretty choppy if you ask me...
With counters, I can move 2 pixels after waiting 3 vbls... which I thought would be much better, but still definitely noticeably choppier than moving 1:1 or 1:2 or 2:1, etc...
So is this just the nature of the beast, or am I missing something obvious? What I was trying to achieve, was a transition from 1:2, 2:3, then 1:1. The choppiness at 2:3 is pretty noticeable...