Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Resolved Networking architecture

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

  1. rbitard

    rbitard

    Joined:
    Jan 11, 2022
    Posts:
    68
    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:
    105
    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:
    1,617
    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:
    68
    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