Logic / Render phases with a single thread

Posted by DevilWithin on Game Development See other posts from Game Development or by DevilWithin
Published on 2012-08-01T16:54:26Z Indexed on 2012/08/31 21:50 UTC
Read the original article Hit count: 256

Filed under:
|
|

The question I have may generate different opinions from different developers, but I'd still like to have an answer on this.

Its all about the updating and rendering steps of the game loop, and their use under multi and single threaded environments.

Currently, there is one thread running, which takes care of sequentially executing events , logic and rendering. Sometimes, the logic part may wish to change the game state to something else, and in between do some loading of files.

The result is that the game hangs completely while loading, and then proceeds to normal rendering of the new state. To go around this, i could make another thread, do the loading there while the main thread renders a smooth loading animation, and then proceed normally.

The real question is about if i don't create another thread. I could refresh the screen from the logic thread, and provide some basic loading screen, which could be not so smoothly updated while the files load.

In fact, this approach is not loved by a lot of developers, as it scrambles render code in the logic step, which may cause problems of different sorts..

Hope its clear!

© Game Development or respective owner

Related posts about rendering

Related posts about loading