um returning after a few years just messing around

Blitz3D Forums/Blitz3D Beginners Area/um returning after a few years just messing around

n8r2k(Posted 2007) [#1]
http://blitzbasic.com/codearcs/codearcs.php?code=193#comments


n8r2k(Posted 2007) [#2]
um so yeah, im having no luck with tweening, it screws up animation speed and any object movement thats non-linear movement, such as jumping, anyone?


jhocking(Posted 2007) [#3]
Don't use tweening, use delta time to make your code framerate independent.

ADDITION: imho


n8r2k(Posted 2007) [#4]
hmm so is the link i posted earlier tweening or use of delta time?


Ked(Posted 2007) [#5]
Hey what happened to you, by the way?


n8r2k(Posted 2007) [#6]
hey thinks for asking well first i couldnt find the install for blitz after my mainframe fried, then i was too busy with school and stuff, not even sure how long its been


jhocking(Posted 2007) [#7]
oh yeah that's a delta time approach, not tweening. I don't know what all the framecounter junk is about though, I think that's just to display the framerate and not actually part of the delta time. Also, the delta time calculation there will be jittery because it changes so much every frame; it's generally a good idea to smooth out delta time by averaging it over several frames.

Basically, delta time is about figuring out how much time passes between frames and then multiplying all your changes by that time. If the framerate is low then delta time is larger, so when multiplying by that the amount of change between frames will be greater. Conversely, if the framerate is high then delta time will be low and there will be less change between frames. The result is the same amount of change over a given length of time no matter what the framerate is.

I think I have some demo code of something simple I slapped together a long time ago that includes delta timing, lemme see here...

ADDITION: man I can't believe this thing is still on my server, I just found it in a post from 2003 by searching the forum:
http://www.moondoggieent.com/downloads/ninja_test.zip
Hit Z to jump and X to attack. I don't know why the animation frames are all messed up, it certainly looked great 4 years ago when I wrote this.

Notice how the main loop is calculating something called "frametime" and every movement is multiplied by that variable?


n8r2k(Posted 2007) [#8]
okay thanks, ill have a look at that, and then ill mess around with it in my game, if it dont work, ill clean up my code so its readable and post it