Right, so the game I'm developing is a multiplayer board game. It is a 4 player game, and 'empty' slots will be filled by AI players. For the majority of the game the AI decisions are fairly trivial to make, but on occasion it need to do something more complicated - think chess-style search space algorithm to determine the best move. Now, there's something like a 100ms limit on requests to the server before they get killed for CPU hogging. I can't be sure how long the calculation will take, so my question is, what are some good ways to handle this?
At the moment I'm thinking I put some kind of timer in the code, have the search routine check it regularly and if still incomplete at >= 90ms then bail out and return the best move found so far.
Alternatively, if I'm feeling a bit cheeky, I could halt the search state and send an 'incomplete' message back to the clients, which will immediately respond by triggering a 'continue' event. It's a bit more complex, but would give me more time to play with. Although does feel like borderline abuse of the system... but then this search only happens a few times per game anyway. It's not like there's much processing going on the rest of the time.
Any other good ideas?