should ai be calculated in its own thread?
Posted 06 October 2010 - 10:15 AM
Posted 06 October 2010 - 12:03 PM
Check up on thread pools and how you can use that to perform asynchronous operations. This way you can control the number of active threads based on your requirements and the hardware available.
Posted 06 October 2010 - 03:13 PM
Your problem, with current popular languages, is going to be coordinating the effect of parallel-running tasks over the shared data structures. Welcome to lack of determinism, race conditions, synchronization issues, etc! Or, alternatively, you will have to learn a new language like Erlang or Scala.
Posted 20 September 2012 - 08:58 AM
While the AI is moving the game pieces around, the games draw routine is called.
The AI hasn't finished it's run, so some pieces are in the right place, and some are in the wrong place. It's even possible for one of the coordinates of a piece to have been updated but not the others. This will produce horrible on screen artifacts.
So you need to plan for this situation and have a way of handling it.
An even more dangerous example is when you have AI and physics running in their own threads. Hell that can go wrong spectacularly
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users