Author Topic: Timing is everything but how?  (Read 3852 times)

0 Members and 1 Guest are viewing this topic.

Offline Dad1916

  • Atari ST
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
Timing is everything but how?
« on: November 04, 2012 »
Imagine I'm using a basic language to code a demo. It's fine, it's structural but how do I go about the timing? Imagine I want a scene to last 10 seconds and then 20 seconds on the next? Functions for each and delays?  :hi:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Timing is everything but how?
« Reply #1 on: November 05, 2012 »
what the name of programming langauge you using?   :)

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: Timing is everything but how?
« Reply #2 on: November 07, 2012 »
On every OS, you can get the system time. Just have to wait until the good time and so on...

example (in pseudo language):
Code: [Select]
start = get_time_function() 'in millisecond usualy
repeat

'do the effect

until get_time_function() > (start + 20*1000)

If you want to specific code in a language, we can make it also :D
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Timing is everything but how?
« Reply #3 on: November 08, 2012 »
Yeah, you'd need to get the time as a float or double ( gives more precision based timing ), and then multiply by 1000.00f this will give the time in millisecs. It is a misleading term as you'd expect it to have six zeros after it. And in the example above, 20 seconds is 20 * 1000.00.

And you could even use switch / case statements to signify which part of the demo to run.
« Last Edit: November 08, 2012 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Gore Motel

  • C= 64
  • **
  • Posts: 45
  • Karma: 18
    • View Profile
    • Gore Motel
Re: Timing is everything but how?
« Reply #4 on: November 16, 2013 »
I know this topic is old, but my question is also about timing: how about using the audio timing to implement graphics and effects?

Instead of getting the system time, you get the current audio time. Is that usually done / not done? What would be the downsides (if any) or advantages (again, if any)?

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Timing is everything but how?
« Reply #5 on: November 16, 2013 »
Both method can do the work. Theres no downsides or advantages in this case, the best way is to try both and see which one you will be more comfortable to work it.
Challenge Trophies Won: