Hi guys.
I’ve got an algorithm problem (means no code, just ideas and methodology)
In my game, players are able to create their ships from scratch using a minecraftlike method (placing blocks in a chunk) offline.
When playing online, player must sync their ship data (sending block array) to other players to be sure his ship will be displayed correctly on all machines.
I’m using lidgren, and a custom library to move standard server code into a separate dll (and enable me to build a dedicated server)
Actually, the netcode (in the dll) maintain a Dictionnary of playerData for each player sync across server and clients.
When a player select his ship, I transfert the chunk data by setting his player data, which get replicated on other clients (like an netview.RPC)
When a ShipChunk is spawned (like an unity Network.Instantiate call), the Start() method will request data from netcode by using his netview’s playerID, then create itself using the gathered data.
My main concern is about ChunkData size, which can be quite high and take time to transfert.
I would like to send the Instantiate call without waiting the ChunkData to sync (ie: using a different channel), enabling chunk to be spawned on all clients BEFORE his information was arrived (and then update it when it comes)
I can check if PlayerData was changed in Update(), and then recreate the chunk BUT I don’t want to allow a player to change his chunk information without suicide (ie: Destroying the chunk, then reInstantiating it)
The only way to do that is to wait ChunkData to sync BEFORE sending the Instantiate call, but it can introduce a large amounts of lags.
I’ve thought about sending an autoincrementing shipID along with the instantiate call and with the ship data, enabling chunk to wait for the given ID to arrive, and don’t respond to later ship changes (because the id will be different), but it seem a bit an headache for me.
Any thoughts on that will be greatly appreciated ![]()
I hope I make myself clear enough.
Thanks all!