Archived

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

Stoffel

Threads in games (Gamasutra article, AI):

Recommended Posts

Stoffel    250
I''ve often been the champion of STL and threads here, probably because I''m a software engineer, not a game programmer (just a hobbyist). Lately, it seems that every mention of multithreading as a possible solution to a game problem is met with doubt here. Well, I came across an article on Gamasutra re: this years Game Developer Conference. Here''s a direct quote from Steven Woodcock, who moderated the discussion on AI: "Nearly every developer was making heavy use of threads for their AIs in one fashion or another, in part to better utilize the CPU but also often just to help isolate AI processes from the rest of the game engine." You can find the entire article here: http://www.gamasutra.com/features/20001101/woodcock_01.htm Multithreading is an important skill to learn; whether you learn Posix threads or win32 threads, most of the theory transfers, so just learn it.

Share this post


Link to post
Share on other sites
bogdanontanu    122
Yes its good to learn new things...

But...

Its not the learning that takes out threads from games...

Think of my case: a multiplayer RTS game.

I have to do the AI syncronized on all machines over the net. that is same AI at every frame on every computer. If i do AI on a separate thread i will have to also syncro threads and end up with no real advantage. I can easy end in a disconected game. I also loose speed if i use threads...

Threads are great for normal win32 programs but for Real Time Games they don do much. Yes they help sepparate the code modules. But again that takes a heavy payment in speed an a need to resyncronise multiple program pieces vie Mutex and stuff.

IMHO threads are a help for the programmer to end up his work easyer, but they dont help the program a lot...in fact they can harm quite easy a program (and in deviouse ways)

ALL you can do in threads can be done without them (a little harder but usually better) this is normal if u understand that most of computers have a single processor anyway....

I use threads only to accelerate mouse draw over my screen...

IMHO u can use threads in games only if there are totally separated tasks to be done...and this is offten not the case in games...

You dont HAVE to use a toll just beacuse its there and that it looks like is "cool"

Anyway we all have to learn threads and give it a try from time to time...maybe something will emerge

For example when i connect my games via DirectPlay, 5 to 9 threads appear to be linked to my game process from directplay dll''s ...and then i wonder why its so slow...

Bogdan

Bogdan

Share this post


Link to post
Share on other sites