Send Axes values to a Server

Hi guys!
I was trying to send the value of 2 axis that have to costantly change on a Server .

The problem is that with something like this:

float lastVer; //Keep the last updated value of vertical axis
float lastHor; //Keep the last updated value of horizontal axis

void CheckForUpdate() {
if (player.vertical != lastVer || player.horizontal != lastHor)
        {
            UpdateAxes();
            lastVer = player.vertical;
            lastHor = player.horizontal;
        }
}

I got so much calls! The axes changes so fast, and the problem is that i need those values to be super precisly due those are used to do movements animations in blend trees!
(The player.vertical and player.horizontal are setted by the vertical/horizontal input of course)

For have less calls i’ve done this:

void Start() {
      InvokeRepeating("CheckForUpdate", 0, 0.05f);
}

I’ve got 20 calls per seconds, and i think that’s too much! To make matters worse the values are not extra-precisly with this way, i still got a little clipping on the animations.

The first question is: Is this a good way to achive that? There is a better one instead of sending input? But of course i wish to have a perfect synching of that! I’m firm from one week to achive a good optimization on this! And still not got that!
The second is: Is that a good idea to use blend trees to achive movements in multiplayer games? I really need them, not for the movements only!
Last: Are 20 calls per seconds a good number? I don’t know that, but i don’t think so! With only 5 players i will have 100calls per seconds and only for update 2 axis!

Thanks to everyone in advance! I really have trouble on this!

Few tips. Most of this stuff is based on the type of game you’re making.

  1. Limit your update function to the reasonable amout of input updates.
  2. Send your inputs each X amout of time. Make sure this is sent as a single message. Don’t use SyncVars for this.
  3. Buffer player inputs on the server;
  4. Interpolate your animation/movement over received values on both server and client. You can always feed your interpolation values to the animation. Though it shouldn’t happen in fact. Movement and animation should be a separate thing, if possible. Otherwise it will cause desync of player movements on server and clients.

Also, you might wanna take a look at how other games movements are implemented. There’s plenty of information about this in the net. Again, it depends on the game you’re making. There’s more to it than just calling it server authoritative movement.

You’re on the right path. Keep going.