Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

DarkRift Networking 2

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

  1. Deleted User

    Deleted User

    Guest

    Is it possible to assign a value to the onConnected() parameter "object sender" from the client
     
  2. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    It is not I'm afraid, the 'sender' parameter is a .NET standard practice and always contains the object that triggered the event. You can always send a message once the client has connected containing whatever you need!
     
  3. knxrb

    knxrb

    Joined:
    Dec 16, 2018
    Posts:
    16
    Hello,

    Are the Inter-server Communication and Area of Interest System (Helper) features available in Pro yet? On the website they say coming in 2019 and 2020 respectively, but I don't see them as confirmed anywhere on the store page or documentation.
     
  4. chrisx84

    chrisx84

    Joined:
    Nov 9, 2011
    Posts:
    84
    hey sorry for the long delay in reply, by default VS 2017 wants to debug the client, switching to Server.Console works for a successful build. Thanks Jamster now i can get back to making a MMO.
    Still got the same .NET 2.1 error when trying to compile, debugging right in VS works just fine.
     
    Last edited: Jul 22, 2020
  5. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    DarkRift 2.7.0 is now available on the website!
    This release primarily adds the new metrics system for pro users: You can now integrate your DarkRift clusters with your OPs centres and monitoring systems, take advantage of Kubernetes horizontal auto scalers and visualiser your servers using Prometheus (built in) or any other metrics system.

    We've curated a dashboard in Grafana to get you started!
    https://github.com/DarkRiftNetworking/grafana-dashboards

    This release also contains a number of bug fixes and performance improvements!

    The update is already available on the website here, or through the DarkRift CLI tool!
    https://www.darkriftnetworking.com/DarkRift2/Releases/Free/2.7.0.unitypackage
    https://www.darkriftnetworking.com/DarkRift2/Releases/Pro/2.7.0.unitypackage?invoice=<your invoice number>

     
    Last edited: Aug 12, 2020
    knxrb likes this.
  6. knxrb

    knxrb

    Joined:
    Dec 16, 2018
    Posts:
    16
    The clickable URLs for the downloads are pointing to the v2.6.0 version of the package. Here's fixed links for those wanting them:

    Free: https://www.darkriftnetworking.com/DarkRift2/Releases/Free/2.7.0.unitypackage
    Pro: https://www.darkriftnetworking.com/DarkRift2/Releases/Pro/2.7.0.unitypackage?invoice=<your invoice number>
     
  7. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    Whoops! Thanks for that, fixed!
     
  8. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    DarkRift 2.7.0 is now available on the Asset Store!
     
    LostPanda likes this.
  9. zeiksz

    zeiksz

    Joined:
    Mar 10, 2019
    Posts:
    5
    Hi!

    My usecase is "server maintenance", that client is on autoconnect and server is down. Client is starting up and of course autoconnects. It can not, because there is no server. But later on I will start the server too. Client is unable to connect AND stays in "connecting" state.

    If I want to manually ".Connect(...)" the client .NET socketexception is thrown.

    Is there a way to make client retry connecting or just forget it's connecting state or get a proper timeout or... something?

    Thank you for your help:
    Péter
     
  10. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    Hi Péter!

    Does the issue you're seeing look like this bug?

    I don't really know a good workaround for the moment, if you can catch the exception and recreate the UnityClient that might be the best bet until it's fixed.

    Jamie
     
  11. zeiksz

    zeiksz

    Joined:
    Mar 10, 2019
    Posts:
    5
    Hi Jamie!

    Thank you for the support!
    Yes and the exception message is the same as well.

    Workaround I tried and failed so far: disabling and enabling the component (does nothing, because the UnityClient is created in the Awake), repeating the Start method (leads to the Exception), disabling the whole object and enabling it only after the server is awake (works, but kills purpose of detecting maintenance), maybe some others but forgot them.

    What I will try then: re-creating the whole component on GameObject.

    Thanks:
    Péter
     
  12. zeiksz

    zeiksz

    Joined:
    Mar 10, 2019
    Posts:
    5
    This will do the trick as "workaround" for previous:

    Code (CSharp):
    1.    
    2. //[SerializeField]  UnityClient kliens;
    3. //...
    4.  
    5. if (kliens.ConnectionState != ConnectionState.Connected)
    6.     {
    7.       IPAddress ip = kliens.Address;
    8.       ushort port = kliens.Port;
    9.       Destroy(kliens.gameObject.GetComponent<UnityClient>());
    10.       kliens = kliens.gameObject.AddComponent<UnityClient>();
    11.       kliens.Address = ip;
    12.       kliens.Port = port;
    13.     }
    Of course it is not a full solution, it copies only the IP and the port.
    Péter
     
  13. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    116
    hi
    quick question. I use playmaker to build my games, how easy/hard would it be to use darkrift 2 with playmaker? i plan on making a 'battle royale' game along the lines of fortnite/PUBG/warzone etc with 100 players per game (room).

    thanks
     
  14. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    346
  15. hugopok

    hugopok

    Joined:
    Mar 30, 2016
    Posts:
    38
    Hi this library can be deployed on ps4 and nintendo switch ?
     
  16. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    Apologies for the late reply to everyone, I haven't been receiving notifications for some reason!

    I'm afraid I haven't used Playmaker before so I can't really comment. DR is very programmatic so if it Playmaker allows you to make arbitrary C# calls then I suspect it will work, though I don't know how easy that will be!

    I know some people in the community build for consoles but I don't know which consoles they are nor how easy they are to build for. DarkRift isn't tested on consoles so I won't make any claims for it to work on them! The best advice I can suggest is to just try it with the free version!
     
  17. silchuks969

    silchuks969

    Joined:
    Sep 18, 2020
    Posts:
    1
    DarkRift 2.7.0 unity server outputs this error " HttpListenerException: Listener closed" when shutdown. any fix?
     
  18. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    I think this is a bug that will be fixed in the next version. If you're not using the HTTP health check or the Prometheus metrics (pro) you could disable the associated plugins (HttpHealthcheck/PrometheusEndpoint) to stop the errors ocurring.
     
  19. tungqlvip

    tungqlvip

    Joined:
    May 7, 2018
    Posts:
    5
    I have an error.Occasionally, the client will not receive a response from the server. but that client still sends the message and the server still receives them.
     
  20. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    Strange. The only way I can imagine that ocurring is if the update loop in UnityClient has stopped. Have you modified any of the DarkRift files? Are there any disconnection logs output either end?
     
  21. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    DarkRift 2.8.0 is now available on the website!
    DarkRift 2.8.0 being the beta of server clustering (formerly referred to as inter-server communication) as well as a few bug fixes!

    Check out the docs to get started with the server clustering beta here!
    https://www.darkriftnetworking.com/DarkRift2/Docs/2.8.0/advanced/clustering/index.html

    The update is already available on the website here, or through the DarkRift CLI tool and will be available on the asset store in the coming few days!
    https://www.darkriftnetworking.com/DarkRift2/Releases/Free/2.8.0.unitypackage
    https://www.darkriftnetworking.com/DarkRift2/Releases/Pro/2.8.0.unitypackage?invoice=<your invoice number>
     
    letscodestuff and knxrb like this.
  22. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    49
    If I authenticate the user via php and then I connect them to the Dark Rift server how would php pass the userID to Dark Rift so I can access the database based on their ID through Dark Rift?

    Obviously I shouldn't let the client pass the userID to the server since that would be a security risk. It should all be done on the server side. Is there a recommended way for php to send a variable to Dark Rift?

    Which part of the documentation should I be looking at?
     
  23. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    DarkRift 2.8.0 is now available on the Asset Store!
     
  24. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    Usually the best way is to return the user a token of some form, such as a JWT (JSON Web Token) or some randomly generated short-lived token. That token can then be handed to the DarkRift serverto prove the client is who they say they are.

    JWTs are signed to be from your server so the client can't modify them in a way accepted by the server, short lived tokens are just randomly generated so can't be spoofed! There are plenty of other ways to do it as well, personally though I'd lookat a JWT I think as I've used them before!
     
    BitPax likes this.
  25. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    49
    Is there a way for php to just send the variable data directly to Dark Rift?

    EDIT: Actually I think I understand. I'll go try it out and report back later. Thank you!
     
    Last edited: Nov 4, 2020
    Jamster likes this.
  26. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    DarkRift 2.8.1 is now available on the website!

    This manly fixes a bug where the pro server wouldn't start unless you were using server clustering!

    The update is already available on the website here, or through the DarkRift CLI tool and will be available on the asset store in the coming few days!
    https://www.darkriftnetworking.com/DarkRift2/Releases/Free/2.8.1.unitypackage
    https://www.darkriftnetworking.com/DarkRift2/Releases/Pro/2.8.1.unitypackage?invoice=<your invoice number>

     
    knxrb likes this.
  27. xpxilom

    xpxilom

    Joined:
    Aug 28, 2014
    Posts:
    21
    Soy nuevo, donde puedo encontrar tutoriales de DR2?
     
  28. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    Hola, hay un tutorial de DR2 aquí y un tutorial de comunidad aquí, pero ambos estan en inglés.

    No sé de un tutorial en Espanol, lo siento!
     
    xpxilom likes this.
  29. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
  30. emailadjie

    emailadjie

    Joined:
    Jun 18, 2020
    Posts:
    27
    Hello,
    When trying to implement your asset in my program, this error occured:

    Code (CSharp):
    1. DarkRiftConnectionException: Unable to establish TCP connection to remote server.
    2. DarkRift.Client.BichannelClientConnection.Connect () (at <3a26bbcd2cce497ebf128d6d1cf80437>:0)
    3. DarkRift.Client.DarkRiftClient.Connect (DarkRift.Client.NetworkClientConnection connection) (at  <3a26bbcd2cce497ebf128d6d1cf80437>:0)
    4. DarkRift.Client.DarkRiftClient.Connect (System.Net.IPAddress ip, System.Int32 port, System.Boolean noDelay) (at <3a26bbcd2cce497ebf128d6d1cf80437>:0)
    5. DarkRift.Client.Unity.UnityClient.Connect (System.Net.IPAddress ip, System.Int32 port, System.Boolean noDelay) (at Assets/DarkRift/DarkRift/Plugins/Client/UnityClient.cs:254)
    6. DarkRift.Client.Unity.UnityClient.Start () (at Assets/DarkRift/DarkRift/Plugins/Client/UnityClient.cs:208)
    7.  
    Could you please help me?
    Server code:
    Code (CSharp):
    1. public XmlUnityServer server;
    2. public Data dataClass;
    3.     public void Update()
    4.     {
    5.         // Gets all clients
    6.         IClient[] clients = server.Server.ClientManager.GetAllClients();
    7.         for (int i = 0; i < clients.Length; i++)
    8.         {
    9.             // Gets message/packet from Data class and sends them to all clients
    10.             clients[i].SendMessage(dataClass.Get(), mode);
    11.         }
    12.     }
    Client code:
    Code (CSharp):
    1. public UnityClient client;
    2.     public void Awake()
    3.     {
    4.         // User inputs IP, code checks if IP is valid, then IP gets saved to PlayerPrefs. Then, load client scene.
    5.         client.Address = System.Net.IPAddress.Parse(UnityEngine.PlayerPrefs.GetString("IP"));
    6.         UnityEngine.PlayerPrefs.DeleteAll();
    7.     }
    8.  
    Thanks in advance!
     
  31. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    Sure can!

    Where are you hosting your server and what type of IP address are you trying to connect with (Public? LAN? Localhost?)

    If the server is just hosted on a player's machine they will need to port forward the TCP and UDP port on their router.
     
  32. emailadjie

    emailadjie

    Joined:
    Jun 18, 2020
    Posts:
    27
    I want the client to communicate with a local server on the same network (LAN) and the user can manually type the server IP. This is currently not working.

    Also, when I added a Debug.Log() function on the Start() function of one of your scripts (i forgot which), it does not log anything on the console, even though it was the first function in Start(). I am sure I put the script on an active GameObject.
     
  33. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,065
    OK, in that case you want to be using the internal IP address (i.e. the one found from on ipconfig) rather than the public IP
    (e.g. the one external websites tell you). Are you using that?
     
  34. emailadjie

    emailadjie

    Joined:
    Jun 18, 2020
    Posts:
    27
    Yes. I have been using it. I have a script on the server to set a Text GameObject to show the local IP.
    (By the way, the server and the client uses the same Unity project, but different scenes. If this setup does not work, let me know :))

    Also, does DarkRift Networking 2 support multiplatform (Android = server, PC = client)? Thanks in advance!
     
unityunity