3d engine and threads?

3d engine and threads?

Post by Michael Andersso » Sat, 21 Apr 2001 21:49:06



Hi!
I all the OpenGL applications I've developed I've locked the update to a
certian framerate. As you probably know this is something that has to be
done or else the speed of the graphics/game would run faster on a faster
computer and so on. I have an idea on how to solve this in a different
way and that is to let game - logic (for example updating player
position and so on) and rendering run in different threads an thus be
able to update the graphics faster than game - logic.  Has any of you
tired this or how do you do it? Do games work this way or do they adapt
to the framerate?( a machine that can run a game att 30 fps will have a
slower running player then a machine that can run the game att 75 fps
hence the faster machine most calculate the runningspeed relativ to the
framerate to slow it down)

Thanks!
/Michael Andersson

 
 
 

3d engine and threads?

Post by Ruud van Ga » Sun, 22 Apr 2001 00:10:31


On Fri, 20 Apr 2001 14:49:06 +0200, Michael Andersson


>Hi!
>I all the OpenGL applications I've developed I've locked the update to a
>certian framerate. As you probably know this is something that has to be
>done or else the speed of the graphics/game would run faster on a faster
>computer and so on. I have an idea on how to solve this in a different
>way and that is to let game - logic (for example updating player
>position and so on) and rendering run in different threads an thus be
>able to update the graphics faster than game - logic.  Has any of you
>tired this or how do you do it? Do games work this way or do they adapt
>to the framerate?( a machine that can run a game att 30 fps will have a
>slower running player then a machine that can run the game att 75 fps
>hence the faster machine most calculate the runningspeed relativ to the
>framerate to slow it down)

If you've programmed physics, you know that you must decouple
framerate from simulation. In other words, you render at a given
frequency internally, for example 100Hz (or better), and when your
simulation time catches up with actual time, you render a frame and
continue (imagine a racing sim). This way, your gamelogic will always
be fair to all users, while the framerate can go as high as the
internal frequency.

Some things I *do* hook to the framerate is controller updates. These
could be tied to the internal frequency as well (but slower, since the
user updates are bound not to reach 1000Hz when you think of it). And
force feedback got me worried for a while, but I've got a racing sim
running at 80Hz (fps) and it's not bothering FF yet.

Ruud van Gaal, GPL Rank +53.25
Pencil art    : http://www.marketgraph.nl/gallery/
Free car sim  : http://www.marketgraph.nl/gallery/racer/

 
 
 

3d engine and threads?

Post by Anderso » Sun, 22 Apr 2001 11:56:54


Maybe you could think of each computer as a differn't model racing car. The
better ones always win (: (no meaning intended)
 
 
 

3d engine and threads?

Post by Nils Schneide » Mon, 23 Apr 2001 00:08:51


Hi Michael!

I did it this way:

Imagine that you have a certain GAME framerate, not render framerate, and
you set it to e.g. 100 fps. In your mainloop, you check if the system is
fast enough to keep a game speed of 100 frames up, if not, you skip some
render frames. If the system is too fast, you wait some milliseconds until
you go on with your mainloop. Only one simple function is enough to
implement it. You call this function one time per game frame in your
mainloop and let the function return true if rendering should be done, false
if not.

bye,
        Nils

 
 
 

3d engine and threads?

Post by Frans Boum » Mon, 23 Apr 2001 02:57:14



> Imagine that you have a certain GAME framerate, not render framerate, and
> you set it to e.g. 100 fps. In your mainloop, you check if the system is
> fast enough to keep a game speed of 100 frames up, if not, you skip some
> render frames. If the system is too fast, you wait some milliseconds until
> you go on with your mainloop. Only one simple function is enough to
> implement it. You call this function one time per game frame in your
> mainloop and let the function return true if rendering should be done, false
> if not.

    this sounds similar to the method that was Tip Of the day a
    couple of weeks back on flipcode.com about this same topic.
    the original poster should check that out, because the discussion
    that followed that tip of the day contained a lot of different
    methods and pro/cons of all the methods  :)

        FB

 
 
 

3d engine and threads?

Post by Ruud van Ga » Tue, 24 Apr 2001 18:35:28





>> Imagine that you have a certain GAME framerate, not render framerate, and
>> you set it to e.g. 100 fps. In your mainloop, you check if the system is
>> fast enough to keep a game speed of 100 frames up, if not, you skip some
>> render frames. If the system is too fast, you wait some milliseconds until
>> you go on with your mainloop. Only one simple function is enough to
>> implement it. You call this function one time per game frame in your
>> mainloop and let the function return true if rendering should be done, false
>> if not.

>    this sounds similar to the method that was Tip Of the day a
>    couple of weeks back on flipcode.com about this same topic.
>    the original poster should check that out, because the discussion
>    that followed that tip of the day contained a lot of different
>    methods and pro/cons of all the methods  :)

Perhaps the article from Robert Dunlop, 'Writing the game loop' also
helps. You can find it somewhere on MS' site.

Ruud van Gaal, GPL Rank +53.25
Pencil art    : http://www.marketgraph.nl/gallery/
Free car sim  : http://www.marketgraph.nl/gallery/racer/

 
 
 

1. From outdoor 3D engine to indoor 3D engine...

Hi,

I have written an outdoor 3D vector engine from scratch about a year ago,
and want to include indoor scenes. After some research I came to the
conclusion that it would be easier to start over again using OpenGL. Could
somebody explain the main differences between these two engines?

If I want to create a single room (cube), should I just  turn my vector cube
inside out, and place the viewpoint in the middle? (I tried that, it didn't
work ;o))

I am also looking for some OpenGL examples that can be compiled using Visual
C++ 5.0

thanx in advance,

Ilan Shemes
---

URL:    http://www.shemez.ml.org/

2. Goo...

3. Search Engine for 3D Engines!!!

4. Looking for Skeleton Model

5. 3D clipping problem in a wired 3D engine

6. Animation Codec

7. my 3d engine and how to write 3d games

8. regarding the thread -Free 3D C0de!

9. Multi-threading 3D

10. Relaity Engine vs Infinite Reality Engine

11. 3D to 2D software engine needed, please help!

12. Looking for 3D engine + modeller