Skip to content

readyplayerme/rpm-unity-sdk-netcode-support

Repository files navigation

Ready Player Me Unity SDK - Netcode Support

This provides support for loading RPM avatar in a multiplayer application using Netcode and Ready Player Me Unity SDK. This can be used as a reference for anyone wanting to use Ready Player Me Unity SDK to create a multiplayer using Unity Netcode. It also provides a working samples:

  • Avatar Control - It showcases how to have a simple controls for avatar in a multiplayer game.

Note: These sample doesn't contain a completed games but rather a working example of a very basic multiplayer.

Requirements

Dependencies included in package

Installation

  • Copy git URL by clicking on green Code button and then by clicking on copy button as shown.

    image
  • Open Windox > Package Manager menu, click on Plus (+) button and select Add package from git URL.

    image
  • Paste the URL in and then click on Add button.

    image
  • After package installed you should see it under Ready Player Me block.

    image
  • After installation you will see a popup to import an assisting package to get support for Client Network Transform. Select ok to import the package.

  • For installing the package manually, copy the following url and past in Add package from git URL window in package manager.

    https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main
    

Testing the Sample Project

Avatar Control

  • Select Ready Player Me Netcode Support in Package manager and import the Avatar Control sample. image
  • Open the Avatar Control scene.
    image
  • Add the scene to build settings.
  • Run the scene, paste your avatar URL and click on start button.
  • Build the scene and run it on another device to observe multiple avatars in the same scene.
    image

Netcode API Used

  • Used for starting as host, server, or client.
  • Provides API for checking if isHost, isOwner, and isClient.
  • For spawning player and fireball.
  • A component which synchronizes the position of the owner client to the server and all other client allowing for client authoritative gameplay.
  • Synchronizes a property ("variable") between a server and client(s).
  • Used for syncing player avatar url, name.
  • A remote procedure call (RPC) that can be only invoked by a client and will always be received and executed on the server/host.
  • Used for spawning fireball on server when a client player fires it.
  • A component that synchronizes the state of an Animator between a server and client(s).

TODO

  • Fix player rotation sync.
  • Animation for fireball.

Known Issues

  • Avatar Partially Loading: If you did not use a Texture Atlas size selected in yout Avatar Config, you will receive avatar in multiple meshes and you might observe only eyes of the avatar being loaded and that you are getting an IndexOutOfRangeException: Index was outside the bounds of the array. error message. Multiple mesh avatars are not yet supported in the package so please use a config with atlas size selected.
  • Shared Access Violation Error: When you test your build locally, all the game instances will try to write avatar file at the same time due to first time download and cause a file read error. Even though remote players won't experience this issue it is troubling while testing your app. You might test with same avatars and after they are cached this issue should not occur.

About

An example of Netcode integration with Ready Player Me Unity SDK

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages