RPC trigger player jump

Hi,

I’m baffeled on this one…
I have my clients sending there input to the server through RPC commands.
The axis are sent and processed normally.
Jump gets sent as a boolean.
When the server receives the boolean it will trigger the jump in the Update function.
The boolean allways arrives on the server but at high frame rates the jump is allmost never executed in the Update function. I’m guessing this has to do with it being a boolean but not sure how i can resolve this.
Any ideas ?

what do you use to get your player back on the ground? it might be this way because you did not scale the “gravity force” with Time.deltaTime or smt, it jumps but it gets very fast back on the ground. (if it’s in Update and uses frame-rate dependent code)

and make sure the boolean given to the server, changes it’s value after initializing jump sequence.

moveDirection.y -= gravity * Time.deltaTime;
it allways changes the server side boolean in the RPC function, it just doesn’t make it to the Update function.
so when i debug the boolean in the Update function, it rarely changes at high frame rates.
i don’t think the gravity is the issue here.
it works ok on lower frame rates.

I managed to create a small fix for it but it’s not the best solution i think…
I created a coroutine that will change the boolean after 25 ms and send an RPC with the false value.
So the boolean is true for a longer amount on the server and now it gets executed even at high frame rate.

Can you post the relevant snippets? I’d be curious to see.

The server doesn’t need the jump fix but this is only a test for now.
here you go :

In the update function :
			if (Network.isClient) {
				networkView.RPC ("SendClientInput", RPCMode.Server, CVInput, CHInput);
				if (Input.GetKeyDown (KeyCode.Space)) {
					networkView.RPC ("Jump", RPCMode.Server, true);
					StartCoroutine ("EndJump");
				}
			} else if (Network.isServer) { // The server doesn't realy need the jump fix
				SendClientInput (CVInput, CHInput);
				if (Input.GetKeyDown (KeyCode.Space)) {
					Jump (true);
					StartCoroutine ("EndJump");
				}
			}
--------------------------
	// High frame rate jump fix
	[RPC]
	void Jump (bool bin) {
		SJInput = bin;
	}

	IEnumerator EndJump () {
		yield return new WaitForSeconds (0.1F); // 0.1 seems to be enough
		if (Network.isClient)
			networkView.RPC ("Jump", RPCMode.Server, false);
		else
			Jump (false);
	}

will test this more…
SJInput is the boolean in the server side update function to trigger the jump