Racing game timer

Started by
12 comments, last by googa 21 years, 6 months ago
>If it hasn't been x millis, skip it. Render.
>x millis, run it. Render.
>4x millis, run it four times. Render.

This is really fine. This is what I'm doing in my own racing game. There's only a small difference..

In the case you render a frame without running the simulation, it would be really important for the renderer to linearly interpolate the position of the moving object (along its velocity) according to the time passed since the last fixed timestep.

It should look much smoother since vehicles will move every frame. But the calculated position by the renderer is only an approximation it does not really move the body for the simulation. The simulation always move the vehicle with proper physics. If you do not interpolate between frames it will be jerky.

And with the fixed timestep scheme, you almost get instant replay for free if you take some care. : )

[edited by - nosfy on October 24, 2002 8:56:11 AM]
Advertisement
Im using opengl. The game is almost finished and is runs at 86 fps in my computer. what i think i will do is to keep the logic
running at a certain speed. and render the scene multipling the data by a timerfactor (like deyja´s way). This is how i tried to explain, but i think it was not clear.
Thanks for all the answers.
What about an Addictive FREE Turn-Based Puzzle/Strategy Game, with a Growing Community Available to Play right now?<a href="http://www.wonderquest.co.nr"><( ) -Hurrahh!/a> <a href="http://www.wonderquest.co.nr"><( ) -Yes!/a> <a href="http://www.wonderquest.co.nr"><( ) -Ai Caramba!/a>
quote:Original post by stefu
That will work if you move straight.
But think about 2fps when you are turning to right. 50fps your car goes along the road, but 2fps you find yourself bottom the ditch.
You need to split that 0.5s into smaller steps like I showed above



As long as your simulation / game / etc is independant of your rendering the car would be in the same position after the same amount of time. Wizard has it right. You should just render the current state of the simulation. The simulation should not care in the slightest how many frames per second there are, only with how much time has passed since the last iteration in the simulation.
I agree. But my way doing it is very very very simple and for my needs currently it works very best well.

This topic is closed to new replies.

Advertisement