Archived

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

NuffSaid

SMP in games

Recommended Posts

Hey, just a simple question. How do you make your game SMP aware? I''m under the impression that all you need to do is make your program multithreaded and if it is run on a SMP system with a multiprocessor OS, your game will take advantage of the Extra processor. Is this correct? My code is now divided into a few different threads(graphics, sound, input etc). I was wondering that if I run it on an SMP system, will the performance increase? Or do I need special video drivers, soundcard drivers etc before I see any benefits? Just curious. Any help from the guys like MadKeith, will really be helpful. ======================================================== If something sounds stupid but works, it's not stupid

Share this post


Link to post
Share on other sites
Oooh my name mentioned in a post!
( thanks for tickling my ego ).

Basically, as far as I know, your assumptions are correct. Using "standard" computer languages, there are no constructs to allow for parallel processing. There are some parallel languages ( Parallel C, Occam ), or libraries to allow parallel processing on a language ( CJT for Java ).

If you are NOT using one of these languages, the way to separate parallel processes is by explicit multithreading. This will allow the compiler/operating system to separate different calculations onto different processors, without risking conflicts when accessing memory and such, if you''ve written your code right.

Note that, on the current crop of SMP systems, aiming for more than 2 concurrent threads is probably overkill. The multithreading will add a bit of overhead on non-SMP systems, and on SMP systems with less processors than there are threads, so it might not be that advantageous to go overboard on threading.
There are other advantages to certain forms of parallel programming, but you''d have to read a book on it to really grasp the concepts. It''s very interesting, but quite involved.


Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites
heh, I''ll just tickle your ego further

So this means that I don''t need special drivers for my Graphic card, sound card so I can take advantage of multi processing right?

btw, I don''t think that there are any memory conflicts in my game. If there were, it would crash right?

Anyway, does anybody know how SMP was implemented in Quake III? Just like to know(as usual)

========================================================
If something sounds stupid but works, it's not stupid

Share this post


Link to post
Share on other sites
I don''t think there are any SMP drivers out there, though I am not sure. (I have a pathetic little PC without even the nicety of an AGP slot )

You COULD write drivers specific for SMP systems, but I think it''s better to write the client side for SMP, and have the driver optimised for a single processor system. Specially with the GeForce, since in a way it is ANOTHER processor, so passing data to it amounts to a certain amount of SMP already.

About memory conflicts - it''s a complex topic when more than one process can be changing memory at the same time. If those processes are sharing data, you have to do serious multithreaded memory management. If they are NOT, however, you will not need to do anything special aside from having a thread for each process.

And no, I have no idea how J.C. did it in QuakeIII ;-)


Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites
I had to learn occam at Uni, for Parallel Processing. Brilliant language though, if you ask me... it was just so, well, so well-designed!


Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites