network bandwith reliable/unreliable int/float

Hi,

i want to do a 2D game with 16 players and more.
i prefer to think now about network bandwith.

i have a script attached and observed by a networkview in a object “networkplayer”. it is in unreliable mode for:
x,
y,
angle,
state (jumping, have flag, …),
life

  1. x, y, angle are float: i don’t know how much ko/s it is. maybe if i convert it in a int before sending, it will consume less? like:
    sender: Xisend= (int)myX*1000
    reciever : myX = (float)Xirecieve/1000

thereby the comma is less precise but cost less bandwith because it is int?

  1. life, state : don’t change every frame but 10/20 frames. is it a good idea to set them in a different networkview on Reliable, will it bring really something?

  2. for damage, i use RPC. but i am afraid that it could freeze game when lags. is it a good idea to set a reliable value, always at 0. and when there is damage, set to the amount of damage? then put it again a 0.

sry for my poor english.
thx

Hello,

Since Unity uses UDP, and the UDP header is quite large in data, most of your data you’ll be sending will be in the header of the packets, not the content. Therefore the difference between an int and a float will make WAY less difference than reducing the number of packets in general.
But seriously…
The amount of data you are going to send is not even going to be close to that of (for instance) a youtube video. There is such a thing as over optimizing :slight_smile:
As for reliable vs unreliable: Unreliable just means there will be no confirmation package, but it also means your packets might not arrive… I preffer losless over lossy, in both general and specific cases :slight_smile:

For damage… why would it cause a freeze??? wtf are you smoking :stuck_out_tongue:
For any event, RPC’s are better than networkView automatic syncing. Prefferably convert everything to RPC’s so that even your movement and such is event driven :slight_smile:

Hope this helps,
Benproductions1