Archived

This topic is now archived and is closed to further replies.

Tzach

Usage of Threads in 3D Game Engine Design

Recommended Posts

I know this topic has been partialy discussed in previous posts, but i believe there is more to be said about this topic. In my opinion Threads can prove to be of great help as far as the design of the engine goes, allowing the programmer to seperate the different parts of the engine into different independent execution threads. On the other hand, i also understood that while the seperation into threads may give a meaningful boost on multi-processor systems, it could also lower speeds quite considerably on single-processor systems (which are the main target anyways, as most people are not switching to multi processor systems any soon). The questions is if anyone is willing to share thoughts/knowledge/experience concerning the of software around threads, and possibly some tips for proper usage. thanks in advance, Tzach

Share this post


Link to post
Share on other sites
Task switching is cheap nowadays, provided you have a decent OS.
(even most windows do task switching almost ok)

Yes it''s usefull, especially for threads that don''t need to be ''updated'' that often, or can be run concurrently.


-* So many things to do, so little time to spend. *-

Share this post


Link to post
Share on other sites
I think you should use threads where they make sense, and don''t use them where they don''t. That''s really hard to do, though. =)

With game programming in particular, I can''t imagine many scenarios in which your engine would be broken up into separate threads. Maybe separate AI, but otherwise, I''d think the entire engine would be atomic.

Also, you don''t want your game engine making computations for frames that will never be shown, so there needs to be tight coupling between display and gameplay in general. But the whole concept of "game engine" is so different from application to application that it''s really unfair to make any generalizations about this.

IMHO, the place where threads have the best utility is in separating the I/O (network, user input, etc) aspects from the engine aspects. Especially for network, this seems a good choice.

However, multi-threaded programming is extremely difficult to do correctly, and very hard to debug. Do it only if it makes sense, and be prepared for new kinds of headaches.

Share this post


Link to post
Share on other sites