Archived

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

Ecco2000

Multithread good or bad?

Recommended Posts

I''m wanting to start a small game, but I want to use it to explore game developement issues such as the name of this post, before I get started I''d like to hear everyone else''s view of multithread systems. In case I''m in error in assuming you as the reading knows what i''m talking about, I mean when you create a separate thread for your game and let it run in that and thus eliminating the message pump from you game code. P.S. If I remember correctly Quake dosen''t do this. Any comments?

Share this post


Link to post
Share on other sites
If you are going to do multithreading you will have to start thinking about things like synchronization (preventing two or more threads from trying to access data at the same time) and deadlocks.

If you haven''t had any experience with this, it may be a good idea to stick to a single threaded system if it will suit your needs.

I haven''t done any multithreading in a game programming situation, but I have with other projects. Never had any major problems myself, but I''ve never had more than two or three threads to deal with at one time. But bugs can be harder to diagnose because the system is more complex with multiple threads.

In some cases, multithreaded systems can be conceptually easier to work with than a single threaded system. For example, you might have a game loop that checks for input, calculates physics, moves objects and paints the screen. Where you might be able to put some of these things into different threads. For example, checking input could be done on an input thread that waited for an event rather than constantly polling the input. It might then post a message to another thread that moves the character and updates the view, this would free up the input to wait for another event. I think I read an article somewhere on MSDN that talked about this very thing.

Share this post


Link to post
Share on other sites