- Home /
The question is answered, right answer was accepted
Multiplayer lag over LAN...
Im experiencing strange lag (and its over LAN..). There are only 3 objects in-game, which are very low poly, so its not system lag. How can I solve this? Is there a way set the bandwidth limit?
Answer by thornekey · Apr 18, 2014 at 11:07 AM
Nvm, found it. This solves lag to an extent.
void Awake() {
Network.sendRate = 25;
}
Answer by FLASHDENMARK · Apr 18, 2014 at 10:28 AM
That is not lag. This is normal behavior in games with networking. Since you only transmit the position, rotation etc. every fixed seconds(and not every frame) it will appear like this.
There are a few solutions. You can raise the network send rate. I don't know what networking framework you are using, but I think Unity default is 10 or 15 synchronizations per second. This is by far not the best way to smooth anything. As several people join your bandwidth usage will raise exponentially. Since bandwidth is a scarce resource I wouldn't do that.
The best way is smoothing. Take the new position and Lerp(or whatever you want) your character towards the new position. You can look into interpolation and extrapolation or any kind of behavior for smoothing your characters. This is a little trickier to get right and making it look natural on the receiving end, but bandwidth is best used elsewhere than on raising the send rate too much.
its co-op; so 2 player only. so how would i go about changing the network send rate
Follow this Question
Related Questions
Send data over wifi/lan 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Simple Multiplayer FPS Lag (LAN) 0 Answers
Accessing information and checking who's who in network game. 1 Answer