#Network Variables Synchronization

1 messages · Page 1 of 1 (latest)

vagrant cape
#

Hi guys, i've got a question! (idk if it's the right place, sorry for bothering.)
Is syncing the network variables (especially NetworkLists) async? Let's say i've got a huge NetworkList and there's some late joining clients. Is the NetworkList syncing for them asynchronously? I mean, isn't it freezing the game thread?

#

Im asking in terms of the server processing the synchronization. It doesn't matter if the clients get the networklist (on their side) sequentially by freezing the main thread

#

but the main focus of my question is whether the server thread is freezed because of the sync

brave flicker
#

Yes. The syncing is asynchronous on either side.

vagrant cape
#

Oh, that's a life saviour. Thank you so much!

#

It kinda bothered me since im basically syncing a lot of networklists for every player so it would be kinda bad if the late joining clients would lag the server thread

brave flicker
#

I don't think the serialization of the data would be though, which is one of several reasons to avoid very large NetworkLists.

vagrant cape
#

Oh

#

that's game changing not gonna lie

#

I guess i will need to build some kind of a queue server. Maybe it could work the way that the joining players first connect to the queue server, synchronize the NetworkList there (main server would send the List ONCE at the startup to the queue server) and then when the synchronization is complete, the players would join the main server with the list synchronized

#

i would need to completely scrap the networklist for the main server tho

#

because it would be useless since they'd get the list from the queue

brave flicker
#

The only way to find out if it's an issue for sure is to test. Theorycrafting will only get you so far.

#

Usually you wouldn't want to sync entire large collections to late joining clients, or any clients in general.

#

Would want to split up the collection to only sync what's relevant to the player.

vagrant cape
#

I know, but i cannot avoid it. My game is a voxel based game with chunks, and with 400 chunks in total (after some calculations i've made) for each server of roughly 250 players it would be inefficient to always check whether the players are in the region which needs to "download" the chunk data from the server

#

i kinda optimized it by making a system

#

which only synchronizes the changes to the chunks but it is not a perfect solution

#

however after the "first synchronization" the server would send the players a clientrpc to change small portions of the chunks

#

like for example server tells everybody -> change block at x y z to [blockid]

#

which is the best i could provide (i think so 😭)

brave flicker
vagrant cape
#

Wait, why not exactly?

#

The NetworkLists are gonna get scrapped from the main server

#

so the synchronization is gonna be minimal

brave flicker
#

It's made for small scale co-op games. In order to really push your player limit anywhere close to being that high you'd be looking at some sort of custom implementation on top of NGO to allow for it.

#

There's also the question of cost. You may very well be able to make it performant, but it may absolutely burn through bandwidth in order to do so.

dusk wave
#

Yea, you wll quickly start hitting network bottelnecks before getting to a few hundred users

#

NetworkVariable<List<>> might be better with delta compression after the initial sync. But really only profiling will tell the whole story

vagrant cape
#

In terms of the network bandwidth i need to invest on a high end server and networking solution

#

but the thing that is saving me (i guess) is that the players are gonna be spread throughout the map with the player "render distance" so that it wouldnt need to synchronize every player with every player

#

about the network lists i think i'll go for the separate synchronization server