Multi-threading

Started by
3 comments, last by Forcas 22 years, 5 months ago
Would it be beneficial to seperate my graphics code and my input code in to two seperate threads, or is multi-tasking mostly used for AI, etc?
-Forcaswriteln("Does this actually work?");
Advertisement
My advice is, if you don''t know exactly why or why not to use multi-threading, then you probably shouldn''t use it at all in a game. It''s certainly possible to make your game run faster, but it''s far, far easier to make it run slower with multiple threads.

codeka.com - Just click it.
Where can I learn exactly why I should use multiple threads?
-Forcaswriteln("Does this actually work?");
I''m not sure of their applications in game code but threads are commonly used in real-time systems. The idea being that some threads have greater importance than others (usually) allowing you to create complex code whilst still ensuring that your time crucial code can always be executed in time.

I guess in game design you may place the sound and rendering code in critical threads whilst the AI would sit in a low priority one. If the enemy suddenly goes dumb for 200 ms you won''t notice but if the screen fails to update you will.

I can''t see the benefit of separating your input code and certainly not until your game starts to put a strain on the systems your aiming to run it on. AI seems to be one areas that would benefit. Of course if your aiming at a multiple processor system then you could design multi-threaded code that can execute far faster by executing code concurrently, but thats a whole different problem...

zipless
/* Ignorance is bliss, then you go and spoil it by learning stuff */
At a certain level, every process that should operate in parallel deserves to be in a separate thread. Hardware limitations, however, force us to combine some of them. It''s usually a good idea to put graphics in one thread, input and logic in another and sound in a third. That''s a minimum generic reasonable threading model; the model used by each application, however, is dependent on the application itself.

And speaking of threads... Dean, I''ll email you. We should decide where to go with ARMS.


I wanna work for Microsoft!

This topic is closed to new replies.

Advertisement