Skip to main content
gamedev.net
🔒 Locked

Multithread

Started by ArnoAtWork 4 replies 900+ views
Original Post
ArnoAtWork
ArnoAtWork
Can we use a thread by technic in a game engine or is it better to limit the number of thread? If I decide to use a thread for graphics, one for physics and one for IA, is it a good idea?
acraig
acraig
Generally, using more then one thread is not a good idea unless you really need to have things ''happen'' at the same time. A few examples of this I can think of are networking and maybe pre-loading a map/other data in the background.

Unless you are working with a multiproccessor machine then multithreading often more of a burden then anything.


--------
Andrew

Omaha
Omaha
Tell that to OpenAL, which spawns an additional six threads of its own.
afterburn
afterburn
The impact is not that great on a single processor.

But the advantages for them are not that great either. A single threaded app will complete it in almost the same amount of time but leaves the GUI unresponsive. Loading the data on a thread leaves you serveral issues enter thread communication.... C++ wrapping of them hurts more. Because of the static issues.......

You should be able to narrow the amount of cpu time that you will have. it should not take more than 0.01 to return the reation of a collision or AI bot to make a choice of action.
--What are you nutz?I have nothing to say to your unevolved little brain. The more I say gives you more weapons to ask stupid questions.
pawn69
pawn69
Multiple threads aren''t necessarily bad, keep in mind that you can get benefits on a single processor box that has Hyperthreading enabled.
tuita
tuita
Threads are really best for situations where the program blocks, waiting for some external input. Using threads allows other threads to execute while the blocked thread waits for the required input.
As for games, I wouldn''t suggest using them unless you really know what you''re doing. Games don''t generally block often, so I''m not sure where you would try to gain a significant speed performance from (remember that the processor will also have the burdon of switching between the threads)
But, some low-priority threads can be useful nonetheless in games(Eg. I''ve known a few (a very few) people to write their own garbage collector thread).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.