- Home /
Big Delay in Networking
Hi there, I am not sure how to explain this: I am working on a 2D shooter, and when playing in Internet the delay is kind of big (0.5 secs maybe), sometimes this delay makes the shoot hit the own shooter (Shoot is spawned from server) but this is not the problem I mean this shouldnt happen with a normal delay, when I play in LAN delay is correct , what makes sense because it is localhost, when I play with Internet even with myself delays is > 0.5 as said.
Shoot code (Shoot Objects has a 3D rigidbody):
@Command
public function CmdShoot() {
var shoot = Instantiate(ShootGO,ShootPoint.position,gameObject.transform.rotation);
NetworkServer.Spawn(shoot);
shoot.GetComponent.<Rigidbody>().AddRelativeForce(Vector3.forward * 500);
shoot.name = "Shoot";
var audio : AudioSource = GetComponent.<AudioSource>();
audio.PlayClipAtPoint(ShootAudio,gameObject.transform.position);
}
Also I have done a adsl test: 20 Mgbs Also pinged Unity servers: 41 medium of ping
So I am kind of confused, Unity servers looks like working correctly, game itself is working as it works in lan as expected, so... Maybe some configuration is using too much bandwitch?
Network Sendrate: 15 (Tested 30 too and problem kept)
Shoot Network Transform:
Sendrate: (I need maximum real time, maybe this can cause the lag? if i put this less than 29 projectiles dont go fluid...)
Tranform Type: Rigidbody 3D
Movement threshold : 0,001
Threshold snap: 5
Interpolate Movement: 1
Rotation Axis: None
Rest ones as default
Shoot are destroyed after hitting a wall/enemy so I would say max shoot objects at same time ~= 8.
I dont know if you need more information. I have tried different configurations for 2 days, different ideas and nothing is working with a understandly delay.
Thanks in advance.
The delay is most likely due to your setup.
Do you have Run in background turned on?
How are you testing? a build and the unity editor?
Did you try two computers?
Not running in bg. Have tested in lan with 2 applications + 1Unity and in Internet with 1 Unity + 1 application. Also tested with another computer of my home 1 app here + 1 app there and also tested with friends (Where I am not sure but problems look smaller)
Your answer
Follow this Question
Related Questions
Unity Frame Drop From Instantiating Prefab that has script 0 Answers
how can I present a choice under function OnNetworkLoadedLevel 2 Answers
Problem with Random.range 1 Answer
BCE0049 error with networking script 0 Answers
Fireball instantiate - lags 1 Answer