Moved AI planning to a standalone thread to make the game run smoother.