chaitu236 / TakServer

Server to handle online TAK games
https://www.playtak.com
GNU General Public License v2.0
35 stars 8 forks source link

Undo request #8

Closed scottven closed 8 years ago

scottven commented 8 years ago

Can you have the 'Undo' message include who's turn it is, similar to the GameList lines? It'll make restoring the state easier for the AI.

chaitu236 commented 8 years ago

But can't it be obtained by moveno%2 ? Edit: or just flipping current state?

scottven commented 8 years ago

Yes, I can parse it out of the PTN, but it would be nice to have a cross-check since this is asynchronous The remote player could be asking to undo their last turn, but the message might not arrive until after I've already sent my next move. For now, incoming commands queue up while waiting for the AI move, so that makes the race easier to lose.

chaitu236 commented 8 years ago

Even if I put a turn no. or player name in the msg, if you send your move without undoing, the board state is messed up anyway and this wouldn't fix anything. Maybe after the AI moves, you could process the server commands and only send the AI move if there was no Undo...

scottven commented 8 years ago

With the current scheduling, it'll actually send the new move, then process the undo request. Does the server drop the undo request when it see a new move from the non-requesting player?

chaitu236 commented 8 years ago

Yes, it drops the request if either of the players make a move.

scottven commented 8 years ago

OK. I think that means I'm better off just ignore undo requests for now until I get my AI calls into my main scheduling loop.