Re: Time accuracy
- From: Peter Koller <maulpub@xxxxxxxxx>
- Date: Wed, 12 Sep 2007 11:10:37 +0200
ML wrote:
PM app, a ball is dropped at moment T at the top of the screen (Y=0).Hi,
At moment T+1, Y will be 1. At moment T+2, Y is about 4: accelaration.
For a smooth display the ball also has to be displayed at Y=2 and Y=3,
so it doesn't jump from Y=1 to Y=4 (and next Y=9, Y=16, ...).
What's the preferred way nowadays to delay each step? I don't really need extreme nor time-critical accuracy, "close enough" will do. I did think about a hires timer, but elsewere I read something like "I hope
WarpVision isn't using the hires timer". I don't know if that remark
made sense, I just read it.
Is the hires timer the way to go anyway, or do I need to DosSleep() in
thread 1 and perform some benchmark counting in thread 2, or is there another way to get delays smaller than DosSleep()'s lores delays?
---
I have a program called European Juggle which simulates a human juggler very well. This is a PM program, and it doesn't use timers.
A threaded application in OS/2 gets a slice every 32ms, and that makes a pretty smooth display. Use DosSleep(1) to give up the timeslice at each step. You have to work it backwards - calculate where the ball will be next assuming 32 ms have elapsed.
Very occasionally, you can get a short 'hiccup' on a slow PC when a thread overruns.
http://www.manglais.com/download/MAEJ100.ZIP
Peter
.
- Follow-Ups:
- Re: Time accuracy
- From: Paul Ratcliffe
- Re: Time accuracy
- Prev by Date: Perl
- Next by Date: Re: Color management?
- Previous by thread: Perl
- Next by thread: Re: Time accuracy
- Index(es):
Relevant Pages
|