Page 1 of 1

Syncing dynamic arrays over the network.

Posted: Sat Apr 06, 2019 2:53 pm
by MarkusGod
What is the proper way to sync for example std::vector<EntityId> over the network in netserialize or via RMI? As far as I know, netserialize can only work with fixed elements quantities, and calling RMI for each element looks weird to me.

Re: Syncing dynamic arrays over the network.

Posted: Wed Apr 17, 2019 1:39 pm
by Cry-Flare
Can you give some context?
Usually you would send each entity id as the data is found.

Perhaps there is an alternative implementation that would be more appropriate?

Re: Syncing dynamic arrays over the network.

Posted: Wed Apr 17, 2019 6:48 pm
by MarkusGod
I have an Energy Generator (component) with a list of attached machines, no hard limit on possible connections. All "power generation and distribution" is handled on the server (gEnv->bServer), when a player tries to connect new machine he calls an RMI that adds new entityid to vector, whenever that vector changes I'm calling NetMarkAspectDirty. I think it will be better to fully rely on RMIs, but that probably will introduce some hassle on handling the new player connection (server will run independently of players like in Minecraft).