Search Unity

Where to begin with the new Networking system?

Discussion in 'FPS.Sample Game' started by RickWilliams, Nov 1, 2018.

  1. RickWilliams

    RickWilliams

    Joined:
    Aug 10, 2017
    Posts:
    4
    I am really liking what this project is about and how much it showcases- A holistic example of a game with pro implementation of many different aspects of Unity. The downside to such a large scale project is that it is difficult to gain meaningful context as to how the project was assembled in order to reverse engineer the mechanics.

    My (immediate) goal with the dissection of this project is to establish a most basic multiplayer game using the new Networking system... or to at least partially wrap my head around the transport layer and the scripts involved. I was able to build a couple decent multiplayer games with the UNet HLAPI, and had some understanding of the hierarchy of the Networking classes from top to bottom. My thoughts are that if I can follow along with the development of the new Networking API, I can digest it over time and have a deep understanding of how it works.

    As I've begun to dig into the project, I am having a hard time getting my bearings. There are a ton of Networking scripts all over the place, and where they are implemented is unclear.
    -------------------------------------------------------------TLDR----------------------------------------------------------------------------
    I am hoping somebody with experience in how this project is structured can point me in the right direction on how to dissect how multiplayer was implemented. All I really need is to create spheres with synced transforms that can shoot at each other, and build from there.

    If this project is not the best place to begin, I would appreciate a link to a more appropriate resource.

    Thanks :)
    - Rick Williams
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    1,305
  3. RickWilliams

    RickWilliams

    Joined:
    Aug 10, 2017
    Posts:
    4
    Thank you!
     
  4. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    157
    Unity.Transport is only a thin layer. The stuff built on top is really the chunk of what makes the Netcode.
    The Netcode is in Scripts/Networking and main points of interest are NetworkServer/Client. It's very versatile and unlike other network frameworks I have no code changes other than removing the Map sync which is annoyingly intertwined in an else if before Events.

    In that case. A replicated Entity with a moveable comp is enough. There's a MovableCube prefab which is a synced physic object. Then you need to bind another action in the UserCommand and have a system that spawns those and give it force.

    There's a server command,spawnBoxes that shows how this works.
     
  5. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    133
    @Trensharo check out Peter's networking video if you have not:


    Cheers