Re: Programming a game
Re: Programming a game
- Subject: Re: Programming a game
- From: Ambroise Confetti <email@hidden>
- Date: Sun, 16 Nov 2003 21:14:13 +0100
Le 16 nov. 03, ` 14:06, Denis Vaillant a icrit :
>
My problem is that on slow computers, the view in not updated as fast
>
as the
>
timer is going and so the players are not moving at the right speed.
You can integrate the player's position depending on how much time has
passed since the last update of your view.
(If you know your player's speed, multiply it by the time interval
since the last refresh and you get the player's movement.)
This is how I did for my own OpenGL animation engine. Of course, you
must know the player's speed for this technique to work, but this is
usually the case for games. If your player has an acceleration, you can
do the same to obtain the speed. (Be careful: if you integrate twice,
the squared value has a 1/2 factor.)
Anyway, this is a very interesting discretization problem ;-)
About syncing your redraw with vertical retrace, you have to be careful
with that, since it can also reduce the frame rate. I think I've read
somewhere that QuickTime isn't synced with the vertical retrace, though
its playback is perfectly smooth. This can be useful, but it's not a
universal must-use.
Ambroise
http://www.cellulo.info/
ICQ 4508259
AIM atvaark
[demime 0.98b removed an attachment of type text/directory which had a name of Ambroise Confetti.vcf]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.