Page 1 of 1

Multiple Threads?

Posted: Tue Dec 18, 2018 5:29 pm
by whi7ed3vil
Any thoughts given to opening the game up to multiple CPU threads? It seems at present to be a one-core-wonder. Would be nice to see the performance improvement on a multi-core system by at least taking each AI into its own thread. You guys considering that kind of architecture upgrade in the future? I could see this minimizing the (occasional) lag generated by large-scale AI decision making.

Re: Multiple Threads?

Posted: Tue Dec 18, 2018 8:45 pm
by Sleipnir
The game runs with a main thread for the game logic, a second thread for rendering*, and worker threads for various tasks that use the network or take a long time to complete. Running the AI in parallel with the game logic would be very difficult because it needs to read consistent state from the world.

An intermediate approach that would help a lot on games with many bots would be to split the bot updates across N threads that run in parallel, but serially with the world. This would still require a fair bit of work to manage the optimum number of threads - running 10 AI threads on a system with only 2 cores would be overall worse than running bots all on the main thread.

*the render thread is disabled on Windows because it reliably breaks the windows taskbar, and so far nobody has any idea how this could happen or how to fix it.

Re: Multiple Threads?

Posted: Wed Dec 19, 2018 5:46 pm
by whi7ed3vil
I see. Good to know. My comment stems from the idea that no matter how taxing the game seems to be on OSX, it never reports utilization above one core. Assumed that was because it had only one thread, but perhaps another reason?