View Single Post
Old 09-28-2006, 07:32 AM   #104
SoccerDude28
Homer of Kittens
 
SoccerDude28's Avatar
 
Join Date: Aug 2004
Location: San Francisco, Bay Area
Posts: 4,374
Default

Quote:
Originally Posted by insane_cobra View Post
True to some extent. Most game programmers are still not used to working in multithreaded enviroments, but there are ways to utilize even 80 core processors. For instance, let 5 or 6 threads take care of various game systems and allocate all remaining threads to AI processing. That way you could have a great number of complex, presistent characters - each with its own thread - "intelligently" interacting with the game world all the time. There are many other potential uses.
You say it like it is easily doable. In computer science, the most difficult task for a programmer is multi-threading. In the server/client world, it is much easier to implement because each server will supply a client with one thread and do all its work in that thread (like a web app for example). Even then you have synchronization concerns of shared resources like a database. In a Word application, ditto, a search can go fire off in the background while you are typing in your document, and in no way is searching for something interfering with what you are typing. Same with spell checker or Grammar checker.

In games though, they are instinctively single threaded, because everything is tightly connected. AI is tightly connected to gameply, which is tightly connected to graphics animation of a character, which itself is tightly connected to the audio. Synchronizing between these things, when each one is fired off asynchronously from the others is a nightmare. You were talking about each character having its own thread. But what about the inter character communication, collision detection between characters, and them responding to your own input (for example you pass close to one and he'll start firing at you). In a single threaded game, all these are executed within one game snapshot (known as a frame and thus the term Frames per second).

So you clicking on a mouse will be captured in the frame, all collision detection calculated, one animation per character executed, one pieace of sound released, each enemy AI calculated, and the process is repeated 60 times a second. It is synchronized because it happens all under your control and you know exactly what each frame holds. With multi-threading however, in one frame, one character might do three things whereas another might not do anything at all. How do you ensure that everything gells together.

Multi-threading does have its applications in the 360 today, like downloading a game for example goes on one core, while playing another game goes on another (they are 100% disjointed). But doing in game multi-threading the way you described it is every programmer's nightmare.
__________________
--------------------------------------------------
Games I am playing: Jeanne D'Ark (PSP)

Firefox rules
SoccerDude28 is offline