Search Unity

Rotating multiplayer-scene as client

Discussion in 'Multiplayer' started by fritz-kola, Sep 19, 2017.

  1. fritz-kola

    fritz-kola

    Joined:
    Jan 4, 2016
    Posts:
    12
    This is more a design question more than a question on a specific problem. I'm implementing a real time strategy game, where minions spawning from the players base and running to the opponents base to make damage.

    First of all here is my hierarchy in Unity:

    -Scene
    --Ground
    --Player1
    --Player2
    --MinionFromPlayer1
    --MinionFromPlayer2

    So if I want to rotate the whole gameplay-scene, I only rotate the Scene-object.

    My Problem now is, when the player spawns a minion, which will be accordingly spawned in the opponents scene, the minion in the opponents scene will have a wrong position, if the opponent rotated the scene before spawning, because the Unity NetworkManager uses the position of the server.

    I can of course always correct the position after spawning on clients, but would that method be good? Then I only have to sync the RigidBodys over the NetworkTransform-Component and define the relevant variables (such as lifepoints) as SyncVar.

    But then I can imagine, that you can still see, that the positions don't sync, like when the minion on the server is attacking and dealing damage, you may see on the client that you take damage, while the minion is still running.

    So I don't really see a concept here. I just want that the clients are able to rotate their scene.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Why would you rotate the entire scene instead of the camera?

    Also only root gameobjects can have a NetworkIdentity component, so that would be your Scene object I suppose. You can only spawn objects with the NetworkManager that have a NetworkIdentity. I'm not sure what happens is you try to then make your spawned objects a child of your scene object.
     
  3. fritz-kola

    fritz-kola

    Joined:
    Jan 4, 2016
    Posts:
    12
    hmm, didn't mention that honestly :D
    I will try it out.

    For now, I'm already adjusting the parenting of the player-prefab via script.
    So I'm checking if isServer == false && isLocalPlayer == true to reset the parentobject of my player.