Client Buffer Limit reached causing drops
Hi. I have a simple 2D snowball right game I am making, It has networked player objects, throwing networked snowballs. Networked power-ups and such spawn slowly over time on the map, and the player can build networked towers that heave snowballs automatically.
After a variable amount of time, a client, or multiple will get dropped from the server. Much of the time before getting dropped they will get "Buffer Limit Reached" error. Since I use a reliable fragmented channel, which is 'all or nothing', this causes the client to stop sending info to the server on their location, wanting to throw snowballs, etc.
I changed the buffer limit from the build in 16 to 512 and that caused massive, immediate lag. After a little bit more time than previous, the clients still got dropped.
Can anyone here help me out with how to properly network without clients hitting the buffer limit?
I can post all necessary code and pictures on request!
Thank you!
Answer by KPLloyd · Dec 15, 2016 at 11:43 PM
Thanks Diamond. I did end up figuring out the issue a few days ago, my mistake for not updating this.
My problem was the CmdSyncData() method being called every update. I guess that was too much data at once!
My work around was not only simple, but logical: instead of sending sync data every frame to the server I just send it when the data changes.
Thank you very much for your help.
Answer by AurimasBlazulionis · Dec 11, 2016 at 10:04 PM
You can either create multiple channels, or you could (really should) make things like snowballs non-networked. Snowball locations and where they should hit should be very easily predictable.
The last option is to wait. Wait for the 5.6 it will introduce the new transport API which can handle much higher loads.
Hi Diamond, thanks for the response.
The problem shouldn't be needing to handle higher load. Its a super simple game, not the next Call of Duty. The fault is certainly on my program$$anonymous$$g, so hopefully with a little of your help we can fix that.
As for removing snowballs from being networked, I will monkey with the code to see if I can get them to properly function with avoiding networking them.
As for channels, how exactly do they work? Do I set specific scripts to be networked on specific channels? Is 200 buffers in one channel worse than 100 buffers in 2 channels? Would it be bad to have one channel for each little networked thing?
Each channel can handle specific amounts of network bandwidth. Also, you should really use the profiler to profile how many commands are being sent from each script etc. this will allow you to find what causes it.
Your answer
![](https://koobas.hobune.stream/wayback/20220612102518im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Crash after DisconnectEvent 0 Answers
How to get OnTriggerEnter working over a network 2 Answers
[UNET] ClientMoveCallback3D Example? 1 Answer