General Category > Game Development

Multi Threading

(1/4) > >>

TechSY730:
Now that >2 core computers are becoming much more common, are there any plans to make your game engines multi-threaded (or at least parallelize some easily split apart loops that are used often). In the case of AI war, could this also be done for the AI thread?

I know this would be a lot of work, thought, and debugging (though there are libraries that can ease this pain some), but it may help those with high end PCs overcome some of the performance challenges that you running across, and make previously laggy tasks much less laggy. And as they say, you are going to have to do it to take advantage of the newer hardware that is coming out.

One thing I don't know is how well you can enforce consistency across multiple runs with current multi-threading techniques and libraries. For your multi-player games, getting the same results across multiple runs and platforms is very important no matter what system you are running on.
For completely separable loops (loops where each iteration is completely independent from the others), this is not an issue, but I suspect that some of your CPU intensive loops that are not so nice that way.

x4000:
This has been beaten to death in some older threads on this forum, somewhere in the AI War forum.  At any rate: no, there are no plans to ever make AI War more than single-threaded for the main thread, as that's basically technically impossible because of the required network model.

In terms of the AI thread, using more threads would be worse than useless, because it doesn't need to run any faster and so that would just be a waste of your RAM and extra cores. ;)  The AI thread is already faster than the network can handle, so it has to be throttled to only so many commands per second to avoid flooding the network with too much data (and in the case of single player, it gives the AI at least a slightly more human-like reaction time, and keeps the reaction time of the AI from varying too much by host.

In terms of Tidalis: that's ridiculously lightweight already, and there's no point.

In terms of AVWW: that's somewhere in between AI War and Tidalis in terms of load, but it's still not likely to require multiple threads or even benefit much from them.  It won't have a separate AI thread, so, like Tidalis its game logic will be purely single-threaded. (Things like networking, sound, music, and so forth do have their own threads in all these games, but the load there is so trivial that they don't even really register on the other cores compared to the main game thread).

The network model of AVWW doesn't present any technical barriers to multithreading (unlike AI War or other strategy games), though.  So if we wound up needing to have worker threads for long-running processes, those could be set up for AVWW.  I just strongly doubt that will ever be needed, given the game design.  After AI War, we're used to writing such highly efficient code that it's likely to run on one core, anyway.  And it's a catch 22, because any computer with a weak enough processor to need more than one core... probably only has one core anyway.

So, no, there are no plans for this for AVWW unless it becomes down the line, and it's completely out of the question for AI War for reasons that have been discussed in extreme length and detail (that was a massive forum thread last year, and nothing's changed since then) before.

TechSY730:
Yea, I was suspecting that the pretty much all current multi-threaded algorithms and data-structures that would be useful to you guys don't provide good enough consistency guarantees for what you need. I just thought it was worth a shot.

I really hope that such consistent parallel algorithms and data structures will be developed soon.

x4000:
I really don't think that it's mathematically possible to get the same result from parallel operations as you would in non-parallel operations, honestly.  That's because each operation depends on the one before it to some extent, and so if you change the order you change the result.  It's quite an insurmountable problem, I think.  Last I heard IBM is offering $1 million to the programmer or team who solves the problem, but nobody has won it or even come close from what I know in the last 5 years or whatever it was they've been running this.

TechSY730:

--- Quote from: x4000 on February 03, 2011, 10:21:29 PM ---I really don't think that it's mathematically possible to get the same result from parallel operations as you would in non-parallel operations, honestly.  That's because each operation depends on the one before it to some extent, and so if you change the order you change the result.  It's quite an insurmountable problem, I think.  Last I heard IBM is offering $1 million to the programmer or team who solves the problem, but nobody has won it or even come close from what I know in the last 5 years or whatever it was they've been running this.

--- End quote ---

Without absurd amounts of locking, it may not be possible to have a consistently reproducible paralell algorithm that is running with a non-deterministic (from the program's point of view) thread scheduler (like you have with most OSs)

Again, for operations that do not depend on order (like those independent iteration loops I mentioned), this is of course trivially possible. Also, if there is only one correct answer, then a correct parallel aglorithm will of course give the same results too.

But for parallelizing dependent operations, approximation, probabilistic, or "find one solution that works of a possible many" algorithms, who knows...

And really, a measly 1 million? Yes that is a lot, but proving that parallel algorithms can be made to give consistently reproducible results outside of those limited cases I mentioned seems MUCH more valuable to the industry than 1 million dollars.

Navigation

[0] Message Index

[#] Next page

Go to full version