Sync Child/Parent relationships with MLAPI

Ground Enemy Parent/Child structure
Ground Enemy sync’d in world space

Sync Parent/Child Relationship

Since the Network Transform does not sync the parent/child relationship I chose to implement this with a Client RPC call. But the game objects do not share their unique instance identifiers across networked machines. So how can the server say to the client, “You must parent X to Y”? Whilst Unity may not have a guaranteed identifier, MLAPI does share the network object Id. When Id 99 is created for object X on the server, then all the clients will have an object X with Id 99. Since the enemy object we are spawning already has a Network Object, the missing part of the puzzle is to ensure that the Parent also has an Network Object.

Parent And Child with Network Objects
Re-parenting RPC
Problem with re-using from Pool
Pooled objects working

Logram Firing

The Logram plays an animation of its turret opening and a bullet emerging from it. The bullet only emerges at a certain point within the animation track. This is achieved with using an Animation Signal. However, animation signals are not synchronised with MLAPI. Not to worry, we “just” need to add another RPC call.

Logram client firing
Logram animated firing
  1. The bullets are not yet shared.
  2. Currently each Logram only knows about the local player. Therefore the Lograms for Player 1 fire at Player 1, the Lograms for Player 2 fire at Player 2.

Next up

  • Making the enemy aware of the players
  • Share/Sync the bullets

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store