Original Post
I'm working on a Java game/simulation and there are several NPC's that will be active at once. I want to implement different types of AI for each NPC, but one problem I came across right away was that I want each NPC to have at most X amount of time to "think" when it is that NPC's turn to think. In other words, I don't want the game to bottle-neck while one NPC is thinking because I implemented a more resource-intensive algorithm. What I would like to achieve is the following: - There are 5 NPC's, each with a different AI algorithm - Each NPC will get X amount of time to run through it's algorithm, or Y amount of cpu instructions I've considered assigning each NPC to a thread, but I have no guarantee that the operating system will allow each thread to be executed for the same amount of time.