Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSillyCow

Posted 28 October 2012 - 05:47 PM

I have an engine design question:

I would like to run my logic on a different thread then the rendering.
The problem: The logic thread moves the units around, generally changing their state, while the render thread tries to render them.

The most naive approach is to use a bunch of locks on the different entities. But as far as I know locks are performance eaters. Although I know that since hyper-threading that overhead has gone down significantly.

Another option is to copy the state on every render frame before I render it. But that also looks very expensive performance-wise.

I could also lock the renderer while the logic is running, but then what's the point of being multi-threaded?

So I'd like to know:

What is the correct approach to concurrent rendering while running game-logic?

#2SillyCow

Posted 28 October 2012 - 05:43 PM

I have an engine design question:

I would like to run my logic on a different thread then the rendering.
The problem: The logic thread changes alot of the game-state, while the renderer reads that state at the same time.

The most naive approach is to use a bunch of locks on the different entities. But as far as I know locks are performance eaters. Although I know that since hyper-threading that overhead has gone down significantly.

Another option is to copy the state on every render frame before I render it. But that also looks very expensive performance-wise.

I could go on guessing, but what I'd like to know,

What is the correct approach to concurrent rendering while running game-logic?

#1SillyCow

Posted 28 October 2012 - 05:43 PM

I have an engine design question:

I would like to run my logic on a different thread then the rendering.
The problem: The logic thread changes alot of the game-state, while the renderer reads that state at the same time.

The most naive approach is just to use a bunch of locks on the different entities. But as far as I know locks are performance eaters. Although I know that since hyper-threading that overhead has gone down significantly.

Another option is to copy the state on every render frame before I render it. But that also looks very expensive performance-wise.

I could go on guessing, but what I'd like to know,

What is the correct approach to concurrent rendering while running game-logic?

PARTNERS