Search Unity

[SOLVED] Getting Started on Networking

Discussion in 'Multiplayer' started by Ricardo_Reis, Apr 8, 2018.

  1. Ricardo_Reis

    Ricardo_Reis

    Joined:
    Oct 15, 2017
    Posts:
    13
    Hey guys!
    So I finished a basic version of my game and am gonna start developing the network, however I need an opinion on this.
    Basically I've been seeing a lot of tutorials on making a Server and so far it's good, however I'm worried that I'm biting more than I can chew.
    What I'll need for my game:
    • At least a max of 20-30 players, even though the number I'd love to reach is somewhere around 80-100
    • The game is a 3D First Person RPG, with weapons(like an FPS) and where the players can greatly change the enviroment so the connection needs to be moderately fast.
    • I need to be able to connect to a DB where I'll store all the client info
    With that in mind I wanted to know from anyone with experience in this area if I should use Unity's Networking for simplicity and to avoid security problems and stuff like that, or if I really should invest in making my own networking.

    And thanks in advance for any advice!
    EDIT: Some more info that might be useful, I know my way around programming however I know only the basics of Networking (IP addresses, TCP/UDP, Sockets)
     
    Last edited: Apr 8, 2018
  2. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    I think your first step is to figure out the minimum required amount of data to fully sync your scenes, then deciding based on that.

    You want your logic to work so that the server only has to trigger small events that then clients can then run on their own. For example, I spent a few hours trying to figure out how to make bullets firing out of a gun consistent and have them interact correctly. I eventually found that the bullets spawning was completely irrelevant and all that mattered to be synced was a boolean on the gun which said if the trigger was pulled, the client could do everything else because everything that happened after the trigger was pulled was deterministic.

    So find all of your behaviors and group them into deterministic things (physics, navmesh...) and things that are fully dynamic (mostly dealing with player, maybe some RNG.)
     
    Ricardo_Reis likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,631
    Your first task will be determining what networking architecture you want to use. What you described could be implemented in a number of ways, from player hosted matches, to player set up dedicated servers the players would browse, to you hosting a series of dedicated servers, to you hosting a cluster of servers in a distributed world like an MMO.

    Once you've figured that out, then I'd start looking at what the various networking API's and networking services have to offer that matches your requirements.
     
    Ricardo_Reis likes this.
  4. TwoTen

    TwoTen

    Unity Technologies

    Joined:
    May 25, 2016
    Posts:
    1,167
    I agree to this. Implementing the low level bits is not neccecary IMO. Plenty of good reliable UDP libraries if that's what you are looking for. As for higher level things, there are just a few as far as I know

    HLAPI - by Unity, abandoned
    HLAPI Pro, fork of HLAPI
    HLAPI ext, fork of HLAPI
    MLAPI, alternative to HLAPI
    Photon (I think it has a few limitations. Not too read up on it tbh)
    Forge (Idk the status of the project)

    Or, if you need performance or have other specific requirements, I would build my own layer on top of a Low level UDP socket.

    The higher level API's are for abstraction with common features, such as object spawning, sweet variable syncronization and other "fancy" features. Many of which you will probably need anyways
     
    Ricardo_Reis likes this.
  5. Ricardo_Reis

    Ricardo_Reis

    Joined:
    Oct 15, 2017
    Posts:
    13
    So far I decided on having multiple Servers (map is medium-sized so I don't think there's any need for multiple Servers for an instance of a game).
    I really wanted to avoid any paid solutions since I think the servers on their own are going to cost me a bunch... which is why I started researching into making my own networking, however I think I'll use Unity's Networking and HLAPI since it's the one I find the most tutorials and documentation.
    Thanks for the help guys!!
     
  6. TwoTen

    TwoTen

    Unity Technologies

    Joined:
    May 25, 2016
    Posts:
    1,167
    Right, I do still suggest you to read around and activly look about before making your desicion. Many are left dissapointed by the many bugs and 0 support or fixed from Unity.
     
unityunity