Search Unity

PvP turn-based LAN game Unet architecture.

Discussion in 'UNet' started by zazoum, Mar 19, 2018.

  1. zazoum

    zazoum

    Joined:
    Sep 3, 2011
    Posts:
    78
    Hello.
    I'm building 1vs1 pvp turn-based tile-based Unet game for LAN with 2 characters in possesion of each player (a mage and a knight just for starting demo). I want it to be light on server to clients and clients to server messaging. I DON'T want animation synchronization. It doesn't matter. So I was thinking the following architecture:

    - Host is server and client.
    -Second client joins the match.
    -The four characters (2 for each player) are set as a SPAWNABLE object. Not player object.
    - The player prefab is an empty object full with code for each player to: 1)get Network ID, 2) Assign the two characters to his possession 3) send [Commands] to server.
    - Server controls the 4 characters by input of clients and transmits the outcome of action to clients via Rpc functions. I repeat, I DON'T care about transform , Rigidbody or animation synchronization. I just want the messages being sent back and forth.

    Do you find it logical and achievable?
    What Network authority do the 4 spawnable characters have? What is the state of the two check-boxes for each of the spawnable character in his NetworkIdentity component? Server authority or both server and local unchecked?

    Any thoughts on the matter are welcomed.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    That's a reasonable setup. I do something similar in my game, even though my game is nothing like yours.

    You would leave both boxes unchecked on all NetworkIdentity components. So you end up with server authority over everything. You don't want to check the Server Only checkbox because that prevents it from spawning on the clients.
     
    zazoum likes this.
  3. Aerhart941

    Aerhart941

    Joined:
    Apr 7, 2019
    Posts:
    61
    Any further info on this? Is there a tutorial or anything? There is so little documentation for turnbased Unet games. Everything is an FPS but I am having a hard time figuring out how to send the information you mentioned (outcomes) and controlling multiple characters.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The further info is Unet was deprecated a year ago. No one is making tutorials since then for it, and there's not a lot of constructive discussion on Unet anymore.

    But Unet doesn't really differentiate between different game types. Turn based, FPS, RPG, doesn't really change much how you'd use Unet. You've still with the HLAPI have GameObjects with NetworkIdentity components that you spawn on the server, communicate via Commands, Rpc's and SyncVars, and can send Unet Messages when you want to communicate outside of the constraints of the object authority functionality. Turn based game functionality is something you build yourself, and use the above functionality to keep all clients in sync.

    If you're just now trying to learn Unet though, do yourself a favor and don't. Choose a network API which still has life left.
     
  5. Aerhart941

    Aerhart941

    Joined:
    Apr 7, 2019
    Posts:
    61
    Thank you for the guidance. What is the best/ easiest to use for a turn based game with multiple characters to control?
     
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847