- Home /
Network.sendRate = 50; is that bad?
So i am making a multiplayer FPS game on Unity version 4, i had really skippy player movement though so i changed Network.sendRate to 50 instead of the default 15(i believe), my question is, will this cause performance issues later down the line or is 50 a normal number for FPS games, i looked around online but couldn't find anything on it maybe because everyone else uses a different version of unity nowadays.
disclaimer: i have the pro addition of unity 4 which is why i don't want to update to the newer expensive version of unity
And on an unrelated note check out my player movement script thus far. #pragma strict var walkStaticSpeed : float; var crawlStaticSpeed : float; var walkStaticSpeedDown : float; var crawlStaticSpeedDown : float;
var walkSpeed : float;
var crawlSpeed : float;
var slideSpeed : float;
var jumpSpeed : int;
var isSlidding : boolean;
var isJumping : boolean;
var isWalking : boolean;
var isCrawling : boolean;
var cannotJumpSlide : boolean;
var cannotMove : boolean;
var idle : GameObject;
var walking : GameObject;
var slidding : GameObject;
var jumping : GameObject;
var crawling : GameObject;
var crawlingIDLE : GameObject;
var crawlingMOVE : GameObject;
var animationState : int;
var pHead : Transform;
var pGun : Transform;
var pHead_L1 : Transform;
var pHead_L2 : Transform;
var pHead_L3 : Transform;
var pHead_L4 : Transform;
var pHead_L5 : Transform;
var pGun_L1 : Transform;
var pGun_L2 : Transform;
var pGun_L3 : Transform;
var pGun_L4 : Transform;
var pGun_L5 : Transform;
var nView : NetworkView;
function Start () {
}
@RPC
function AnimState(AS : int)
{
if (AS==1)// && nView.isMine)
{
idle.SetActive(true);
walking.SetActive(false);
slidding.SetActive(false);
jumping.SetActive(false);
crawling.SetActive(false);
pHead.position = pHead_L1.position;
pGun.position = pGun_L1.position;
pGun.rotation = pGun_L1.rotation;
}
if (AS==2)// && nView.isMine)
{
idle.SetActive(false);
walking.SetActive(true);
slidding.SetActive(false);
jumping.SetActive(false);
crawling.SetActive(false);
pHead.position = pHead_L2.position;
pGun.position = pGun_L2.position;
pGun.rotation = pGun_L2.rotation;
}
if (AS==3)// && nView.isMine)
{
idle.SetActive(false);
walking.SetActive(false);
slidding.SetActive(true);
jumping.SetActive(false);
crawling.SetActive(false);
pHead.position = pHead_L3.position;
pGun.position = pGun_L3.position;
pGun.rotation = pGun_L3.rotation;
}
if (AS==4)// && nView.isMine)
{
idle.SetActive(false);
walking.SetActive(false);
slidding.SetActive(false);
jumping.SetActive(true);
crawling.SetActive(false);
pHead.position = pHead_L4.position;
pGun.position = pGun_L4.position;
pGun.rotation = pGun_L4.rotation;
}
if (AS==5)// && nView.isMine)
{
idle.SetActive(false);
walking.SetActive(false);
slidding.SetActive(false);
jumping.SetActive(false);
crawling.SetActive(true);
pHead.position = pHead_L5.position;
pGun.position = pGun_L5.position;
pGun.rotation = pGun_L5.rotation;
}
}
function Update () {
if (Input.GetKeyDown("z") && nView.isMine)
{
crawlSpeed=crawlStaticSpeed;
walkSpeed=walkStaticSpeed;
cannotJumpSlide=false;
isCrawling = !isCrawling;
}
if (isCrawling==true && nView.isMine)
{
walkSpeed=walkStaticSpeedDown;
crawlSpeed=crawlStaticSpeedDown;
cannotJumpSlide=true;
animationState=5;
nView.RPC("AnimState", RPCMode.All, 5);
}else if (isCrawling==false && nView.isMine)
{
//do something i don't know.
}
if (isWalking==false && isJumping==false && isSlidding==false && isCrawling==false && nView.isMine)
{
animationState=1;
nView.RPC("AnimState", RPCMode.All, 1);
}
if (Input.GetKeyUp("w") || Input.GetKeyUp("a") || Input.GetKeyUp("s") || Input.GetKeyUp("d") && nView.isMine)
{
crawlingIDLE.SetActive(true);
crawlingMOVE.SetActive(false);
isWalking=false;
}
//WARNING!WARNING!WARNING! this section involves walking in REGULAR MODE WARNING!WARNING!WARNING!
if (Input.GetKey("w") && isSlidding==false && isJumping==false && isCrawling==false && nView.isMine)
{
isWalking=true;
animationState=2;
nView.RPC("AnimState", RPCMode.All, 2);
transform.Translate(Vector3.forward * walkSpeed);
}
if (Input.GetKey("a") && isSlidding==false && isJumping==false && isCrawling==false && nView.isMine)
{
isWalking=true;
animationState=2;
nView.RPC("AnimState", RPCMode.All, 2);
transform.Translate(Vector3.right * crawlSpeed);
}
if (Input.GetKey("s") && isSlidding==false && isJumping==false && isCrawling==false && nView.isMine)
{
isWalking=true;
animationState=2;
nView.RPC("AnimState", RPCMode.All, 2);
transform.Translate(Vector3.forward * crawlSpeed);
}
if (Input.GetKey("d") && isSlidding==false && isJumping==false && isCrawling==false && nView.isMine)
{
isWalking=true;
animationState=2;
nView.RPC("AnimState", RPCMode.All, 2);
transform.Translate(Vector3.left * crawlSpeed);
}
//WARNING!WARNING!WARNING! this section involves walking in JUMPING MODE WARNING!WARNING!WARNING!
if (Input.GetKey("w") && isSlidding==false && isJumping==true && isCrawling==false && nView.isMine)
{
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
transform.Translate(Vector3.forward * walkSpeed);
}
if (Input.GetKey("a") && isSlidding==false && isJumping==true && isCrawling==false && nView.isMine)
{
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
transform.Translate(Vector3.right * crawlSpeed);
}
if (Input.GetKey("s") && isSlidding==false && isJumping==true && isCrawling==false && nView.isMine)
{
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
transform.Translate(Vector3.forward * crawlSpeed);
}
if (Input.GetKey("d") && isSlidding==false && isJumping==true && isCrawling==false && nView.isMine)
{
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
transform.Translate(Vector3.left * crawlSpeed);
}
//WARNING!WARNING!WARNING! this section involves walking in CRAWLING MODE WARNING!WARNING!WARNING!
if (Input.GetKey("w") && isCrawling==true && nView.isMine)
{
crawlingMOVE.SetActive(true);
crawlingIDLE.SetActive(false);
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
transform.Translate(Vector3.forward * walkSpeed);
}
if (Input.GetKey("a") && isCrawling==true && nView.isMine)
{
crawlingMOVE.SetActive(true);
crawlingIDLE.SetActive(false);
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
transform.Translate(Vector3.right * crawlSpeed);
}
if (Input.GetKey("s") && isCrawling==true && nView.isMine)
{
crawlingMOVE.SetActive(true);
crawlingIDLE.SetActive(false);
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
transform.Translate(Vector3.forward * crawlSpeed);
}
if (Input.GetKey("d") && isCrawling==true && nView.isMine)
{
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
crawlingMOVE.SetActive(true);
crawlingIDLE.SetActive(false);
transform.Translate(Vector3.left * crawlSpeed);
}
//slidding
if (Input.GetKeyDown("left shift") && Input.GetKey("w") && isSlidding==false && cannotJumpSlide==false && nView.isMine)
{
isSlidding=true;
Slidding();
animationState=3;
nView.RPC("AnimState", RPCMode.All, 3);
rigidbody.AddForce(transform.forward * slideSpeed, ForceMode.Impulse);
}
//jumping
if (Input.GetKeyDown("space") && isJumping==false && cannotJumpSlide==false && nView.isMine)
{
isJumping=true;
Jumping();
animationState=4;
nView.RPC("AnimState", RPCMode.All, 4);
rigidbody.AddForce(transform.up * jumpSpeed, ForceMode.Impulse);
}
}
function Jumping()
{
yield WaitForSeconds(0.8);
isJumping=false;
}
function Slidding()
{
yield WaitForSeconds(1);
isSlidding=false;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612231802im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scroll lagging too much 0 Answers
can firebase real-time database be used on a pc standalone game? 0 Answers
When a host player changes his weapon all players get switched to it 1 Answer
Shoot Projectile Where Camera Faces [PLEASE HELP!] 2 Answers
Syncing movement and rotation lag in multiplayer scene 0 Answers