Imagine a reversi game in realtime, without the turn-based structure. Now imagine there’s, for example, 500 tiles that can be either white, black or blank (most of the blank on the start).
What’s the best way to keep in sync the 500 tile states (example as an enum blank=0,white=1,black=2), to prevent a desync. Should the client look for a mismatch (imagine a case of packet loss)
Imagine all the tiles are on one array, whats the most efficient to contrast them with the client and update them if needed? Apparently one can’t send arrays(built-in) over the network, or am I wrong?
If you want to send the entire board state, you might consider converting the array data to a string, sending an RPC with that string as a parameter, and then parsing the string on the other side. Could even use an xml generator to generate the string, could use a simple comma-separated-value, etc. You also can go more fancy with BinaryFormatter. See this link:
I want to send my player list from my server to all players, but RPC doesn’t support lists/arrays. what is the best way to get around this. keep in mind that the list couldn’t simply add a player to each player’s list each time, because when a player...
If the string gets absurdly long you could look into using compression like:
If you feel that might not be ideal because the game board is changing several times a second, maybe send the tile changes from the server, and have the client use a request RPC.
So client request change tile x,y. Server receives, updates board, tracks changed tiles for that particular move request, and sends an RPC as above with a string of changed tiles.
i.e. String format could be [tile x],[tile y] , ;
So the changed RPC string might look like:
Client parses and sees tile 1,1 & 1,2 & 1,3 have changed to black.