Animations via network

Good day,
I am busy with a simple adventure game, and I am working on the online animations. The movement and positions is working fine, but the character does not walk (animate) on the partner’s screen. Now I know accurate animations can eat bandwidth, and in my case it is not critical.
My question is how to get the animations to work via network. I have asked in the forum, with no concrete answers here. In fact I cannot find ONE tutorial on how to transmit ANIMATIONS via network. not movement and positions,but ANIMATIONS.

If someone could help me I will really appreciate it.

Best regards,

What I plan to do in my game is to just stream an int. 1 = forward walk. 2 = backwards walk. 3 = idle. Etc. And then play the appropiate animations based on the received int.

@OrangeLightning Please convert your comment to an answer, as it answers the question perfectly :)

The docs do provide plenty of examples at times.

1 Answer

1

enum animations { idle, forward, backwards };

@RPC
function NetworkAnimate (anim:int) {
    switch (anim) {
        case animations.idle:
            animation.Play("idle");
            break;
        case animations.forward:
            animation.Play("forward");
            break;
        case animations.backwards :
            animation.Play("backwards");
            break;
    }

When you want to call an animation, you need to call :

networkView.RPC("NetworkAnimate", RPCMode.All, 0); 

to play idle for example.

Thank you for this example. I had a different approach where I tried to sync the State names.. Didn't really work. But with Integers it works really nice.

Glad I could help someone, the person who asked the question never answered to me :)