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!