Lumberyard
User Guide (Version 1.21)

Synchronizing Animations Across a Network

You can use the AnimGraph component to add an animation graph and motion set to a character. To synchronize the AnimGraph component's parameters (its EMotion FX animation state) across the network, use these two components:

The Anim Graph Net Sync component, which is included with the EMotion FX Animation gem, requires the Network Binding component. You can add the Anim Graph Net Sync component to any entity that has the Anim Graph component.

Adding Animation Synchronization to an Entity

The following procedure shows how to add the Network Binding and Anim Graph Net Sync components to the Rin character in the Advanced_RinLocomotion Sample level of the Samples Project.

To add animation synchronization to an entity

  1. In the Project Configurator, do the following:

    1. Follow the steps in Choosing a Game Project to Open to set the SamplesProject as your default project.

    2. Follow the steps in Enabling Gems to enable the Multiplayer gem for the Samples Project.

  2. Close the Project Configurator, and then launch Lumberyard Editor.

  3. In Lumberyard Editor, choose File, Open Level, or press Ctrl+O.

  4. In the Open a Level dialog box, under Levels, Samples, choose Advanced_RinLocomotion, and then click Open.

  5. Choose Tools, Entity Inspector.

  6. In the viewport, zoom in and select the Rin character.

    
                        Select the Rin character in the viewport.
  7. In the Entity Inspector, ensure that Rin appears in the Name field.

  8. In the Entity Inspector search box, enter anim.

    
                        AnimGraph component properties for the Rin
                            character in the Entity Inspector.

    The AnimGraph component for Rin has four parameters:

    • movement_speed

    • movement_direction

    • attacking

    • jumping

    Changes in these parameters are replicated to other network peers after you add the Network Binding and Anim Graph Net Sync components.

  9. In the Entity Inspector, choose Add Component.

  10. In the Entity Inspector search box, enter Network.

  11. Choose Network Binding.

    
                        Adding the Network Binding component in the
                                Entity Inspector.
  12. In the Entity Inspector, click Add Component.

  13. In the Entity Inspector search box, enter anim.

  14. Choose Anim Graph Net Sync.

    
                        Adding the Anim Graph Net Sync component in the
                                Entity Inspector.

    The Anim Graph Net Sync component is added to the Rin entity.

    
                        The Anim Graph Net Sync component properties in
                            the Entity Inspector.

    By default, the Anim Graph Net Sync component synchronizes only the animation parameters. For greater precision, you can also choose to synchronize active nodes and motion nodes, which uses more network bandwidth.

  15. Choose File, Save or press Ctrl+S to save the level.

Running the Samples Project in a Server and Client Configuration

Now that you have added the Net Binding and Anim Graph Net Sync components to the Rin entity, you can test the synchronization by running server and game launcher applications.

To test the animation graph network synchronization

  1. In Lumberyard Editor, choose Game, Export to Engine, or press Ctrl+E to export your level to the Samples Project game launcher.

  2. In the message box that reports The level was successfully exported, click OK.

  3. Open a Windows command console on the lumberyard_version\dev\Bin directory that you are using.

    • For Visual Studio 2017, the directory is lumberyard_version\dev\Bin64vc141\.

    • For Visual Studio 2015, the directory is lumberyard_version\dev\Bin64vc140\.

  4. Run the following command to start the server:

    SamplesProjectLauncher.exe +mphost +map advanced_rinlocomotion
  5. Wait until the server game is running and the Rin character renders fully.

  6. Press Alt+Tab to return to the command prompt.

  7. Run the following command to start and connect the client:

    SamplesProjectLauncher.exe +mpjoin
  8. Wait until the client game is running and the Rin character renders fully.

  9. Press Alt+Tab to return to the server application.

  10. Use the following keys to control the Rin character:

    • To move forward, left, backward, and right, press the W, A, S, and D keys, respectively.

    • To look around, move the pointer.

    • To attack, press the left mouse button.

    • To jump, press the Space key.

  11. Observe how, as you move the Rin character in the server application, the Rin character in the client application performs the same movements as its counterpart in the server.

  12. In the server application, press the backtick key (`) to open the console, and then enter quit.

  13. In the client application, press the backtick key (`) to open the console, and then enter quit.