Search Unity

Unity Multiplayer RakNet Networking Solution

Discussion in 'Connected Games' started by warfaredev, Jun 25, 2019.

?

Did you like the demo?

  1. Yes

    11 vote(s)
    100.0%
  2. No

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
    Hello! When developing my game, I was faced with the fact that the Unity engine does not have a stable network (removed uNet), and I had to make my network solution based on the RakNet cross-platform network engine ...
    The engine itself is quite simple to use, there are no unnecessary functions ... In fact, what does a developer need? Just send and receive a packet from the client to the server or vice versa ... In general, I prepared a demonstration of my game, in which I applied this network engine and put the client and server in one application ...



    What has a demo?
    - ConVars (client & server side)
    - Debug Console (Key - F11)
    - Network Info (Key - F5)
    - Chat Commands (/help - for show all available commands)
    - Dedicated server console (for run use -batchmode argument)
    - Client Prediction & Server Reconcilliation (Lag compensation)
    - Low traffic consumption















    Demo Download link: https://drive.google.com/open?id=1yoowdbUcaKexBW8XfB7jkEQmlkV_VTBn


    See Github: https://github.com/ep1s0de3/RakNet_Networking

    WARNING! When importing RakNet.dll in your project toggle checkbox on x86_64
     
    Last edited: Jul 15, 2019
    akuno and TiToMoskito like this.
  2. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
    Wow! Watch video :)
     
  3. Dareheim

    Dareheim

    Joined:
    Oct 12, 2013
    Posts:
    7
    So what? Let's source:D
     
  4. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
    I am still adding code to make it convenient and understandable to use in your projects ... I will post it when end writting:) (in a couple of days)
     
  5. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
  6. TiToMoskito

    TiToMoskito

    Joined:
    Jan 28, 2014
    Posts:
    31
    Thank you very much, would you share the server console part?
     
  7. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14

    I am still writing my project, when I finish with it I will lay out the source code on github
     
  8. F-R-O-S-T-Y

    F-R-O-S-T-Y

    Joined:
    Mar 22, 2013
    Posts:
    197
    Nice job. I wonder why was RakNet deprecated.
     
    warfaredev and akuno like this.
  9. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    25
    I wish Unity stopped "experimenting" with their networking tech and properly integrated latest RakNet as "basic" networking level. Then build the rest (HLAPI) on top of that.

    RakNet is high-performance, stable networking library, which powers a lot of games. It's reliable and proven by time. I consider it industry standard.

    I don't like current "void", UNet is depracated, LLAPI will be depracated and current state of new tech is unusable (e.g. more than 32 packets waiting = silent dropping them - new Unity Transport). Couldn't they keep HLAPI and LLAPI little longer, fixing bugs until new tech is ready?

    We have successful product on Steam Early Access and currently facing decision what tech to use to implement multiplayer (we postponed the decision as long as we could). I've tested UNet few years ago and wasn't happy with it. We want something which can be deployed on demand by us and by community (dedicated servers) - no hosted solution. Also we're likely to write our own high-level tech on top of whatever we end up using.

    I'm slowly starting to think that best solution for us will be what author of this topic did (with Linux / Mac support)

    EDIT: There's one interesting thing, Valve open-sourced their API and networking library they are using for DOTA and CS:GO. It's part of SteamSDK, which we already integrated (but can be also used without it and works well with dedicated servers). The bonus feature is that non-steam version (GOG, Discord store, other platforms) of your game can use it and connect to Steam version of your game.

    More info:
    https://partner.steamgames.com/doc/api/ISteamNetworkingSockets
     
    Last edited: Jul 8, 2019
    warfaredev likes this.
  10. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
    because the developers of the engine supposedly made a new network called uNet in 2014 or 2015, and deleted RakNet which was part of Unity3D ... And now there is nothing at all, neither RakNet nor uNet ...
     
  11. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
  12. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,781
    Hey guys im trying to send an image from the server back to the client but it wont be received if its above some certain threshold, i tried increase the maxbandwitth but im never actually to receive these packets on the client


    Okay never-mind I was sending it wrong. Thats what we need a low level library that we can actually use to do various things, I spent a few days trying to get photon to send/receive images from and to the server for the purpose of "streaming content" and couldnt do it because its too overegineered for 1 thing

    Okay I was having some problems getting to run as an exe but fixed the problem by looking at the logs and determing you had to select x86_64
     
    Last edited: Jul 12, 2019
  13. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
    So large arrays of bytes need to be sent not entirely but in parts, otherwise the network stream will be suspended until the whole array is transferred ... And by the way, it is recommended to send such arrays not over one channel but over several ...
     
  14. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14
    Watch my new videos... :);)










    I rewrote most of the network code and now there are fewer lags. everything is done not in a while loop but in the FixedUpdate method



    As you may have noticed, I create false delays and network packet loss ... The Clumsy 0.2 program helped me in this.
     
    Dareheim likes this.
  15. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,781
    I came up with a better method, instead of sending back images which was nonsense instead im going to actually stream video -- which might be better
     
  16. Litwin

    Litwin

    Joined:
    Aug 15, 2013
    Posts:
    58
    Amazing!! :p

    Are you using SLikeNet or original RakNet from github of the Oculos VR? You plan to release in github with features interpolation, predictions and etc?

    Thanks.
     
    Last edited: Jul 21, 2019 at 5:13 PM
    warfaredev likes this.
  17. warfaredev

    warfaredev

    Joined:
    Dec 24, 2015
    Posts:
    14

    I use the original RakNet

    In the near future I will lay out the entire source code of the project on the github ... I can not say the exact date
     
    Litwin likes this.