Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  6. Unity 2017.2 beta is now available for download.
    Dismiss Notice

DarkRift - Fast and Flexible Cross Platform Networking

Discussion in 'Assets and Asset Store' started by Jamster, Apr 20, 2015.

  1. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    What is DarkRift?
    DarkRift Networking is a fast and flexible networking solution for server - client model multiplayer games.

    DarkRift takes a lower level approach to networking in Unity than RakNet but still hides you from the complexity of the underlying sockets. Messages are sent between the server and clients in an email like fashion using a tag and subject to identify the message content meaning the bandwidth used is kept to a minimum.

    For advanced users you can embed your server into Unity builds to utilise Unity's physics and pathfinding or any other asset you want. Fancy running it on Linux as well? We support that!

    How about an authoritative server?
    Running server side code is as easy as dropping a .dll file into a folder. If we don't already have a plugin that fits your needs in the plugins thread then you can delve into our server's inner workings and rig one up in no time at all. It only takes 20 minutes to complete our plugin tutorial.

    If you need persistent storage for your game then DarkRift's database integration will make your job much faster. Add the database connector plugin for your choice of DB and your plugins will be able to run SQL commands through the generic wrapper without even adding another reference to your code.

    What about underneath?
    Serialisation is completely automated in DarkRift using .NET's powerful BinaryFormatter meaning you can send any serialisable object across the network in a single line of code. However, if you feel you need more control over what's sent then you can use DarkRift's new manual serialisation system to easily choose exactly what is sent and bypass the automated serialisation.

    Both the client and server APIs are simple and lightweight. If you want to receive data then you latch onto an event, if you want to send data you call a method, if you want to know when someone disconnects then there's an event for that, if you want to kick someone off because you don't like them: there's a method for that too!

    What's new with DarkRift 1.3?
    - Official Linux support via Mono!
    - Unity embedding so you can use Unity physics and pathfinding in your servers!
    - Comments in configuration files (finally).
    - Multithreading in the client API!
    - Bug fixes.

    - Added new demo of custom serialisation.

    Where can I get it?
    DarkRift is available free on the Asset Store Here up to 20 users, if you want more then get a Pro or Extreme license.

    Read a great review and comparison of networking solutions here!

    If you have any questions I'll happily answer them :)

    More help!

    There is also community run Slack and Discord channels that everyone is welcome to join here and here!

    Jamie
     
    Last edited: Apr 14, 2017
  2. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    943
    rstrunge, muzz155 and Jamster like this.
  3. Linearch

    Linearch

    Joined:
    Apr 1, 2015
    Posts:
    25
    Hi, um. I'm redirected here from the old thread.
    So, well. I'm a noob here both in programming and unity.
    I've been trying out DarkRift for a while now and I'm trying to run two instances of Unity for networking test, but it seems like DarkRift is paused when the game is not on foreground.

    I mean, for example, just call A as the first instance of Unity, and B as the second. I'm moving the character using Horizontal keyboard axis.
    When I'm pressing a or d on A, and sending it to B, B is not receiving the message (the character stays still).
    Then I tried pressing d on A, and quickly switched to B, and B did receive the axis, it moved.
    But then it didn't update. If what B received was 1, then it stays 1, and it continue moving even though it has stopped on A.
    Then I switched back to A and the axis on A becomes 0 because I didn't press either a or d. But the object on B still moves, until I switched again to B and then it stops (the axis becomes 0).

    Is this a bug or was it really intended to be like this?
    I mean, if the player accidentally minimized the game then his game client will be 'paused' and so does his character on the other clients right?

    Thanks before :)
     
  4. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Hi Linearch, welcome to the forums :)

    Its a default in Unity to pause the game when it's not in focus, you can change this in Edit -> Project Settings -> Player -> Resolution and Presentation -> Run In Background :)

    Jamie
     
  5. Linearch

    Linearch

    Joined:
    Apr 1, 2015
    Posts:
    25
    Oh, it works :).
    Thanks for the fast reply, and sorry.
    Idk why but I didn't need to change this when using PUN and uLink so I thought it was like that by default, haha.
     
  6. Linearch

    Linearch

    Joined:
    Apr 1, 2015
    Posts:
    25
    May I ask again?
    Will it affect the networking performance if I put too many receivers in a client?
     
  7. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    You can ask as many times as you like! :)

    I'm not entirely sure what you're asking, do you mean the DarkRiftReceiver script or do you mean latching onto the data received event (for processing the data yourself). If you mean the former then you should only ever have 1 DarkiftReceiver and that will handle all the messages; however I assume you actually mean the event which, given too many callback procedures, could slow it down but I doubt you will have any problem. You could always use the Profiler to see if it's causing your game issues :)

    Jamie
     
  8. Linearch

    Linearch

    Joined:
    Apr 1, 2015
    Posts:
    25
    I meant the script. The one with DarkRiftAPI.Receive(); on Update(). So I should only have one GameObject with DarkriftReceiver attached to it for each scene in the client? Mind explaining why?
    I tried putting two receivers, one in the "Scripts" GameObject and one in the player's character, it didn't give me any error though I doubt it doesn't affect the networking performance.
    About sending messages, it's alright to do it in every synced GameObject right? Or should I have relayed (not sure if I'm using the correct word for it) it through the "Scripts" GameObject too?
    Thanks :)
    ----
    Also, I need some advice on debugging. I'm building a plugin and getting some null reference exception in the server's cmd window. Though the game works fine without any error. The server doesn't tell me which line it is from. The error showed when a player joined, so I tried printing some log on the script on parts that should be called when player joined, and they all printed just fine but the error still shows after all log is printed. The error spammed a few times for 1-2 secs after the player joined.
    Thanks again :)
     
    Last edited: Jul 4, 2015
  9. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    The call to DarkRiftAPI.Receive() enters a loop internally that removes packets of data from the sockets, decodes them and calls the received event until there is not more data left to process. if you make a second call to Receive() then, chances are, there wont be any data that needs to be processed so it will simply exit. I doubt there will be any performance issues by calling it twice but it is simply unnecessary to and could make your code a little less maintainable.

    I'm not entirely sure what you mean but you can send from any point in your code (including from other threads and coroutines AFAIK); there's no technical limitations as to when you can send. Sending from a single script may make your code a little easier to maintain but overall I don't see any reason you couldn't send from any gameobject at any time.

    Could you attach the log file for the error (found under Logs --> <the date> --> <the time>.txt)? If you can't find the source of the error then it could be a problem in the server and the log file will help, otherwise I may be able to help more with it anyway :)

    Jamie
     
  10. Linearch

    Linearch

    Joined:
    Apr 1, 2015
    Posts:
    25
    Ah, is that so. I'll just use one receiver then.
    Anyway, here's the log file. I don't think it will be helpful, though.
     

    Attached Files:

  11. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    You'd be surprised, seems like it is an internal error (though it could be caused by an external problem). I'll look into it and prehaps add a little more detail to my error reports in future :)
     
  12. Linearch

    Linearch

    Joined:
    Apr 1, 2015
    Posts:
    25
    Thanks :)
    Well, they don't appear if I don't use my plugin so I think it was caused by my plugin.
    I think it was because the game hasn't fully loaded but the server was trying to send message to it. Because when it happened the play button hadn't glow blue yet, and it stops spamming when I can finally play the game.

    I used both DarkRiftAPI.SendMessageToServer and DarkRiftAPI.SendMessageToID from the client,
    and both ConnectionService.SendReply and DarkRiftServer.GetConnectionByID(ushort).SendReply from the server,
    and I called DarkRiftAPI.Connect() on Start(), if that may help.
    I'll send the script if you need it for debugging.
     
  13. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Hmmm that information is useful thank you :) What is your plugin doing to the data when it throws the exception? Is it anything different to when it doesn't throw the error? Are you using onData or onDataDetailed?

    Anything can help and seeing your code may answer a lot of those questions :)

    Jamie
     
  14. Linearch

    Linearch

    Joined:
    Apr 1, 2015
    Posts:
    25
    Right, I don't know what my plugin is doing to the data when it throws the exception. I mean, it doesn't tell me which line caused the error, and the game runs fine without any errors as I stated before. And I tried to write logs and they all print fine but it still throws exception in the end.
    I'll send you the script then, since its too long and messy to be pasted here haha.

    Ah, also, I'm using onDataDetailed and OnDataReceived (server)

    Sent
     
    Last edited: Jul 7, 2015
  15. ted-gamaya

    ted-gamaya

    Joined:
    Apr 16, 2013
    Posts:
    5
    Jamie,

    Looking into a bunch of networking solutions for our game and I have a few questions about DarkRift. I like the simple API of DarkRift and I'm hoping to use it. I've played with the free version's demos and reading through all the docs. However, I'm still not sure what the architecture of DarkRift is compared to others. What I'm seeing is a different way of doing Unity's Network.RPC() and various network callbacks on MonoBehavior, like OnConnectedToServer(). I know that's simplifying your work and I don't mean disrespect. It's hard to summarize what DarkRift does in one sentence :)

    For example, in these cases below, how would DarkRift handle it:

    1) I have multiple enemies in the world, all need to be synced between server and client. Unity handles this with a NetworkView so that "enemy on top of the tree" on server is sending messages to only "enemy on top of the tree" on all the clients. I'm not seeing this unique ID in the DarkRift documentation and so I was wondering how that would be handled.

    In the CubeDemo, I see the CubeMove's cubeID, but in OnDataRecieved() it's checking this number to make sure the message is filtered to the specific cube. If there was 10,000 cubes, every cube would get that message and check it's cubeID. That's very inefficient to be sending data to all the cubes.

    2) Lobby/Room. How would DarkRift create a Lobby/Room concept? Usually this is done in the server, but the server seems to be a closed box. Is this where the Server Plugins come in? If so, how does the Lobby keep track of all the players? Can Plugins talk to the Server about player info? Or are the Plugins written like the client and need to listen for onPlayerConnect events themselves? What is the Server actually doing other than forwarding packets to all clients?

    Those are the two biggest things I am trying to figure out in DarkRift. Below is a bunch of small questions:

    1) Does DarkRift.exe only run on Windows? Does the Pro/Extreme version get a OSX version?
    2) Does Pro/Extreme come with source code to the server (DarkRift.exe)? Is the similar to Unity's MasterServer/Faciliator?

    Really nice work. Keep it up.

    Thanks!
    Ted
     
  16. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Hi Ted,
    Glad you're considering DarkRift!

    As you've noticed DarkRift is sometimes hard to compare with the other networking solutions because it's not as high level as UNET or Photon; in fact I think the best way to describe it is about midway between the high level solutions and the underlying sockets they're all based on, it takes away the serialisation and handling of IDs etc. but leaves you without NetworkViews and RPCs etc. DarkRift's events are essentially stripped down RPCs that (if I recall correctly) are much faster and lighter the Unity's and so are a bit more suitable for synchronising things.

    In your first example DarkRift gives you a few ways to address this, the standard (actually there's not really any standard ways of doing things in DarkRift!) is to assign each an ID and then for them each to check whether data is for them as you saw in CubeDemo but you are quite right in that for large numbers of cube this would be very bad. I suspect that this would work fine for ~500 cubes depending on how much processing each cube has to do in checking the data but with 10000 I would use a hash table to distribute the data to only the correct one: eg. A manager receives the data, inputs the ID into a hash table and receives the instance of the cube with that ID and then passes the data to said cube. Whilst I can't be sure, I suspect Unity's RPC system uses a hash table to distribute the RPCs correctly as that should be the most sensible way to implement it.

    If you know big O notation the cube demo runs in O(n) but a hash table would reduce that to O(1).

    In regards to the Lobby System question I am currently working on one to be added to the Plugin thread which should be out with the next version (maybe a month or so?). A few people have built there own Room systems and I think the lockstep plugin in said thread has a simple one already implemented.

    You are quite right in that the server is a closed box and for the most part simply forwards packets on to other clients (it does more behind the scenes such as the serialisation/deserialisation, ID allocation, the API, plugin management etc.) but the advantage of that is that no game mechanics are set in stone into the server. For example with photon you have to use the room system whether you want rooms or not but with DarkRift the idea was that this would be a plugin you could add or remove depending on whether your game actually needed rooms.

    Plugins and clients are fairly different. Both use similar event systems but plugins have a large API to change the server with and can change/intercept/destroy/create messages, change the distribution, access databases and in general plugins know everything whilst a client should know only what it needs to. A room system, in a fairly abstract way, would remember which room each connection is in and then instruct the server on any further action it should take (eg. not transmitting data between rooms).

    For your other two questions:
    DarkRift is .NET and so will run on OSX and Linux via Mono, I think you need to enable the beta garbage collector though (I don't do Linux/OSX stuff!).
    I suspect if you do buy the extreme version I'm probably happy to give you the source code! :p

    Jamie
     
  17. taz_ack

    taz_ack

    Joined:
    Jun 13, 2015
    Posts:
    3
    Hello,

    I am looking for network solution for my game and I am wondering if DarkRift can be used to make a MarioKart like game.
    I seen DarkRift Server is a standalone program so how physics collision can be resolved ?
    Shoul I set one client as authoritavie server and manage the physics and propagate the result through the DarkRift server ? I fear for latency problem with this solution.

    thank.
    Tazack.
     
  18. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Hi Tazack,
    Definitely could! I agree about your worries of latency, although running both on the same machine would reduce this hugely and I don't think you would need to worry about of much about it. The code to manage it may not be as fun however!

    Alternatively if you wait about a month until the next version that will allow you to embed a DarkRift server within Unity and will make your problem way simpler!

    Jamie
     
  19. taz_ack

    taz_ack

    Joined:
    Jun 13, 2015
    Posts:
    3
    So see you next month ;-)
     
    Jamster likes this.
  20. Bladeous

    Bladeous

    Joined:
    Jul 14, 2015
    Posts:
    1
    Hello Jamster !
    I used Dark Rift for a real time application and it's working very good :)
    I had 2 questions :
    - Is DarkRift API can be used in WebGL export?
    - Did you ever deployed a server in a web host machine and try access it via internet? I just tried and I'm meeting some issues (surely network port or something). I can connect but I don't receive any message.


    Thank you for the development of that tool... Really it changed my life !
     
  21. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Well... unfortunately not, I might try and implement this when I have time - a bit of a challenge!

    It should work, it certainly does for most people. I wonder if it's an issue with port forwarding? Can you give me some more details in a PM? :)
     
  22. Casper_Stougaard

    Casper_Stougaard

    Joined:
    Jul 18, 2013
    Posts:
    60
    Hi Jamster

    I've downloaded the free version of your DarkRift server, but i can't quite figure out how to send and recieve messages between two objects properly. I'm working on a first person shooter, but currently only one player can damage the other. Since this is quite unfair for the other person, i was wondering if you could give a quick example of how you would go about telling another player that i shot them? :)
     
  23. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    I've replied to the email you sent me, sorry it took so long!
     
  24. Casper_Stougaard

    Casper_Stougaard

    Joined:
    Jul 18, 2013
    Posts:
    60
    Thank you very much, I'm sorry to break my questions up by asking by email and here, but could you help me understand what these lines are telling me? :)

    13-8-2015 08:39:43 [Log] Data: Sender: 2 DistributionType: Others Tag-Subject: 1-1
    13-8-2015 08:39:43 [Log] Data: Sender: 2 DistributionType: ID Tag-Subject: 1-2

    If you want you can reply just here or by mail. I just figure that here might be better for everyone since others might run into similar problems :) I could post a copy of the mails here also.
     
    reese01 likes this.
  25. Casper_Stougaard

    Casper_Stougaard

    Joined:
    Jul 18, 2013
    Posts:
    60
    I figured out what i did wrong with only one client being able to damage the other clients. I'll post a description of my problem and the solution when i get home from school :)

    I'm still interested to know what the logs mean though :)
     
  26. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Glad you got it working!

    The log messages that you posted are because you set the logData value in settings.cnf to true. in roughly the same format they mean:
    <Date> <Time> [<The type of message>] Data: Sender: <The id of the client that sent the message> DistibutionType: <The distribution type that the message as sent with> Tag-Subject: <the tag you sent it with>-<the subject you sent it with>

    Each log is for a different message so the first is a message from client 2 sent to other clients with a tag of 1 and a subject of 2 and the second is another message from client 2 to a specific ID (I think the next version actually tells you who!) with a tag of 1 and a subject of 2 :)
     
  27. Casper_Stougaard

    Casper_Stougaard

    Joined:
    Jul 18, 2013
    Posts:
    60
    Thanks Jamie, this will definitely help me solve some other issues :)

    As promised earlier, here's a description and solution of my problem in case anyone else runs into a similar problem.

    The problem was that when i had multiple network players connected to my game, only one was able to deal damage to everyone else.

    The solution was that i didn't recieve the damage message properly on each player.
    Code inc!

    The script below is the network player that recieves the message about being hit by another player.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using DarkRift;
    4.  
    5. public class ExampleNetworkPlayer : MonoBehaviour
    6. {
    7.     //The ID of the client that owns this player (so we can check if it's us updating)
    8.     public ushort networkID;
    9.     // Player nickname
    10.     public string playerName;
    11.  
    12.     Vector3 lastPosition;
    13.     Quaternion lastRotation;
    14.  
    15.  
    16.  
    17.     void RecieveData(ushort senderID, byte tag, ushort subject, object data)
    18.     {
    19.         // -- All this is the standard code to update movement and rotation -- //
    20.  
    21.         if( senderID == networkID )
    22.         {
    23.             if( tag == TagIndex.PlayerUpdate )
    24.             {
    25.                 if( subject == TagIndex.PlayerUpdateSubjects.Position )
    26.                 {
    27.                     transform.position = (Vector3)data;
    28.                 }
    29.                 if( subject == TagIndex.PlayerUpdateSubjects.Rotation )
    30.                 {
    31.                     transform.rotation = (Quaternion)data;
    32.                 }
    33.  
    34.                 // I used to recieve my message in here but it caused wierdness!
    35.             }
    36.         }
    37.         // ------------------------------------------------------------------- //
    38.  
    39.  
    40.         // ----- So i tried to create this instead, which worked perfectly ----//
    41.         if (tag == TagIndex.PlayerUpdate)
    42.         {
    43.             // If someone shot at us
    44.             if ( subject == TagIndex.PlayerUpdateSubjects.Health )
    45.             {
    46.                 transform.GetComponent<HealthClass>().RemoveHealth((float)data);
    47.             }
    48.         }
    49.         // ------------------------------------------------------------------- //
    50.     }
    51. }
    52.  
    This script below is the method on my gun script that sends message about the damage to the target that was hit.

    Code (CSharp):
    1. // This is where i send the message to the players that i shoot.
    2.     void ApplyDamage (GameObject target, float amount)
    3.     {
    4.         DarkRiftAPI.SendMessageToID (target.GetComponent<NetworkPlayer> ().networkID, TagIndex.PlayerUpdate, TagIndex.PlayerUpdateSubjects.Health, (float)amount);
    5.     }
    I hope this helps someone else :)
     
    Last edited: Aug 14, 2015
  28. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Your method is going to cause you headaches later! ;)

    The reason that your receiving code should go within the tag checking bracket is because now any message with the subject that corresponds with your damage subject will cause your player to lose health, or worse, throw an exception!
    For instance I may send a chat message but because it has the same subject it will try and decrease the health.

    You probably also shouldn't need the senderID != networkID, ideally it shouldn't send in the first place if it was yourself you shot!

    Glad you have it working though,
    Jamie
     
  29. Casper_Stougaard

    Casper_Stougaard

    Joined:
    Jul 18, 2013
    Posts:
    60
    That makes perfect sense. I didn't really think much about it since it just worked but I'll get that fixed. Thanks for correcting me on that :D
     
  30. coco97

    coco97

    Joined:
    Apr 20, 2015
    Posts:
    1
    Hi Jamster

    How can I send data to all client in server(i think server plugin as server) ?

    Because I can't find like DarkRiftAPI.SendMessageToOthers(). I just write like this:

    Code (CSharp):
    1.  
    2. NetworkMessage send_msg = new NetworkMessage(0, DistributionType.Others, 0,TagIndex.Server, TagIndex.ServerSubjects.SpawnPlayer, pos);
    3.  
    4. var num = DarkRiftServer.GetNumberOfConnections ();
    5.  
    6. var conns = DarkRiftServer.GetAllConnections ();
    7.                          
    8.                          
    9. for (int i = 0; i < num; i++) {
    10.                              
    11.                                 conns[i].SendNetworkMessage(send_msg);
    12.                              
    13.                             }
    I don't understand Why in unity DarkRiftAPI have SendMessageToOthers(), but server have not.
    And the underlying mechanism to achieve this function? client direct send to other client or pass through server?
     
    Last edited: Aug 26, 2015
  31. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    You're doing it exactly how you're supposed to do it!

    The short answer to why the methods aren't in is because of the shear amount of different ways you might want to send data, on the client I assumed it would usually be those options (and in the next version you can send in other ways too) however on the server you might want to send to everyone in a clan, everyone in a room, a certain area of the map, anything really...

    I can actually see your point about them not being the same (or at least similar) and so I'll definitely think about that!

    Regards,
    Jamie

    P.S. you can shorten your code using
    Code (csharp):
    1.  
    2. foreach (var c in DarkRift.GetAllConnections ())
    3.     c.SendReply(tag,subjext,data);
    4.  
     
  32. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Version 1.3 released and prices fall by 60% and 85% :D

    1.3 brings the addition of some key requested features:
    - Official Linux support via Mono!
    - Unity embedding so you can use Unity physics and pathfinding in your servers!
    - Comments in configuration files (finally).
    - Multithreading in the client API!
    - Bug fixes.


    To celebrate this I'm cutting the prices drastically: Pro falls from $60 to $25 and Extreme from $650 to $100!

    Enjoy :)
     
  33. KHRZ

    KHRZ

    Joined:
    Mar 2, 2013
    Posts:
    54
    The instructions are simple enough, but it's not working for me and so it's hard to understand what my issue is... I have 2 computer on a LAN, I tried the Player example, and changed the serverIP string on one of the computers to the IP of the other computer, where I am running the server. However, I get the error "SocketException: No connection could be made because the target machine actively refused it.", despite disabling firewalls etc. If I also start the DarkRift server on the client however, connect() returns true, but it is only connected to the server running on client's computer, not the one of the IP it was supposed to connect to... I am a little confused, is the client's server "snagging" the connection? Why do I get "connection actively refused" even if I connect to a bogus IP like 999.999.999.999? Does this error message mean anything usefull?
     
  34. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    The error message is one of .NET's wondrously non-descriptive errors! Usually something like that is down to not having port forwarding setup correctly on the router, can you confirm that your router is forwarding port 4296 (TCP) to your server?

    As I said, the "Connection actively refused" is pretty much thrown whenever .NET can't connect to the server, whether it's because the port's not open or because the machine did actually refuse it :/
     
  35. KHRZ

    KHRZ

    Joined:
    Mar 2, 2013
    Posts:
    54
    I have forwarded the port, but still the same error. However, I tested with this site http://ping.eu/port-chk/
    pinging the DarkRift server, and it does indeed respond "open" when running and "closed" when not running, and logs "Connected". But only when using the router's IP (not internal IP like 192.168.xxx.xxx).

    EDIT: Ok the whole thing was just silly me changing the serverIP string in the C# file, which just got overriden by the Unity editor to the value 127.0.0.1...
     
    Last edited: Oct 4, 2015
  36. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Haha lovely! You had me worried you'd found a glitch then ;)
     
  37. Hunkofsteel

    Hunkofsteel

    Joined:
    May 13, 2015
    Posts:
    20
    Does this only work on port 4296? I noticed on your embedded server you have the option to change it. Does changing it actually work?
     
  38. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    You can change the port to whatever you desire on both standalone and embedded servers :) Just remember you need to restart the server/client to make the change take effect :)
     
  39. Hunkofsteel

    Hunkofsteel

    Joined:
    May 13, 2015
    Posts:
    20
    I'm experiencing a bug with Unity when I'm using the DarkRift Embedded Server. The result of this bug is that I would have to restart Unity again. What I do is start the embedded server, and then close it, then start it again (this is all in the play editor). Unity would hang. Is this a problem on my side or on the DarkRift side?

    P.S. This bug also manifests itself when I'm using your example project. I tried starting a new Unity project, but the error persists. As in, it only happens with the embedded server.
     
    Last edited: Nov 9, 2015
  40. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    That it an interesting bug... I will look into it...

    Thanks :confused:
     
  41. Hunkofsteel

    Hunkofsteel

    Joined:
    May 13, 2015
    Posts:
    20
    Is anyone else experiencing this bug? I suspect its because the server did not close properly on the networking end, and when it tried to start it again it failed, but I'm not sure. When I built,run, and close the embedded server, the program would stop responding for a while. Since I don't have another Unity to test with, I'm not sure whether its just my Unity has problems or its a bug with the Dark Rift Networking. Its not urgent, because the server on the outside works fine.

    I'm really impressed with how this is made; this is great stuff. Its actually so easy to do things and add networking on them. It kind of feels like C++, in that it does more of mid-tier stuff. Keep up the good work.
     
  42. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Thanks for the kind words :) I have a feeling I did come across this bug but I thought it went away again, my guess is that something isn't being released properly when it's run under Unity...

    I'm seriously considering just rewriting the embedded DarkRift into a nearly completely separate package so that I can focus on them more individually. Everything about the current embedded server just seems so cluncky compared to the standalone one... :(
     
  43. WolvBoar

    WolvBoar

    Joined:
    Jul 29, 2015
    Posts:
    2
    I want to use your DarkRift server for a really big game, I mean there will be a lot of data to send. My question is are you using UDP or TCP sockets? Because I'm worried that if it is TCP it can't handle the type of game I'm currently working on. But even if it is TCP, DarkRift is awesome anyway :D
     
  44. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    Currently DarkRift is TCP only. At some point, probably the summer, I will do a fairly massive overhaul of DarkRift and add UDP/RUDP but till then it's TCP only I'm afraid :)
     
  45. KHRZ

    KHRZ

    Joined:
    Mar 2, 2013
    Posts:
    54
    Some questions. If you want a master server where the players asks for the address of your DarkRift game server, will there be any issue with this master server also being written in DarkRift? (As there is just 1 DarkRift connection at a time, maybe at one point you may want to have connection to both the master server and game server at time, rather than disconnecting from them before switching. Still not sure if this is important though.) But I am assuming you can still use some other connection API to perform stuff simultaneously without this causing issue with your DarkRift connection?

    Also some questions about the licence, I am assuming it covers you to deploy as many servers you want yourself, but say you wanted to allow user hosted servers. Would this mean a license for each user? (unless 20 player capped free version), and are you willing to make new licenses if people had some business models depending on this, like we pay for the user's licenses instead of them? (Right now this is too early to say if we need).

    I have some big development plans involving possibly DarkRift or Forge, which we will see in January if goes through.
     
    Last edited: Nov 14, 2015
  46. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    360
    Hi, i got a few questions:
    - are you planning to make an export to webGL any soon ?
    - will you make the server work on mac Os x ?
    - do you have a "real" web hosted server solution ?
     
  47. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    I apologise for the slow reply, I've been away all weekend :)

    @KHRZ
    It would be perfectly fine to run DarkRift as a master server for other DarkRift instances, it wouldn't be too hard to write the code for it either. You can have as many DarkRIftConenction objects as you need and they can all point to different servers without interfering with each other (or any other connection API), so you could have one for your master server connection and another for your actual server connection as an example.

    The license doesn't allow you to distribute the server executable at all, purely because people can't be trusted (I'd like to think my customers can though!) and one could easily pass it on to another and so forth if the license did allow it. DarkRift isn't really designed for non-cloud hosting anyway, as an example if your users wanted to host over a LAN they'd have to setup their own port forwarding etc. and anything changed in configuration files or via commands could screw things up. Plus the .dll plugins aren't really designed to stand up to people just disassembling them and rewriting parts of the code to alter gameplay...

    Your best bet would be to simply host a number of DarkRift instances (with perhaps a modified version of the RoomPlugin) that users can connect to via the master server, this means there's no licensing issues and you'd still have full control. Plus it shouldn't end up being that much more expensive.

    I look forward to seeing your game! :)

    @Paradoks
    Right now it's hard to say, I probably will but I think I'd need to rig up some websockets for it to work, it's somewhere in the middle of my todo list as it's not necessarily a simple task!
    The server should work on OS X as it's Linux based, if you have an OS X machine then download the free version and see; if that works then the Pro and Extreme versions will too.
    As for your last question I'm not entirely sure what you mean...?

    Jamie
     
  48. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    360
    i meant:
    i got a AC2 running on AWS servers. Is darkrfit realserver side logic or will server only run in a unity game instance?
     
  49. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    811
    The server will run standalone on the server yes, but it can also run in a unity instance if you want it to :)
     
  50. WolvBoar

    WolvBoar

    Joined:
    Jul 29, 2015
    Posts:
    2
    Ok One more question. How about distibuting your game with the server? I mean i want to make a game where player can host they own server. Is it enought for me to just buy pro licencs and let them use this server or should I do something else?