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

Resolved Networking architecture

Discussion in 'Netcode for GameObjects' started by rbitard, Nov 23, 2022.

  1. rbitard

    rbitard

    Joined:
    Jan 11, 2022
    Posts:
    197
    Hey everyone, I'm working on a turn based mutliplayer card game with netcode for gameobjects I'm wondering if one approach is better than another :
    A - I send the game board state to the client and the client send calls to the server (I clicked on that card, I played that card, ...) and the server handles the result and report backs
    B - Use network for gameobject to handle the Client/Server paradigm and use NetworkBehaviours everywhere needed instead of monobehaviours, but you need to handle NGO specificities
    I have the game state decoupled from unity so that's why I'm wondering what would work best in this case.
    Thanks in advance for your insight or questions if I'm not clear !
     
  2. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Hey @rbitard , I'd use approach A, having the players as the only NetworkBehaviours around
     
    rbitard likes this.
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    I second that. Rationale: card games are essentially GUI applications where the user does not control an avatar or army but rather creates UI events that then change state (rpc) and play animations that need not be synchronized between clients.
     
    rbitard and RikuTheFuffs-U like this.
  4. rbitard

    rbitard

    Joined:
    Jan 11, 2022
    Posts:
    197
    Yep, in the end I made my script that needs to talk with the server NetworkBehaviours, they call ServerRPCs.
    Server updates the core logic and dispatch the result using ClientRPCs. In the ClientRPCs I create the objects and handle the animations