Search Unity

  1. 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. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Hi!

    I believe you already found some answers on the Discord but I’ll chip in as well!

    To run on Mac you either need to use the Mono Project (if you’re using the .NET Framework build of DarkRift), or you’ll need DarkRift Pro and its .NET Core build of DarkRift (which is natively cross platform). I haven’t run it with Mono in a while and this issue got reported the other day so I can’t guarantee the first option will definitely work at the moment!

    Jamie
     
  2. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Hey all, I'm afraid I don't have much development to report since I last did an update (wow... that was a while ago...) because my life has been incredibly hectic recently, so much so that I haven't even been able to be particularly active helping people out either sadly! :(

    However that's not to say I haven't done anything since the last update when I've had some spare time...!

    Firstly I've done various small process improvements: I've moved the release script I have to a shell script rather than Python to make it operate a little more reliably (if anything prompted for user input it died!), and I've been able to refactor some of the system tests so they're a bit easier to add new tests into, particularly when those tests are for raised issues.

    I've been able to add a second locking mechanism to the data directory which doesn't require the Mutex class meaning you should now be able run Unity based servers on IL2CPP. This still retains backwards compatibility with the old lock so you won't hit any issues mixing old and new servers together with the same Data directory if you do have to do that for some reason!

    I've also been able to fix some log lines not being output when connections timeout on the server and have sunk a huge amount of my spare time into finding the remaining message corruption bugs. I've tracked down and fixed a corruption bug on the server when using the dispatcher but I'm sad to say that there's still more to find - credit to Allmaron for building a script that manages to trigger them so well!

    Lastly I've also added some missing cache settings to the documentation which will be uploaded with the next release.

    It greatly saddens me that I've not had the time to work with you all on DarkRift recently but I'm hoping that will resolve soon and I can get back! I'll try and do a release of everything listed above today or tomorrow!

    Jamie
     
    BitPax, LostPanda and Willbkool_FPCS like this.
  3. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    DarkRift 2.4.4 is now available on the asset store!

    This update addresses a number of user submitted features and bugs! You can convert DarkRiftWriters/Readers from an to byte arrays more easily if you want to use your own serialization and can run DarkRift servers on Unity's IL2CPP in your using a Unity based server. The other notable thing is a further bug fix on message corruption. While this is still an outstanding issue, this fix improves the stability of DarkRift 2.4.x quite significantly when using the dispatcher so development should a little less rocky.

    DarkRift 2.4.4
    - Fix cache suppression accidentally left in
    - Fix connection timeout messages not being output
    - Fix issue #64 so DR will run on Unity's IL2CPP
    - Fix threading issue on finalization warnings
    - Add methods to send/receive data from raw byte arrays (issue #59)
    - Fix cache settings missing from docs
    - Add additional fix for message corruption when using the dispatcher
     
    Last edited: Jul 4, 2019
    LostPanda likes this.
  4. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    DarkRift has been reverted :(

    As I'm sure everyone is aware by now, DarkRift 2.4.x has been pretty unstable and frankly unusable for the past few months. I've tried with 4 bug patches to fix the issues that are present but there is always more to fix and those remaining are even harder to debug than those before them. It's with great disappointment that I've chosen to revert the version of DarkRift on the asset store back to 2.3.1 so that new users do not have to continue facing these issues.

    I will continue working on the 2.4.x branch until the issues are fixed and releases for 2.4.x will be available from the website (with updates posted on Discord and the forum) but the asset store will hold 2.3.1 until these are finally fixed. I encourage any users who have experienced the bugs to periodically checkout the 2.4.x releases and provide any feedback you have on them!

    I honestly feel pretty demoralised by all of this and the fact that each release has just pushed the problems elsewhere, and I can only apologise for the inconvenience and trouble that this saga has caused everyone. Thank you for the continued loyalty to DarkRift, and for the continued support and patience with these fixes!

    Jamie
     
    BitPax, Armynator, Ruslank100 and 2 others like this.
  5. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    886
    Thanks for being
    Thanks for being so transparent about this, I really appreciate that.
    Such things could happen during development, so it's nothing to be angry about. I understand it's pretty demoralising, but keep up, I'm positive you're going to succeed in fixing it.
    Keep up with the great work! :)
     
    chadfranklin47, BitPax and Jamster like this.
  6. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    36
  7. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Frankly I'd say DarkRift is an excellent tool for a game like that! DarkRift will allow you to do significantly more bandwidth optimisation that most of the other network systems because it operates on a lower level that the others and doesn't make any assumptions about your data requirements. In my honest opinion, RTSs and other games that require synchronisation of a large number of simple objects are DarkRift's forté.

    Right now version 2.3.1 (which is the version on the asset store) is production ready. The latest release (2.4.4) is not because to some rather serious bugs, however I've committed to fixing those before releasing a 2.5.x.
     
    Willbkool_FPCS likes this.
  8. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    36
    Do you have a roadmap? Can you tell me a bit more about Hazel and the niche it fits into? I can't find much information about it, or the 'use cases' so to speak.

    On a side note, your pro version says multithreaded, but what does that mean for users using the nonpro license?
     
    Last edited: Jul 28, 2019
  9. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    There's not really a written roadmap at the moment but current rough one in my head is to release inter-server communication/server clustering in the autumn, then probably a DarkRift 3 in the spring, then the area of interest stuff.

    The DarkRift 3 upgrade isn't laid out yet but won't be a tricky upgrade; it'll be based off the same codebase and will just contain some breaking changes in order to do improvements that can't just be done in a minor release, significantly simpler to follow than the DR 1 -> DR2 upgrade was! DR 2 will remain supported for a decent time after this as well anyway.

    Hazel was the network interface layer for DarkRift during the beta but DarkRift now uses a modular network interface layer so you can swap in others like ENET/Websockets/Steamworks as you want. Hazel's no longer developed by me but has been handed over to another developer who actually has the time and application to work on it.

    Both pro and free are multithreaded internally (and are externally thread safe) for performance, if it says that just pro is that's a mistake sorry!
     
    BitPax likes this.
  10. Jamster

    Jamster

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

    This patch fixes some community reported bugs, adds and extends some simple commands and continues to fix the message corruption bugs.

    If you can, please do take some time to try this version in your projects and report back on any bugs you find/that remain.

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

     
    BitPax likes this.
  11. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    It appears DarkRift 2.4.5 didn't upload correctly, this issue has been fixed! Apologies! :)
     
  12. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
  13. ercion

    ercion

    Joined:
    Aug 15, 2016
    Posts:
    73
    @Jamster I was taking a look at networking solutions and I came across DR2. It looks promising. Though i'm a bit confused about some things, I hope you can clear them up?
    I'm trying to achieve P2P multiplayer in iOS, Android and WebGL builds.
    1. Does DR2 support P2P on iOS, Android and WebGL app built with Unity?
    2. Which license will I have to buy to use these features?
     
  14. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Hi ericon,

    Glad it looks promising!

    Unfortunatley I'm not sure DarkRift meets your needs. DarkRift isn't designed for peer-to-peer games and, while I think one or two members of the community have managed it, it's not how it's supposed to be used.

    If you can adjust your architechture to use a relay server or an authoritive server then DarkRift would be a great fit but DarkRift isn't really a good choice for peer-to-peer.

    The DarkRift client can run on iOS, Android and now, thanks to the work of the community, also WebGL; so if you did choose to user a relay or server or authoritative server you should be able to target all three platforms.

    Jamie
     
  15. ercion

    ercion

    Joined:
    Aug 15, 2016
    Posts:
    73
    @Jamster Thanks, I'll check it out.
     
  16. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    852
    Hello @Jamster,
    we are the team behind Real Drift Car Racing, a quite successful mobile drift racing game.
    We are planning to implement real time multiplayer for our game.
    Players will have a expertise lever (it will be zero for everyone at the beginning).
    A player can select several rooms (drift race, time attack race, timed event etc). The player will be matched with another player with around the same level of expertise. Once found, the race will start (so only two players with two cars that dont collide each other). Ideally the player can also race also against a ghost saved on the server (so there will be a leaderboard with the best players with the relative ghost to race against). The winner will have its expertise level increased, the loser will have it decreased.
    This is clearly a competitive multiplayer, so I need a service with an authoritative server and client prediction.
    Is this possible in DarkRift?
    I read here (https://docs.google.com/spreadsheet...KUtRqO4cmTewQI8P5uwf-Qb9k/edit#gid=1012362019) that DarkRift doesnt support room list build in, is this true?
     
  17. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    852
    I think that the best approach for our use case is:
    "Client Auth, Predicted Movement With Server Side Sanity Checks With Commands"
    This case is a hybrid of fully client predicted, server authoritative and client auth. The server still owns entities, but the client essentially moves his entity in a client auth fashion and simply sends the final result to the server as command input. The Command inputs do not contain traditional inputs but rather the result of the client movement (position, rotation, etc). The server then receives this input and moves the player to the position / rotation / etc requested in the command input. The server has a chance here to look at the player’s movement request and decide if it is valid or not. If not, the server does not have to apply the same result to proxies. In this case the server will violently correct the controlling player by sending back an event to the player with his new position which will be an obvious visual artifact.
     
  18. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Hi @newlife,

    Glad you're considering DarkRift!

    Starting with your latter message, I think that approach is a good choice, and one that's commonly used. You might also find that (using the Photon Bolt name as you have) "Completely Client Predicted, Server Authoritative Using Commands" is a good approach as well; this works very well for fast paced games such as yours, but not so well over mobile devices so it's something to bear in mind and potentially revisit if needed!

    Regarding the first question however, DarkRift has built in matchmaking not a built in room system like other solutions do. What this means practically is that DarkRift can group players together intelligently based on the metrics you have for them (in your case, their 'expertise level') but it doesn't handle the interaction once they're grouped into their 'room'.

    The reason for this was that a 'room' in DarkRift would essentially be a glorified list of layers becuase DarkRift, unlike other solutions, doesn't really delve into the logic of how players interact. For example, Photon needs the concept of a room in order to distribute messages only to players within that room where as DarkRift doesn't dictate how your messages are distributed (you do!) so a room system really would be just a list of players!

    I hope that's helps, feel free to post any other questions you have!

    Jamie
     
  19. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    852
    Hello master,
    Thank you for your reply. Why do you think that this approach doesn't work well on mobile devices? Which approach do you suggest?
     
  20. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Sorry, that was poor phrasing, I mean over cellular networks where latency to the server becomes very high, not just on mobile devices! There needs to be fast communication with the server otherwise the server's simulation and client's simulation will diverge too much.

    I think you have the right approach, I would build it using the "Client Auth, Predicted Movement With Server Side Sanity Checks With Commands" approach first as I think that's likely the best option.
     
  21. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    852
    Is there an example of this approach with darkRift?
     
  22. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    16
    Hi, I accidentally discovered DarkRift Networking 2 when I was looking into network programming. I read through most of the thread and I have a few questions.

    Basically I'm working on a competitive card game similar to Hearthstone. I'm thinking I'd run the main game logic on the server side for security purposes (and to discourage hacking) while providing feedback on the Unity client side.

    So my questions are:

    1. Does it make sense to use DR2 for this type of game?

    2. How does DR2 deal with disconnects/lost connectivity? Basically I'd like to keep track of people that are disconnecting and count it as a loss.

    3. I read in an earlier thread DR2 doesn't have load balancing. Are there any plans to add it in the future?
     
  23. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    @newlife There's Allmaron's FPS tutorial but I believe that uses the other approach I suggested rather than the one you want, perhaps it helps however!

    @BitPax Sounds like a standalone DarkRift server would fit the bill perfectly!

    DarkRift has events for all major client interactions, so if a client disconnects for whatever reason an event will be fired that you can subscribe to to be informed and mark their game as a loss!

    Yes, hopefully the next release will include inter-server communication, which will make it much easier to build large scale server systems! Loadbalancing it definitely still possible using a DNS loadbalancer at the moment though!

    Jamie
     
  24. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    16
    Thanks for the quick and helpful reply! That's good to know. Two more questions:

    1. Are there tutorials on how to set it up on a Linux distro like Ubuntu?

    2. What are best practices for security when using DR2?
     
    Last edited: Oct 4, 2019
  25. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    No worries!

    1. There's no tutorial on it, but it's essentially just running a .NET app on linux which there are plenty of guides online for! We've also got a lot of experience in the Discord server if you do get stuck :)

    2. What specific areas of security are you referrrring to here? Authentication/authorization? Hardening the server? Anticheating?

    Jamie
     
  26. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    16
    Oh ok, that's good to know! How do I join the Discord?

    Regarding the security I meant anti cheating but now that you bring it up, I guess I'd like to learn best practices for all of those.

    Also, if a person disconnects, is there a way to wait for them to reconnect for say, a minute or something before giving them a loss?
     
  27. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    https://discordapp.com/invite/cz2FQ6k :)

    Anticheating is mostly dictated by how you build your server and how much authority you give it. BitPax above highlighted this really good article for architecture design you should look at! The more authority you give your server, the harder it is to cheat.

    Hardening a DR server isn't too hard, it really just requires you to harden the underlying server (there's tonnes of guides around).

    DR doesn't have anything built in for reconnection but it's easy if your players have an account, because they can identify themselves with those credentials and you can then obviously carry on from where they left off :)
     
  28. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    16
    Man, DR2 sounds like everything I need for my card game.

    I'll probably buy the paid version. Can you provide links to documentation and tutorials and anything you think would be helpful?
     
  29. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Hope it is!

    The documentation and tutorial is here. :)

    There's also a lot of material on the wiki if you want other tutorials or good articles.
     
    BitPax likes this.
  30. Shablo5

    Shablo5

    Joined:
    Mar 2, 2015
    Posts:
    36
    What's on the horizon for Dr2? What do you see yourself tackling/improving/adding/etc over the next 6-12 months? What can folks get excited about?
     
  31. Jamster

    Jamster

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

    The first thing that's in the pipeline is Inter-server Communication which you should definitely get excited about! This will be released in alpha in DR 2.5.0 and will allow you to very easily mech groups of DarkRift servers together so that you can horiziontally scale your servers! For example, if you increased the number of game servers in your system DarkRift would immediately connect all of your matchmaking servers up to them so that you can start sending clients to them straight away and without any further intervention!

    The next thing on the horizon is a DarkRift 3 which is currently set to include a new message pipeline which will in the future allow compression/encryption of data, ordered messages and much better performance when using some plugins that can be multithreaded and others that cant!
     
    BitPax likes this.
  32. Cushmily

    Cushmily

    Joined:
    Mar 25, 2015
    Posts:
    9
    Hi,
    I am integrating MessagePack into my DarkRift plugin project. Everything works fine until I start my DarkRift server, and it said:

    [Error] PluginFactory Failed to load one or more plugins from DLL file 'Plugins/MessagePack.dll', see trace for exception and more info. Rebuilding plugin may help.

    Heres my project structure:
    Server -> Data & MessagePack & DarkRift
    Data -> MessagePack
     
  33. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Presenting: DarkRift CLI!

    I'm always looking at ways to make DarkRift development a bit nicer and one of the ideas I've played with for a long while was making DarkRift operate from a centralised location, rather than having DarkRift binaries scattered all over your computer in each different project you add networking to. With the recent chaos of bad DarkRift releases many of you have been trying to get old versions and the most frequently asked question here has been What version of DarkRift are you using? Have you tried 2.3.1?

    Hence, the other week I decided to do a little experiment and from that has come the DarkRift CLI tool!
    https://github.com/DarkRiftNetworking/darkrift-cli

    DarkRift CLI is a separate project to DarkRift and is designed to make using DarkRift a little easier! Here's some stuff it can do:
    - Manage the versions of DarkRift on your PC - if you want to get a different version just run `darkrift pull x.y.z` and it'll get it for you!
    - Run the correct DarkRift version for your project - type darkrift run and it'll start the right DarkRift version using the configuration file and plugins in your current directory!
    - Create new stuff! - if you want a new a new plugin project just type darkrift new plugin! New project? darkrift new project!

    This is very much a prototype/pre-release project at the moment but if it proves popular this will be definitely be a fully fledged side project for DarkRift! It's completely open source and I've already had a PR on it despite this being the first announcement it so I'm positive this will be be a great tool!

    You can get the first version from the GitHub releases page (see readme for instructions)!
    https://github.com/DarkRiftNetworking/darkrift-cli/releases
     
    BitPax likes this.
  34. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Hmm, DarkRift is trying to load MessagePack as a plugin which isn't very helpful! If I recall corectly off the top of my head you can put MessagePack in the Plugins -> Lib folder (i.e. a folder called Lib inside the Plugins folder) and DarkRift won't load it but you'll still be able to use it!

    Let me know if that works!
     
  35. Cushmily

    Cushmily

    Joined:
    Mar 25, 2015
    Posts:
    9
    Sorry for the late reply. I am not using MessagePack in those project now.
    But I did try putting MessagePack into Lib folder, and it still not working. Another error will be thrown.

    Anyway, thanks for your help
     
  36. TrulyStupidNewb

    TrulyStupidNewb

    Joined:
    Dec 8, 2012
    Posts:
    9
    I want to thank the DarkRift 2 team for providing me the tools to release my first online video game. It's just a small, solo project, but I put the library in the credits. I can't believe that such as good library is out for free with pretty much no limitations.

    I don't expect any players on my tiny MMO, but I'll be using DarkRift 2 on all my future projects that require online shared persistence (login, chat rooms, leaderboards, etc) or actor replication.
     
    BitPax likes this.
  37. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    Awesome to hear! Congratulations!

    Please do attach a link so I can check it out!

    Jamie
     
  38. TrulyStupidNewb

    TrulyStupidNewb

    Joined:
    Dec 8, 2012
    Posts:
    9
    BitPax and Jamster like this.
  39. kirbyderby2000

    kirbyderby2000

    Joined:
    Apr 28, 2017
    Posts:
    11
    I have really dumb questions. So I'm currently reading through the Dark Rift 2 documentation and tutorials, which is all fantastic by the way, great job! Now I only have a couple questions:

    1. Do I need a dedicated server with Dark Rift 2 in order for clients to connect to each other / matchmaking?
    2. If I do need a dedicated server, is there a guide or tutorial on how / where I can deploy the server? I can't seem to find any resources on this topic if it's required.

    Sorry, I'm pretty illiterate when it comes to networking but I'm slowly coming around.
     
  40. TrulyStupidNewb

    TrulyStupidNewb

    Joined:
    Dec 8, 2012
    Posts:
    9
    Deploying to your computer is easy! You just double click DarkRift.Server.Console and it's already deployed on your computer. However, your clients probably cannot connect to your computer. To do that, you need to open the ports in your router. You also need to redirect clients to your ip if you have a dynamic IP.

    An IP is like your internet address. The difference between a dynamic IP and a static IP is that the static IP will always stay the same, while the dynamic IP will change. If your address keeps changing, then clients cannot find you!

    If you type into google "what is my ip", you will find out your ip. You probably have a dynamic IP, since many ISPs require you to pay extra for a static IP. If you have a dynamic IP, you need to use a service like "NoIP", which is free (https://www.noip.com/). If you use NoIP, you have to tweak the UnityClient a little bit to take in a string instead of an IP.

    Now that you have clients finding your ip, you have to let them communicate with your computer. By default, windows and the router block all suspicious communication to your computer. That's a good thing! You don't want people getting access to your computer. However, this is also a problem, because now they can't talk to DarkRift2. We need to fix that.

    Access your router by typing 192.168.1.1 into your browser. You need to do two things. First, you need to forward all activity for a certain port to a certain device, and then open the port.

    Why do you need to forward to a certain port? Because you likely have multiple devices connected to the internet. Your phone, your tablet, your PS4, your computer(s). Each one has a local ip. When the client contacts your ip, which device to talk to? You need to specify that.

    The router sends the information to different devices using the local ip address (127.0.0.x), where x is a different number for each device. You need to look in your router for the devices connected to the router, then find the computer which has DarkRift2 running. Once you find that local ip, you need to open the port for that ip. For example, if your DarkRift2 port is 4296, and your DarkRift2 server is running on the computer using 127.0.0.5, you need to forward port 4296 to 127.0.0.5.

    You also have to be careful because your local ip can change. Your computer might be 127.0.0.5 for a few months, but then suddenly become 127.0.0.6. It's happened to me before.

    Make sure to open the right port for darkrift. It's defined in your Server.config file in the same folder as your DarkRift server. By default, it is 4296. You need to open that in your router. Every router is different, so I can't tell you exactly how to do it.

    If you found that helpful, you can subscribe to my youtube channel (same name as my forum name). I don't have any DarkRift 2 tutorials yet, but I could do some if the demand is high enough. I only have one person in the comments asking for tutorials, so the demand isn't there at this moment.

    The problem with making tutorials for DarkRift2 is that it will likely make my game much more hackable, as people will understand the way to communicate with my game. I prefer to keep the knowledge of my game private, which will increase the work required to make tutorials.
     
    Last edited: Nov 14, 2019
    Branko87, BitPax and kirbyderby2000 like this.
  41. TrulyStupidNewb

    TrulyStupidNewb

    Joined:
    Dec 8, 2012
    Posts:
    9
    I also have a question. When I send a bool in Darkrift, is it 1 bit or 8 bit?
     
  42. Jamster

    Jamster

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

    1. Yes you will! You can do what @TrulyStupidNewb suggested, which is a good option for quick testing but once you release you will need to deploy on the cloud somewhere like AWS/GCloud/Azure/DigitalOcean etc. (or if you really want, invest in hardware yourself!)
    2. Deploying a console based DarkRift server is the same as deploying any normal C# application such as an ASP.NET site, deploying a Unity based server is quite similar as well but probably a bit more familiar. There should be quite a bit if information out there for that!

    If you send a boolean using WriteBoolean it's 8 bits, if you send using WriteBooleans they are packed into as few bits as possible, in multiples of 8 (so in maths speak ceil(n / 8) ).
     
  43. kirbyderby2000

    kirbyderby2000

    Joined:
    Apr 28, 2017
    Posts:
    11
    Wowza! This is a terrific explanation! Thank you! Definitely going to subscribe to your Youtube channel. There's definitely not enough Youtube resources that show how to implement Unity multiplayer (since Unet has been deprecated that is). Cheers!
     
  44. TrulyStupidNewb

    TrulyStupidNewb

    Joined:
    Dec 8, 2012
    Posts:
    9
    Hello, I have another question!

    How would you recommend to track network usage? I want to give users an expected bandwidth consumption rate so they don't unintentionally exceed their mobile phone data plan. I know it's game-dependent, so was wondering if there was a way built into unity, darkrift, or elsewhere to keep track of the size of data I'm sending/receiving.
     
  45. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    DarkRift can tell you the number of bytes it has sent and received from a client during the entire session so you should be able to write a quick plugin to output that to a file etc. and then find an average!
     
    TrulyStupidNewb likes this.
  46. sid999_2015

    sid999_2015

    Joined:
    Jun 15, 2015
    Posts:
    9
    Hi @Jamster

    This may have been asked before, but does DarkRift 2 work with Xbox One and UWP?

    I've created a client, a server, connected both and sent messages between them in Unity desktop app, but when building the server as UWP and deploying to an Xbox One the connection fails due a timeout/no reponse.

    Inside of the UWP app manifest I've enabled the capabilities I believe are required, i.e. Client/Server, Intenet, etc, but no luck.
     
  47. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    As far as I know that only platform that it doesn't work with is WebGL (and even that is possible with a thrid party listener!) though I don't have an Xbox to test so I can't be certain.

    What is the timeout error exactly? There's two subtly different errors which tell you if it's TCP or UDP that can't connect which might help you debug your issue!
     
  48. sid999_2015

    sid999_2015

    Joined:
    Jun 15, 2015
    Posts:
    9
    A SocketException is throw with the message:

    A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    I'm using a configuration file to initialize the server. Is there anything in there I would need to change? Right now it has the DefaultNetworkListener with the IP 0.0.0.0 and port 4296, but I have also tried changing this to the IP of the Xbox console.
     
  49. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,049
    That particular (cryptic!) error is suggesting that TCP can connect but UDP cannot. I'd make sure that the settings you've configured also included connecting over UDP as well as TCP!
     
  50. sid999_2015

    sid999_2015

    Joined:
    Jun 15, 2015
    Posts:
    9
    The settings I'm using are from the Server.config file included the DarkRift Server demo. I don't specify any specific TCP or UDP settings. Also tried a CompatibilityBichannelListener, but again, no luck.
     
unityunity