Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Help] Client-Server separate and problem with state synchronization

Discussion in 'Multiplayer' started by GunLengend, Apr 13, 2016.

  1. GunLengend

    GunLengend

    Joined:
    Sep 24, 2014
    Posts:
    54
    Hello everyone,
    As what title said, i still confusing and turn around in deep-hole and get lost about one month in it. So i really need help.
    I would like to create client-server online game, and separate Client and Server to different project with each other, and for understanding, i don't using any NetworkManager and script from demo project.
    Why i do that ? I want client is always remote client, and server always dedicated server that mean no local client.
    - All communication until now i using custom message from MessageBase and it ok for me. But the problem come with spawn game object, sync with all remote client, i don't know how to do that.
    - The server just handle connection, message and send back to client so it just GUI only, then i want to ask that it MUST be share scenes at client ? Does it NEED TO DO IT ?
    - The client it a remote client, so how to sync movement, spawn, and etc to another client via server ? If i using transfer message base on MessageBase, it look so complicate than using SyncVar or Command. But i don't know how Server handle Command, because it separate different with Client. Can anyone help ?
    - AM I WRONG WAY ?
    @seanr : i need your help
     
  2. GunLengend

    GunLengend

    Joined:
    Sep 24, 2014
    Posts:
    54
    omg i still facing this problem
     
  3. ben-maurin

    ben-maurin

    Joined:
    Apr 7, 2016
    Posts:
    47
    I did not tried a separated server, but If you call Command on client on local player or object with authority then in this command set a syncVar or call a rpc, it should share it to all client I guess. For the spawn have you simply tried NetworkServer.Spawn(), (called on server via a command or a serverOnly trigger for exemple?).
    I don't see a big difference with a simple client/host but maybe I'm wrong.
     
    GunLengend likes this.
  4. GunLengend

    GunLengend

    Joined:
    Sep 24, 2014
    Posts:
    54
    At least you were reply my post. I just try to NetworkServer.Spawn and i don't think it appreciated in my situation.
    And still don't even know how to handle Command call from Client if i separate Server and Client differently.