Author Topic: Delta Timing Test.  (Read 10796 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Delta Timing Test.
« Reply #20 on: August 28, 2006 »
Yip, easy as that.

I did an example program instead, you can find it here;

http://dbfinteractive.com/index.php?topic=587.0
Shockwave ^ Codigos
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: Delta Timing Test.
« Reply #21 on: August 29, 2006 »
kool!!!
Challenge Trophies Won:

Offline Ghost^BHT

  • Clueless and Happy
  • ^GVY
  • Pentium
  • ******
  • Posts: 931
  • Karma: 49
  • BYTE ME!
    • View Profile
Re: Delta Timing Test.
« Reply #22 on: August 30, 2006 »
I'm going to sound a bit dim here. I thought delta timeing was to have the prog run at the same speed on all capable machines?
So if you are having a variance (on the faster machines) of fps doesn't that mean that the timing routine is not working on those faster machines? Or does it mean that the display(movement etc.) will be the same no matter what the fps?  Hit me with the stick of knowledge please  :whack:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Delta Timing Test.
« Reply #23 on: August 30, 2006 »
Say your game ran at 60fps and you moved everything 1 pixel across every frame, then it's speed would be 60 pixels per second.
If your code only runs at 30fps, then it'll only move 30 pixels in a second, half the speed.
And if your code is jumping about all over the place, like it tends to do on Windows, then the speed is erratic.

What you need to do is compensate.   If you were running at 30fps, you could simply double the number of pixels moved per frame, so 30x2 = 60x1.   But more generally, assume the framerate you are running at is based on how long it took to draw the previous frame.  If the last frame took 1/60th then add 1 pixel, if it took 1/30th then add 2 pixels.  1/15 is 4 pixels etc.   So you automatically compensate.

Taking it to it's conclusion, if the last frame took 1/n seconds to draw, then the amount to move would be
(1/n)/(1/60) = 60/n pixels per frame

It means on slow machines, even though you compute the physics less often, it moves just as far across the screen.  You can do it with positions, rotations, colour changes, anything really.

Jim
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Delta Timing Test.
« Reply #24 on: August 30, 2006 »
Jim has explained it much better than I could. It's more or less the same as what I am doing, only I am taking an average of more frames, I don't know why but the movement just didn't look quite right to me when I was taking the time in millisecs to draw the last frame, I need to experiment with it more.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Ghost^BHT

  • Clueless and Happy
  • ^GVY
  • Pentium
  • ******
  • Posts: 931
  • Karma: 49
  • BYTE ME!
    • View Profile
Re: Delta Timing Test.
« Reply #25 on: August 30, 2006 »
Thanks Jim and Shockwave for the explanation.  :cheers:

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: Delta Timing Test.
« Reply #26 on: September 19, 2006 »
Silky smooth Shockwave.  Looks retro and very cool too BTW.

145 FPS here
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Delta Timing Test.
« Reply #27 on: September 19, 2006 »
Thanks Voltage :) I actually completed an intro using this technique but unfortunately I couldn't release it here because I would have technically been breaking the rules of the forum, but it's on the Intro Inferno site released under the group name Rituel.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Delta Timing Test.
« Reply #28 on: September 20, 2006 »
@Shockwave - What do you mean about technically breaking the forum rules?
Obviously after my first demo its plain to see that i need some delta timing in my code to at least slow the scroller down! lol!

Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Delta Timing Test.
« Reply #29 on: September 20, 2006 »
Rituel are a piracy group and since this forum is 100% legal only I could not really justify releasing the Rituel intros here :) Still, they are on Intro Inferno if you feel like looking :-X
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Delta Timing Test.
« Reply #30 on: September 20, 2006 »
Btw. I want to say for the record that I do not possess *any* pirated stuff. I even paid to register my copy of Winzip. I think that if you use a product then you should always support the people who made it, having said that, I do love the art form of coding cracktros, it's where the demo scene came from and if it wasn't for them, this place  would not exist.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Delta Timing Test.
« Reply #31 on: September 20, 2006 »
Thanks for clearing that up Shockwave. I see where you are coming from now!

Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk