Hi guys! Thanks for being there!
I’m trying to give to the server my Horizontal and Vertical Axis to update that on all clients, but just giving it with something like that:
The player.Vertical/Horizontal is just the input that i’ve got.
The SendUpdateAxis method just send to the server those values to update them on all clients. (also update the lastHorizontal and lastVertical)
Basically this code works, but i got too much calls. If i just hold the W key to move i got too much calls because vertical axis is updated in this way:
So this makes my server to not be able to send data as it receive it because too much data is passed!
I was looking for a solution that keeps me the Axis
because i use blendtrees
because the freeform 2d cartesian blends perfectly my animations and i don’t have the budget to have specific animation
because the Axis method are for me the most elegant way to achive that.
I didn’t still found a solution to that, i’ve tried to raise the sensibility of the Vertical and Horizontal axis, but then the Axis will just jump from 0 to 1 and the animation will not be smooth at all!
Hi sorry i didn’t said that i need the axis to play animations across the network, so i can’t really send it sometimes but i always have to update those values for all the clients!
Why do they need to be exact? If you send it 15-20 times a second. (That’s what most games do, they send Position updates at that rate). Then you have enough precision to interpolate the rest. You can do the same for your floats. Interpolate between them.
Oh i apologise, i’ve assumed that you’ve said something like 15-20 times in a more longer time.
This is well optimized? I really want to do the max work on the optimization! And how i can compress floats?
And I don’t know what you mean if it’s well optimized? It’s a odd question. If you send the floats 15 times a second. Or even less. Then you can just interpolate between them on the recieving end. Shouldn’t be an issue.
You could send inputs in FixedUpdate function to make your project balanced for budget pc, but you should configure NetworkSendInterval and also interpolate that float on client side.
public override float GetNetworkSendInterval()
{
return 1f; //Send position each second.
}