- Home /
Network bandwidth - what is a good guideline for a "ceiling"?
I'm wondering if there is a certain amount of bytes/second of bandwidth I should use as a guideline for "the number I don't want to exceed".
Currently when I play with 2 players being synced with NetworkInterpolateTransform, its about 2200 bytes/second. I'm wondering how bad its going to get once I introduce enemy AI units; if I have 10 units its going to be something like 12,000 bytes per second I imagine. How much is too much?
Answer by Statement · Mar 11, 2011 at 07:32 PM
I guess it depends on what connection you want to support. 12,000 bytes per second is about 11.7 kB/s. For example 0.5 Mbit ADSL support theoretically 64 kB/s. It means it would take about 183 ms to send that data to a 0.5 Mbit connection. It might be too costly, or it might be fine if you're using good dead reckoning schemes. I haven't done multiplayer in Unity3D so I can only draw upon my knowledge since university and apply some deduction. If your network code would be running in 30 fps that would mean that each update should be at most 2.1 kB to avoid choke.
Or another way of putting it; you're consuming 11.7 kB/s of their 64 kB/s connection so you should be able to sync every frame under perfect conditions.
What is your target?
$$anonymous$$ost people have 512kbps of upload in this day and age, right? So I suppose 51,200 could be my theoretical ceiling, hopefully I come in under that. I'm not really sure what my target is, this is all new to me, haha :)
The default Unity network serialization sendRate is 15/sec, btw. Right now that seems to be fine for me. I might even try reducing it.
512 kbps = 524288 bps (Bits per second). 524288 bps = 65536 Bps (Bytes per second).
Answer by Ashkan_gc · Mar 11, 2011 at 07:46 PM
most games target 128kbps connections as their lowest connection speed and some of them as you said take 512 as their connection speed limit. you should take another factor into account. you have RPCs too for sending important events like shots or ... they take more bandwidth and if they are common like shooting in an FPS game you should take them into account too. also keep in mind that packets sometimes drop so other than using prediction and dead reckoning you should try to make your game's connection requirement as low as possible. it should be high enough to allow smooth gameplay and as low as possible.
I actually stopped using RPC's for my bullets to save bandwidth, and am ins$$anonymous$$d just serializing an isFiring boolean and letting clients simulate other clients shots locally.
I'm wondering if it would be beneficial to sync AI enemy positions with RPC's though ins$$anonymous$$d of using NetworkInterpolatedTransform, and syncing it only a couple times a second or so. That would probably save a lot of bandwidth, but I'm not sure its a good idea to sync something like that with RPC's.
if you have an authoritative server just let the clients simulate the AI on their machines. otherwise you should sync them like others. important state changes should be RPC and the transform should be sync too. if the AI's behaviour is not random by no means, you can predict much and sync it slowly.
Your answer
Follow this Question
Related Questions
Load Previously Instantiated Network Objects 1 Answer
Synchronizing Gameobjects over a Network Server < - > Client Sync 0 Answers
UNET : SyncVar value not updating, hooks firing 1 Answer
How to load all character previously in game when new player joins 0 Answers
Synchronizing game object across clients 2 Answers