help with game speed depending of fps (using ode)

Blitz3D Forums/Blitz3D Userlibs/help with game speed depending of fps (using ode)

Santiworld(Posted 2009) [#1]
hi..., i have a question, for a race car game

how can i incress the speed when the FPS are low? i using updateworld, for collisions, and ode physics for cars....


in my computer, (good one), i limit the fps to (60) with waitimer...
i based on 60 frames per second to make this game...

but in some old computer, or with a poor video, i have 30 fps max.
can i increes the speed *2? of the all game?..

my idea is when i have 30 frames in one computer, or have 60, or any fps, the game, in all computers go to the same speed time...

how can i do that?

(sorry my english) and thanks...


Doiron(Posted 2009) [#2]
I think you are posting this in the wrong forum...

Anyway, you should take a look at timing and render tweening functions: you can find some of them both in the code archives, or even in B3D's samples directory.

Here there is an example:
http://www.blitzbasic.com/codearcs/codearcs.php?code=9

Also, if the physics are causing an overhead you could try updating the physics only a number of times per second while updating the graphics at a higher rate.


Santiworld(Posted 2009) [#3]
thanks, maibe you have right, about the post...

my problem, is the graphics, when i have more cars, the fps reduce..

but, in some computer, with 30 fps, how can i do the ode go more faster?

if i dont update the physics ode each frame, the cars go to fall of escenary... ?


Charrua(Posted 2009) [#4]
Hi (¿como estás?)

What function are you using to update ODE?

dWorldStep(world,stepsize#) SLOW or dWorldQuickStep(world,stepsize#) FAST!

I don't think that 2 cars slowdown were made by ode if you are using dWorldQuickStep(), probably and normally should be the render world part, so I agree with Doiron, try to use frame tweening, with it, you made as many RenderWorld's as the hardware (cpu+video) allows you, probably an equal number of the refresh frequency of your monitor (that should be greater than your desired game update rate) if the machine is good enough and in old computers (like mine) you get less RenderWorld's than UpdateGames's but, you will keep the number of UpdateGame constant, so the number of update ODE will be the amount you define in "gameFPS" of the code proposed by the example cited above.

The amount of frames rendered should fall (do not match the number of game updates) on slow computers but not the logic.

(FPS in this context means "Frames Per Second" and I associate that to Renders per second as in Video: the amount of FRAMES or images that compose the movie thrown per second, so, at first the term gameFPS leave's me confusing becose, frame tweening didn't gives you a constant number of renders per second, but has the advantage that all your timings should be based in the fact that the amount of game updates is the one that you define in gameFPS)

best regards

Juan


VIP3R(Posted 2009) [#5]
To answer the physics part of the problem, ODE step calls must remain the same on all of the computers (slow and fast), otherwise the physics will behave slightly differently on each one.

Check the time taken to render the scene, and also the time the physics takes up each frame (the JV-ODE demos have physics time built-in).

You will most likely find that the physics time is much smaller than the render time on both slow and fast machines. If that's correct then concentrate only on refining the rendering for slower machines, you shouldn't need to change the physics timing. If the physics time takes longer than the rendering, then something might be wrong with your physics setup code.


Santiworld(Posted 2009) [#6]
thanks...

so, i am going to limit the frames to 60 x sec (max), in all computers.

depending on computer, i must to automaticaly reduce the graphics quality to reach 60 fps... in all computers...

i think it's only a graphics problem, maybe the other solution is not renderworld each frame, i'm going to work on these options..

thanks again...
santiago