|
Re: back to online battleship
why not just send 2 arrays, one with ship coordinates, and one with called shots coordinates to both players every turn to ensure they have the correct board setup. The player then sends a new shot to the server, the server adds it to the shots array and compares it to the ship coordinates array, then sends the results to the both players and a call hit or miss to the firing player. This keeps everything on the server, and players only get updates.
Of course what I posted is watered down, as you don't want to send all ship coordinates to both players, and you don't want to send all shots to both players. The client software is only responsible for taking the arrays and setting up the board, and prompting the player for a shot; no sending of the whole board, just the coordinates.
Last edited by Jabo; May 17th, 2008 at 7:31 PM.
|