Search Unity

What are the most basic building blocks for learning networking?

Discussion in 'Multiplayer' started by DangerSnoot, Nov 28, 2018.

  1. DangerSnoot

    DangerSnoot

    Joined:
    Nov 23, 2009
    Posts:
    213
    There are a huge number of resources out there for learning networking in Unity, and although I've been successfully able to make multiplayer work with the tutorials and resources available for UNet, I still don't 'get it'. I can make a bunch of stuff function more or less as I want it to, but it's largely monkey-see, monkey-do so I still have little to no appreciation of what's going on under the surface. Therefore what I'd like to do next is gut most of the helpful UNet tools and try making some networking as much from scratch as I can as a learning experience, even if it's not really especially functional for my current game project.

    What are the most basic components of networking that I should start out really understanding, in what order should I try to tackle them, and do you know any good resources that try to demonstrate it all more fully, rather than just showing you the easiest way to get from A to B?

    I hope that kind of makes sense anyway - I feel a bit like I'm blindly doing alchemy here instead of chemistry, because although the existing recipes are well written and easy to replicate I haven't a hope in hell of adapting them or creating my own until I figure out their underlying workings.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If you want to learn from the ground up, take a look at the Socket class. Try getting that to work for some basic communication, and then try building your own system on top of it.
     
  3. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    You can go straight to the bones and write everything from scratch using the `Socket` class, as @Joe-Censored suggests, and then also access all the worlds c-sharp doc/tutorials for such. If that is too big a leap, you can look at Unity's LLAPI for a, well, lower-level networking system (but not as low as raw-sockets) - http://www.robotmonkeybrain.com/good-enough-guide-to-unitys-unet-transport-layer-llapi/ . If that is interesting you could also look at this LLAPI-wrapper i did for further examples of a way to work with LLAPI, and how it works: https://github.com/hyakugei/UnetLLAPIWrapper . For other "real" networking learning, i'm a big fan of Gaffer-On-Games (https://gafferongames.com)... Oh, and i'd be remiss to not suggest reading the source for the HLAPI, although Unity's code for it is a bit of a nightmare, the Mirror project's update is easier to follow. And that way you get an "under-the-hood" idea of how the things you are using work, at a lower level.

    Good Luck!
     
  4. Jack-Mariani

    Jack-Mariani

    Joined:
    Jul 12, 2013
    Posts:
    10
    I would not start from socket because I think there are multiple layers in a network and in some cases you can ignore them.

    If you want to have insights of network I would surely start with this.
    https://leanpub.com/development-and-deployment-of-multiplayer-online-games-vol1

    Then, if you're an indie (or you do not want to start from scratch anyway) you can start with some of the libraries and I suggest to familiarize with one or two of them. It's great for learning anyway.
    You can find the benchmarks here
    https://github.com/nxrighthere/BenchmarkNet/wiki/Benchmark-Results

    Unity LLAPI is a choice, but since is going to be deprecated I would choose another library with a bit more future.

    After these 2 steps if you want to deep dive you can find lot of resources here:
    https://github.com/MFatihMAR/Awesome-Game-Networking