Search Unity

DarkRift Networking 2

Discussion in 'Assets and Asset Store' started by Jamster, Feb 7, 2018.

  1. perevezentsev

    perevezentsev

    Joined:
    Nov 5, 2014
    Posts:
    10
  2. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Unfortunately, DarkRift does not work on WebGL at the moment, WebGL doesn't support TCP/UDP sockets.

    *Technically you can make it work on WebGL by writing a custom network listener plugin but I wouldn't recommend doing that if you're a new user!
     
  3. Ugochuks

    Ugochuks

    Joined:
    Apr 23, 2018
    Posts:
    6
    the embedded server doesn't seem to work on unity 2018 versions but works fine on unity 2017
     
  4. Ugochuks

    Ugochuks

    Joined:
    Apr 23, 2018
    Posts:
    6
    i guess it has something to do with the scripting runtime versions
     
  5. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    I've heard problems with this. Changing runtime to .NET 4.5. seems to work for people.

    I tried to debug the issue a few weeks ago and just couldn't reproduce it but I'll have another look :)
     
  6. Ugochuks

    Ugochuks

    Joined:
    Apr 23, 2018
    Posts:
    6
    I decided to go with the console server approach. I want to run it on Linux machine but i have no clue how to compile for Linux. A mini tutorial would be very helpful
     
  7. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    There are two approaches, if you're using the Free version then you can use Mono to run the server; if you're using the Pro version then you can use either Mono or .NET core :)
     
  8. perevezentsev

    perevezentsev

    Joined:
    Nov 5, 2014
    Posts:
    10
    Thanks. Unity LLAPI's NetworkTransport works in WebGL in case you'll consider that platform (although it's painful to use).
     
  9. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    I'd like to support WebGL eventually, but it's not high on my priority list at the moment I'm afraid!
     
  10. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Hey all!

    Since it's nearing the end of the year now I want to get feedback on how everyone's using DarkRift and where people want to see improvement. I've drawn up a 10-minute survey, mostly multiple choice, and I'd be very grateful for people to take some time to fill it out.

    This is a great opportunity to anonymously guide DarkRift's development and give feedback on things you do and don't like about everything DarkRift related!

    https://goo.gl/forms/gVqxNXcQDtcQdvHU2

    Jamie
     
  11. Ceciphar

    Ceciphar

    Joined:
    Jan 21, 2017
    Posts:
    51
    Done!
     
    Jamster likes this.
  12. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Don't forget to fill out the developer survey above if you haven't!
     
  13. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Exciting News!
    The latest results on the developer survey (see above to fill it out, last few days remaining!) say that 60% of you would be happy to contribute to documentation if it was open sourced.

    So this weekend has been spent converting the documentation from the old XML format used by Sandcastle to docfx's much nicer markdown format, and I'm happy to announce it's now open for contributions here:
    https://github.com/DarkRiftNetworking/DarkRift.Documentation

    You can preview the 2.3.1 docs in the new format here:
    https://www.darkriftnetworking.com/DarkRift2/Docs/2.3.1-docfx/

    As with the old documentation, it will be released at the same time as new DarkRift versions and historic versions will still be accessible. The next DarkRift release will be using this new documentation format.

    There's a lot of potential for work on the new docs including a nicer template, linking pages together more (it never got done because it was awful in Sandcastle), and possibly even merging in the Wiki if it makes sense.

    I hope this is an exciting prospect for everyone! Contributions welcome!
     
    LostPanda, theuncas and Ceciphar like this.
  14. EthanHooper1023

    EthanHooper1023

    Joined:
    Jan 19, 2017
    Posts:
    10
    Hello,
    I have been working with the unity engine for quite a while now with a few launched games but I'm new to any sort of networking. I have been wanting to develop an asynchronous game for mobile where player A takes a turn then "passes" it to player B who gets a notification for their turn to start. I can't seem to find many services that can help me along. Is DarkRift2 able to do this in Unity and if so where can I start.
     
  15. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Hi there,

    DarkRift can certainly do some of the work! DarkRift can handle the networking side of things once you're in the game (and it would do that pretty easily by the sounds of it!) but it doesn't support things like push notifications so you'd need an additional asset/service to do that part for you :)

    If you want to get started then there's a tutorial on the website here!

    Jamie
     
  16. EthanHooper1023

    EthanHooper1023

    Joined:
    Jan 19, 2017
    Posts:
    10
    Great thanks! and just to be sure what about sending short recorded audio messages for them to be played when player B joins.
     
  17. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Short audio messages should be fine for your use case. With DarkRift 1 I did at one point have a decent VoIP demonstration going, and the Dissonance voice chat asset can use DarkRift 2, audio shouldn't be a problem!
     
    Willbkool_FPCS likes this.
  18. bingofly

    bingofly

    Joined:
    Sep 15, 2018
    Posts:
    24
    Hi Jamie,
    About "Bi-channel UDP and TCP for reliable and unreliable communication", dose it support reliable-UDP?
     
  19. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    The bichannel UDP/TCP uses UDP for unreliable and TCP for reliable traffic, so there's no RUDP involved. However, if you need RUDP it's possible to swap the bichannel listener for your own listener based on ENET or something!
     
  20. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,421
    I was really excited about DarkRift, its a pity about WebGL not being supported :(

    I thought WebGL just used websockets over TCP?
     
  21. bingofly

    bingofly

    Joined:
    Sep 15, 2018
    Posts:
    24
    Hi Jamie,
    Thanks for reply.
    After reading the doc and test some demos, I'm very intrested in DarkRift and wanna use it in my indie multiplayer game. Of course I should add my own listener by myself, but the truth is I'm really new to any sort of network. By some tests I found the RUDP is better for network synchronization than the UDP or TCP in my game. Is there any possibility that you could add listener base on RUDP in the DarkRift Pro? So I can buy it and use RUDP :)
     
  22. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    You're right in that it uses websockets over TCP but the problem is that DR's default bichannel listener isn't compatible with the added websockets layer. It is certainly possible to get DarkRift working with websockets by building your own custom listener, there's just no websockets listener provided out of the box yet.

    So it's possible, just requires more advanced work than normal!

    Adding RUDP support via ENet or Hazel isn't too bad an idea for Pro actually! I would recommend that you start with the default bichannel listener and when you get to a high enough confidence level, then try implementing an RUDP listener. Your game logic wont change at all so switching to a different listener would be an easy upgrade!
     
    Meltdown likes this.
  23. Andrius32

    Andrius32

    Joined:
    Nov 27, 2018
    Posts:
    17
    Hello. I have question how to connect this server with database? I just find out Dark Rift 2 dont need connector... and i dont rly know anything about servers and basic knowledge about databases. And i cant find any tutorials how can i do this....
     
  24. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift plugins are just C# code, essentially you can do anything you can do in C# in a DarkRift plugin in a pretty similar way. With that in mind, you should be able to modify any decent database-C# tutorial to DarkRift pretty easily (provided you have a little C# experience).

    Without knowing what you're building it's hard to really recommend the right database so I suggest read around and do plenty of research, find a tutorial, and then once you've done the tutorial, think about moving it over to DarkRift!
     
  25. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift 2.4.0 has been submitted to the asset store!

    Firstly, sorry about the lack of transparency, updates and general information about this release. I've had very little time, some horrendous bugs (just because of the nature of this update!), Christmas, illness, and then even more bugs all since the last release!

    This is a huge release, and has some really awesome feature in though, so I hope it's worth the wait!
    Firstly, you can now easily measure round trip time to the server or client. *Almost* all of the byte arrays DarkRift uses behind the scenes are now recycled (hence the tonnes of horrendous bugs I've had!) New system tests have been added to make development a bit easier, and many of the unit tests have also seen improvements. And the sniffer has had an update and can now output the data it sniffs.
    Check out the full list below!

     
    LostPanda likes this.
  26. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Hey all,
    There are currently some issues with the new build in the recycling of byte arrays internally. If you find you're now getting random `NullReferenceExceptions` from `ObjectCache.ReturnInstance` then try adding the following line to your server configuration:
    Code (CSharp):
    1. <cache
    2.     maxAutoRecyclingArrays="0"
    3. />
    If you're getting exception son the client side I'm afraid I have no fix for you at the moment!

    If anyone finds any other issues don't hesitate to let me know!
     
  27. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift 2.4.1 has been submitted to the asset store!

    This update is essentially a mass of bugfixes, most of which were introduced in 2.4.0! Special thanks to Deusald for finding almost all of them aha :)

     
    LostPanda likes this.
  28. Ruslank100

    Ruslank100

    Joined:
    Apr 11, 2018
    Posts:
    11
    Hello! I am making a game with photon, but it looks like it would be too expensive to handle it with it(if I would release it). So I am thinking that maybe I need to switch to something without CCU limit(like Dark Rift). Currently I have tanks(they can move, shoot so it works nice). Should I remake everything to Dark Rift, or leave it as is?(I am a beginner, so I am afraid that I will break everything..)
     
  29. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Up to you really! The best advice I can give to you is to do the DarkRift tutorial and see what you think, then duplicate/branch your project and start working on a DarkRift version. If at any point you decide you no longer want to switch then just go back to the old version!

    Jamie
     
  30. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift 2.4.1 is now available on the asset store!
     
    LostPanda likes this.
  31. Ruslank100

    Ruslank100

    Joined:
    Apr 11, 2018
    Posts:
    11
    Thanks for the reply, I think that I should try to switch my game to Dark Rift. But I guess I will need a lot of help!
     
  32. monsieur_alpha

    monsieur_alpha

    Joined:
    Feb 24, 2019
    Posts:
    1
    Hi Jamie,

    I was just testing to see if DarkRift would connect to Hamachi instead of localhost and it seems to be now struggling and not even starting, any suggestions?

    Thanks
     
    Last edited: Mar 14, 2019
  33. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    I think you reached out in the Discord server and had some responses there so I'll just continue the conversation there! :)
     
  34. Polemus

    Polemus

    Joined:
    Nov 14, 2016
    Posts:
    23
    Looking at Unity's FPSSample, They have some pretty neat UDP Pitfall workarounds, like packet loss and packet order compensation.

    Would you consider looking at the code and implementing something like that into dark rift at some stage? i know DR is low level, but these are fairly important items.
     
  35. Polemus

    Polemus

    Joined:
    Nov 14, 2016
    Posts:
    23
    oh no!!! did i miss the sale?
     
  36. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Hi @Polemus,

    Those are both commonly requested features. DarkRift currently, by default, uses TCP and UDP channels so you can already send reliable packets via TCP, furthermore you can build a custom NetworkListener plugin and make DarkRift operate using another UDP library if you really need reliable UDP (there's already an ENET one available)!

    Message order is trickier with DarkRift. Because DarkRift is very multithreaded at the moment having any form of sequencing on packets would damage performance quite significantly. Even if you send via TCP in the default network listener you're not guaranteed to receive the messages in order with DarkRift!

    You can build simple sequencing systems on top of DarkRift, and I generally recommend that because you can usually get a lot more flexibility at the loss of a lot less performance :)

    I hope that helps!

    P.S. I have no idea if there was a sale or not, Unity don't tell me!
     
  37. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift 2.4.2 has been submitted to the asset store!

    This has some initial fixes and refactoring for the issues we've seen since 2.4.0, most notably this fixes a bug where the wrong sized memory was returned from the cache and a bug where the cache wasn't getting enabled properly.

     
    LostPanda likes this.
  38. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift 2.4.2 is now available on the asset store!
     
    LostPanda likes this.
  39. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Hey guys! This week, I've mostly been doing some stuff on the website in order to get a repository of previous versions up. I wanted to make sure this would work not just for free users but also pro users (you guys paid me after all!) so that's why it's taken a little time. If you want to get your hand on previous versions you can now do so here:
    Code (csharp):
    1. https://www.darkriftnetworking.com/DarkRift2/Releases/Free/<version number>.unitypackage
    2. https://www.darkriftnetworking.com/DarkRift2/Releases/Pro/<version number>.unitypackage?invoice=<your invoice number>
    For example:
    Code (csharp):
    1. https://www.darkriftnetworking.com/DarkRift2/Releases/Pro/2.4.0.unitypackage?invoice=IN7596032287
    There's only a small set of versions available though I'm afraid, I just haven't remembered to keep an export of each version. The following are available currently:
    Code (csharp):
    1.  
    2. 2.1.0 (Pro only)
    3. 2.1.1
    4. 2.1.2
    5. 2.2.0
    6. 2.3.0
    7. 2.3.1  (Free only)
    8. 2.4.0
    9. 2.4.1
    10. 2.4.2
    Hope you enjoy it! :)
     
  40. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
    I see Discord mentioned, but I cannot seem to locate the server, what's the server name?
     
  41. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    LostPanda likes this.
  42. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
    Thanks Jamster :)
     
  43. ExDeaDguY

    ExDeaDguY

    Joined:
    Aug 25, 2009
    Posts:
    487
    Is it at all possible to use references within the plugins? Such as adding the nuget package newtonsoft.json and then referencing and using that lib within the plugin? I can build successfully but after I bring the DLLs over to the plugins folder and run, everything craps out. Any ideas? Or is this not supported?



    EDIT: Nevermind, I figured it out. Something near the json code was breaking causing the fault. Sorry about that.
     
    Jamster likes this.
  44. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift 2.4.3 has been submitted to the asset store!

    This version fixes a few of the major bugs with message corruptions, improves performance for the .NET Core build, and a few other smaller things. There are definitely still some major bug lurking but I want to get this out to help stabilise your development as soon as possible!

    The update is already available on the website here:
    https://www.darkriftnetworking.com/DarkRift2/Releases/Free/2.4.3.unitypackage
    https://www.darkriftnetworking.com/DarkRift2/Releases/Pro/2.4.3.unitypackage?invoice=<your invoice number>

     
  45. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift 2.4.2 is now available on the asset store!
     
    DroidFelt and LostPanda like this.
  46. DroidFelt

    DroidFelt

    Joined:
    Dec 13, 2015
    Posts:
    3
    Hi! I'm new to DarkRift2 and I'm trying to set up the unity embedded server. Server and Client works as expected. My question is, is there a way to broadcast once the server starts and the client to listen for broadcasts? Or what is the way you suggest for setting up a local-multiplayer game when devices are connected to the same network?
     
  47. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    Hey!

    I'm not sure I'm quite clear on what you need here, are you asking for a way for clients to discover the server to then connect to it, or are the clients already connected to the server and you're just starting the game?

    The former DarkRift doesn't support without delegating that to your code to do but the latter sounds like it's simply a for loop iterating over each client sending a 'start' message to everyone :)

    Jamie
     
  48. DroidFelt

    DroidFelt

    Joined:
    Dec 13, 2015
    Posts:
    3
    My question was about the former. Does DarkRift provide LAN capability? If so, what is the best way you'd suggest to connect two mobile devices in the same wifi network?
     
  49. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    DarkRift will work fine over LAN with a PC as the server but it sounds like you're intending to have the server on one of the mobile devices which isn't supported.

    If that is the case then you would probably want to host a relay server in the cloud for the two mobile devices to connect to and communicate via.
     
  50. Aerhart941

    Aerhart941

    Joined:
    Apr 7, 2019
    Posts:
    31
    Does this work on MacOSX. I unzipped the server and they were EXE files