A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Works In Progress - Archive' started by Jamster, Jan 20, 2016.
Possibly, I agree with the consistency aspect...
DarkRift 2 Beta has been submitted to the asset store!
Hi, Jamster. I only used to run Unity instance as my server. I've read that DarkRift can also run inside Unity. But it will have better performance if it runs as standalone. So, if I want to use physics in my game. Is it only possible to run DarkRift inside Unity? Is there any way to run DarkRift as standalone and can still enable physics in my game?
My past game are just normal multiplayer and they are not real time so Unity instance is good enough. I'm currently developing MMO game for my client. I've read many people in this forum said that running Unity instance as server is not good for MMO. I don't know the truth behind such statement. But it makes you wary if many people said the same thing. I would like to ask your suggestion. Do you think that DarkRift inside Unity is capable of running big MMORPG like Tree of Savior?
Hi @Jamster Is it possible to get an advance copy of the DarkRift 2 beta? I'm trialling DarkRift for use on a potential project and if v2 is nearly out it makes sense to focus on that if I can..?
Firstly, I'm going to pull DarkRift from the store again temporarily since I packaged a few things wrong and a couple of testers found a load of new, major bugs. An early release of the free version is currently available on the discord (pinned to one of the channels) so if you want to join the open beta please go there!
I'll hopefully put future builds up here as well but for now there a (buggy) build available there!
@jjobby Running things in Unity allows you to use things like physics really easily but there are performance limitations and it gets much trickier with large worlds etc. so it can make it very awkward for servers, particularly MMOs. On the other hand, a standalone server doesn't have world size limits (not that you'd want to have your whole world in one server anyway!) and would be better for performance but doesn't have built in physics etc.. So it's swings and roundabouts really but you can do either in DarkRift.
I've just realised I've been posting weekly updates on the Discord but not on here! I'll try and start posting more on here in future so that more people see it!
Recently I've been working on a new release for DarkRift 2; I've rewritten the log system to allow you to write custom log writers as plugins and import them into DarkRift, this means you can get DarkRift to write out to databases etc. as well if you need and it should offer more flexibility than the previous system.
On top of that I've been doing a similar thing for DarkRift's persistence layer. Previously, I was using SQLite but for some reason it would only work if DarkRift was forced to use 32 bit mode hence not allowing it to run as well on 64 bit servers (which is most!). I've now also made this a plugin-based system so that you can configure exactly where DarkRift should store it's persistent data and this should make it significantly easier to add server-server communication/proxies later. I've included a basic XML based storage plugin that should work out the box but it's possible to make DarkRift store in databases, another format, etc.
Of course there was also a DarkRift 1 release that fixes a bug with lagging players and numerous bugfixes on DarkRift 2
Thanks man, I LOVE DarkRift Networking very much! Great to hear DarkRift 2 is under development.
DarkRift2 Beta r2 and r2p1 released!
DarkRift 2 Beta r2
Lots of example code etc. now on GitHub
SQLite dependency has been removed and replaced with DataHandler plugins
LogWriters are now plugins
Lots of bug fixes
File path for FileLogWriter now more customisable
Configuration for log writers improved
(See updates channel for more details)
DarkRift 2 Beta r2p1
Fixed Unity Server and updated editor to latest DarkRift
ServerSpawnData now takes lists rather than arrays - Fixed XmlDataHandler bug
Don't forget this is still beta and there'll be plenty of issues! Please keep reporting things on the issue tracker
(Apologies for cross-posting this late!)
2 releases have been made this week for DarkRift 2! The majority of my time, thus, has been spent trying to package and test those releases beforehand so not a huge amount of functionality has been added. I have however bene able to address some bugs and documentation issues since the release and have added a Disconnected event to the client side (an oversight when writing it!). I've also taken some time to move a lot of my private repos to GitHub for things like the Agar tutorial completed code and the block demo plugin code. The link is available in the #links channel and it would be awesome if people wanted to help out with maintaining them!
This week I've had a lot of time on my hands so a lot's been done! I started looking into the UDP issues but found a number of other bugs in the process so I've had to fix those first; I've added a Disconnected event in the client (not sure why it wasn't there) and fixed bugs where UnityClient was passing events the wrong object as a sender.
I've also added performance enhancements to the internal plugins by unsubscribing them from events when they're not in use and I've redesigned the sniffer interface to be more clear and include new options:
sniffer add -t=100 -s=89
sniffer remove -a
Lastly, a lot of people (mainly those using PlayFab) wanted to be able to pass command line arguments to set parameters in the server so now you can pass the server variables to use when loading the configuration file. For example, to create a server on port 80 you could start it using
and define your configuration file to use that variable:
<server ... port="$(differentPort)" ... />
On top of that you can now pass in the name of the configuration file you want to load:
DarkRift.Server.Console.exe MyConfig.xml -differentPort=80
This week I've mainly been on holiday so not much has been done! However, this evening I was able to write some build scripts to make my life easier when building the packages.
I've previously been copying the files across by hand (hence the mess ups on some builds!) but for DarkRift 2 I've added an editor script so I can simply hit a menu item and it'll import the correct build into the project. It's fairly crude at the moment but it's a definite improvement over spending half an hour per package each time as I was for DarkRift 1!
I also had the opportunity to rewrite a post build script that organised the DarkRift files into the Lib folder as you see it. Instead of being a quick CMD command that frequently broke it now uses MSBuild to do it in a bit more of a stable way (I also really wanted to learn MSBuild!)
DarkRift 2 Beta r3
Added disconnection event to UnityClient
Disconnection events on client now invoked when the client causes the disconnection
UnityClient now pases itself as event sender rather than the backing DarkRiftClient
Internal plugins now unsubscribe from events when not in use
Redesigned interface for the sniffer plugin
Added command line arguments and configuration variables in the XML configuration
Added more information to disconnection events
Not much has been done the past week but I did get a chance to do some optimisation and greatly simplified one of the layers in DarkRift's internal protocol stack, this should mean one less object allocated for each message received and so shows a bit of a performance increase just using the demos!
Hopefully next week more will get done!
This week's work has been mainly working out the UDP issues trying to make sure they work across NAT routers. It turns out the way I had implemented UDP isn't very NAT compatible so I'm doing a bit of a rebuild to make it operate more similarly to how Hazel and TCP work, using one socket rather than one per connection.
I've learnt that my networking knowledge still has a lot of holes to fill!
Unfortunately (although fortunately for me!), last Sunday I built myself a gaming PC and have hence done nothing on DarkRift this week!
I wish I could update you a bit but all I can say is that NieR:Automata is a pretty good game
DarkRift 2 has caught my attention. I do have a question. On the websites it says that DarkRift does not use Area of interest, so I am wondering how DarkRift connected users handle unnecessary requests from users that are not in proximity? This would be important for an mmo with a large world.
DarkRift 1 doesn't have any AoI built into it and doesn't come with any packages like so it requires that users write it themselves in their plugins. DarkRift 2 now has an AoI helper which you can use in your plugins to implement this neatly but it's still optional so it won't interfere with games that don't require it.
For large open world games you would want to split users across multiple servers which still isn't supported in DR2 but will hopefully be coming soon after release! Nevertheless, you can certainly build similar systems with DarkRift and people have done in the past.
A little more productive this week! The UDP issues have all been fixed and the clean up done, there's possibly a few vulnerabilities in there so it might be a fun exercise for you guys to try and break the server with corrupt connections etc.! Go for it!
In this update there actually been quite a lot despite it not really showing from the updates. Most majorly, the UDP is now all fixed but it's also worth pointing out the new message command...
The message command is now mostly there and allows you to send out message from the server as if you were a plugin. This has already been super useful in sorting the UDP issues as I could really easily send a message to check if Unity was receiving it or if the router had not been punched through correctly. To use it you simply write:
message <id> <reliable|unreliable|r|u> (-t=<tag>) (-s=<subject) <data...>
Or as an example that's easier to follow:
message 2 reliable -t=0 -s=9 00 00 00 00
There's perhaps a good opportunity here to also add a mocking command to test plugin functionality and perhaps even aid integration testing a little!
Of course there the usual bug fixes, some of which were rather awkward (thanks Unity!), and the usual optimizations in the message pipeline trying to remove large copy operations and object allocations. Hope you enjoy! Don't forget to check out the new release!
DarkRift 2 Beta r4
Fixed missing documentation on some types in both DarkRift and the Unity package
Fixed bug causing selected plugin types to unselect on play in Unity
Added profiling to DarkRift client events in Unity
Optimized the message frame layer to reduce the allocations per message
Optimized out a memory copy in reliable sends
Fixed bug stopping the IP to connect to being changed in Unity
Added error details to problems when loading the configuration file
Moved XmlConfigurationException to DarkRift.Server
Converted IP addresses to IPEndPoint types so the port is accessible
Partially added message command (bugs remain, no documentation still)
Fixed UDP hole punching issues
Added new images (more to come)
DarkRift 2 Beta r4p1
Removed profiling to fix build issues in Unity 5.5+
DarkRift 2 Beta r4p1
Added missing server archive
Just updated Beta r4 to include the missing server archive!
Very late but this week I was able to finish off a few things. Firstly, the message command received a few bug fixes so that it no longer adds a 4 byte length to the start of the data (oops...) and secondly the mock command has also been added. The mock command is essentially exactly the same as the message command except instead of sending the message to the client it injects it into the server as if the client sent it. These 2 combined should make testing and debugging a little easier! There's a few little bits to do like abstracting out the code into one class but it's most certainly complete in functionality now.
I have also finished off the build pipeline. Previously the build pipeline had a gap in the middle between building the server project/arranging the built assemblies into the structure you see (e.g. with the Lib folder etc.) and importing it into the Unity project on command. Basically I couldn't find a neat way to package up the build into the zip archive automatically so I had to do this manually each time before importing into Unity (else you'd get the wrong server or worse, none at all). Now I'm using the MSBuild Community Tasks library to zip it all up every time it's built
It would be nice to get some automated deployment to the asset store/website going but I'm fairly sure that's impossible
This week (all 4 days since the last update) I've been able to do some optimizing! I've significantly reduced the number of allocations per message that DarkRift 2 has both server side and client side by recycling objects. This is still a work in progress but it should bolster performance and reduce the frequency of garbage collections in your servers. There'll be some breaking changes on release as you'll have to use
etc. rather than just
but in beta I'm just marking them as Obsolete.
There may be a few issues with maintaining references to old items if they get recycled but I'll make sure there's plenty of warnings in the docs when they get updated!
Since losing the recycling code temporarily (left it on my old hard drive...) I've been working on some other features for the next release. I've removed the analytics database table that was kept behind the scenes (check the data folder!) since this wasn't suitable for production servers as it would become quite large in file size and wasn't actually being used for anything anyway. This has been partially replaced by a clients table which only tracks the clients that are currently connected so in future you can locate clients across servers. This change also makes the ID allocation unique across all servers sharing that database but will change how IDs are allocated (at least temporarily).
I've also been doing some work on the bad word filter in the pro version, renaming and making it less intensive on start up (it no longer downloads the latest bad word list each time).
On top of this I've also remove the dependency on the Unity Standard assets which no longer work in Unity 2017+ and have been working on an updated website for release!
Hopefully there will be a new release soonish!
DarkRift 2 Beta r5
- Added message command
- Added mock command
- Removed analytics data persistence
- Renamed Profanity Filter to Bad Word Filter
- Added local caching for bad word list
- Removed dependency on Unity Standard assets
- Fixed compilation error in Unity 2017+
- Add access to data manager for pro users
- Internal build process improvements
This release includes the Pro version!
This past week not much has happened (and even less will next week!) but I have been able to remove the demo scenes dependency on the Unity standard asset pack since this had compile errors in Unity 2017+, it still uses the same script but it's massively simplified so that it is more self contained.
I was also able to move the Bad Word filter (previously Profanity filter) into a plugin so that it can have it's own commands and can run code of its own accord. This allows it to now download and cache the bad word list so that it doesn't run each time you create the filter! I'm hoping to do similar for the Room system, AoI and any future helpers but they will be slightly more complicated to do.
I've also made a release with all the latest updates, checkout r5!
Recycling has begun once again! Rather than try to salvage the code off my old hard drive I've decided to restart the recycling code and I'm pretty much back to where I was but I think I've done it better this time.
Firstly, why recycle? Every time you stop referencing an object in .NET you create garbage and, once you amass enough garbage, the garbage collector will eventually stop your code and clean up. This is obviously bad in a server because it can introduce lag and other problems when it triggers, also allocating objects is very slow. To get around this DarkRift will recycle objects as much as it can! This, however, is going to introduce a few breaking changes. Most of the changes are simply deprecations and so you'll just get warnings until you change your code (though the code will be removed before release) but there are 1 or 2 breaking changes.
DarkRiftWriters, DarkRiftReaders and messages all now implement IDisposable so when you are done with them you can return them to the object pool as you would normally with IDisposable
using (DarkRiftWriter writer = DarkRiftWriter.Create())
Also note that you use Create() now so that it can get a recycled instance if there's one available.
Messages are no longer shared between event handlers because that makes recycling the message really tricky, you can now use e.GetMessage() which will return your function its own copy - put it in a using statement and it will get recycled once you're finished with it. This does however mean that DistributeTo has gone because changes to the message will no longer persist between event handlers.
Recycling will be the main change for the next version, there's still more to do in future but most of the public facing changes are now done, I need to cache arrays (a nightmare because they're all different sizes!) and I still need to find a way of caching event arg objects (a nightmare because of the dispatching for Unity!)
Hello, we are looking forward to the Darkrift 2.
A fairly late update here, my life is insanely hectic at the moment so I'm lagging behind on everything!
Not a huge amount has happened understandably. The main thing has been removing the Simple and TagMessages and renaming everything from TagSubjectMessage to just Message but the pipeline in DarkRift is now much slicker!
I've also managed to make a few documentation improvements and fixes as I've come across them on this!
If you haven't already, vote on the poll in the DR2 support Discord channel so you can have your say on whether the TagSubject messages change or not!
This week I have been finishing the changes to the messages. Now there is just a single Message class with a 2 byte tag, subjects are now gone!
This has mainly been done to reduce wasted header space on messages (most people weren't utilising all 24 bits) but should also simplify things a little. For those of you previously using Tag/Subject pairs you can either split the new Tag with some bit shifting to get any bit ratio you want between tags and subjects or you can just use sequential tags in an enum/constants.
I want to make a release as soon as possible but documentation is holding me up as there's quite a lot to change with these more major changes plus I have a lot of work on at the moment
Is Hazel free ? Is there any limit to the number of simultaneous online users?
Yes it is it's a MIT license. Nope, no limit.
DarkRift beta r6 is released!
This week (apart from being hectic) has been all about updating the documentation for the latest release. Naturally, changing the messages meant that almost ever code snippet in the tutorial had syntax errors so they've all had to be updated and that took a lot of time!
In terms of beyond this week, I'm hoping that there will only be one more beta release and then we can release to the asset store properly! The r7 will contain some backtracking and a few more breaking changes that need to be made (I apologise for that by the way, I said I try to minimise them...). I've had some long hard thinks about how I want to do inter-server communication and so there's a number of things I want to get setup and get right so that we don't have to wait till DR3 for inter-server comms! I'm hoping with these final changes it could be available within 6ish months maybe.
I'd also like beta r7 to be the last beta as I think it's been long enough - if I don't put a limit on it then DR2 will never leave beta! That might not be the case, but I'd like to release around new years or just after, about 2 years from when I started the writing DR2!
DarkRift 2 Beta r6
- Fixed bug in logging that crashed the server when there were large plugin names
- Fixed bug in logging misaligning text
- Moved to single message type with 2 byte tag
- Added message factory method for messages with no data
- Added clarification to block demo readmes
- Fixed code mistake in tutorial
DarkRift beta r7 released! Hooray!
Sorry there hasn't been an update since the last release, I kept remembering and then forgetting again...!
Since the last release a lot has happened, DataHandlers have been removed because only plugin metadata needs synchronising between instances, so IDs will now be unique per server (I originally thought that they'd need to be globally unique but they don't). DataHandlers will make a return when inter-server communication arrives
The way plugins are loaded has slightly changed, there is now a pluginSearch section in the config and in ServerSpawnData which specifies where DarkRift should find plugins/logwriters. You can then load them as you need using the plugin and logging sections and can now also specify settings to be passed to your plugin as done with the filewriters. By default DarkRift will just load the plugins directory still though
The issues with the Unity based servers have all been fixed now as well! You should be able to connect and it shouldn't crash when you try to enter play mode for the second time. This was down to DarkRift using a method not supported in Unity and that apparently caused all the mayhem.
There's also been loads of smaller fixes as you can see in the changelog. Have fun!
DarkRift 2 Beta r7
Improved ID allocation algorithm
Client reference added to MessageReceivedEventArgs
ClientManager merged with ConnectionManager
DataHandlers temporarily removed
Sniffer now states which connection received the message
Encapsulated BadWordFilter plugin so it can't be disposed accidently
No longer says "Success" as a reason for disconnections
Added plugin resource directories
BadWordFilter no longer hangs the server when the website is unavailable
Corrected name of SendToRoom method in AoI
Mock & message plugins now allow empty messages
Empty messages now properly trigger the server MessageReceived event
Send methods now return a boolean rather than throwing errors
Reviewed ServerSpawnData and added pluginSearchPaths
Fixed Unity server issues (added another workaround because Unity is broken)
Awesome work on the DR2 mate. Look forward to it. I have been playing with DR1 for a bit now and love the standalone server. Just hoping that in the documents you will make reference to the changes from DR1 to DR2 as well so it will be easier to identify what folk need to go back and change when porting over? (Probably stating the obvious since I haven't looked at the DR2 docs yet)
Keep up the good work.
I've included a section in the docs for upgrading so it should help you find where things are in DR2. Of course, I still recommend taking the time out to flick through the tutorial to understand the changes in a bit more depth
Once my project has more entities for a multiplayer session I'm diving into DR 2.0 API. Can't wait for it!
Once again I've been useless at the updates so I apologise for that; to be honest though, not much has happened until this week...
For those following along in the #general channel on the Discord you'll have seen the BenchmarkNet tool developed by nxrighthere. Apart from doing a bit of work to get Hazel included in the results, I've also been using a modified version to put DarkRift through it's paces. While DarkRift did much better than Hazel, there was a memory leak which I've been working to get fixed the last few days. This sort of stress test is really useful and will be used on every release to ensure it's up to performance, hopefully that'll also continue to get more thorough as BenchmarkNet is developed as well.
To solve the memory leak I'm bringing forward some of the optimization work I had planned for after release and that's just proved a little more complicated than expected (I think I've worked it out though)!
Looking to the future, I've been thinking about documentation and the website. I have a new version of the website to go (there may be some outages as I test it because I'm moving it to ASP.NET Core) and that's probably going to be done this weekend. I'd like to integrate the documentation with the website more but I think that's out of scope for what is achievable by me singlehandedly and also not worth the effort. I'm certainly looking to improve the documentation format and potentially move to a more open system. Firstly, I'd like to hang on to old versions of the documentation for people who can't upgrade as easily; secondly, I'd like to move the non-reference documentation over to GitHub so users can contribute, update and make it generally better; and lastly, I'm fed up of using XML to write documentation (bad, bad idea) so I'd like to move to markdown and potentally DocFx which I've discovered today!
Sorry about the lack of updates, I'll aim to be more active!
It appears we're nearing release!
The past week has mostly been focused on getting an updated website setup and on a brand new server which I fully manage. It should be a darn sight easier to update content and handle the 3 different websites that it's actually composed of. You'll also notice it has SSL encryption now because... well... why not! (don't go to www., it appears to be broken ) The email still isn't working from the change over so don't try and email me at the moment.
In DarkRift, the memory leak has been fixed and I've added a new object cache to the server and client as part of the fix. This is essentially a centralized point for DarkRift to recycle objects at and it's now possible to configure the recycling a lot more than you previously could. For example, if you're finding you have a lot of Message objects being allocated you can increase the cache size for the Message object so more are stored and reused. This is available on both the client and server and more types will be available in there for configuration after release (currently: writers, readers, messages and SocketAsyncEventArgs; soon there will be: various byte array sizes, event args, possibly dispatcher tasks, possibly mutexes, and more I haven't thought of yet!) There's also an entire section on this in the next release's docs.
There's also been a number of other small changes made, Message.SetWriter has been renamed to Serialize for consistency (and because "SetWriter" implies wrong things about the internals of the Message class), the bad word list got reuploaded and then lost again with the server change (doh!), and some bugs were fixed in the logwriters so that they no longer crash when you put write messages out too quickly.
It's looking like DR2 could be submitted to the asset store before the next update, it'll likely take around 5-7 days from then before it gets approved so keep an eye out here!
Would love to see some BenchmarkNet results for this
Yea, I'm also very excited!
It's been tested, and on my i5-5200 processor laptop it passes all the tests, I can't remember the exact figures but they're a slightly higher than the lower level libraries. It does much better than Hazel does!
It's also worth noting that this will release with a subset of the optimizations implemented just because of the time I have; performance and, in particular, memory use should improve with new releases.
It's time for a slightly late update! Sorry...!
This week has been focussed on the last remaining task before release (I think) which is to get the Room and AoI systems future proofed, converted to plugins and generall up to scratch. The first of that has turned out to be rather larger than expected as I need to ensure that it will still work when rooms/sectors etc. are spread across multiple servers which get's complicated understandably. I'm rejigging quite a lot of the implementation to make it a bit more modular which should then mean that it's more flexible to your game, more scalable and generally better.
Obviously, that's going to take more time than I expected but I really am trying to get it released as soon as possible.
And that's about it. There's still no email, but I'll get that sorted soon as well!
I'd love to try to use this in my next project, do you have an idea of when we could expect this to be released?
You can grab the beta release above if you want to get stuck in right away or if you'd rather wait for full release I'm hoping to send it off for review in the next few days, after that it usually takes up to a week to get approved!
Slightly early update this week!
Release is near! We've decided that we're going to release one final beta just to ensure everything is ok before release! I will then hopefully be submitting to the asset store before the end of the week! This should ensure that there aren't any major bugs still lurking, that being said it's pretty fast release cycle so it would be good if everyone could upgrade to r8 and check it!
The room and AoI systems, however, will not be released as they require more work to future proof and improve still. These should be released in a beta form within the next couple of weeks and then will join with an early DarkRift release at some point.
The other biggest acheivement this past week is that the email has been fixed so now email@example.com should go through to me again!
Other fun things that have now happened include there being a new bug tracker/feature request board on GitHub (should be more familiar for people than BitBucket): https://github.com/DarkRiftNetworking/DarkRift-Networking/issues
And the repo also has a wiki which is publically editable so if you want to ad resources, tutorials, code snippets, literally anything we have a single place to put it! https://github.com/DarkRiftNetworking/DarkRift-Networking/wiki I might at some point move some of the official guides/articles there as well so that only the reference is on the website, I'm unsure
Lastly, there's now a forum thread for release! Go ahead and like it! https://forum.unity.com/threads/darkrift-networking-2.516271/
DarkRift 2 Beta r8
- Added missing EventsFromDispatcher option to UnityServer component
- Removed obsolete API items
- Made resource directory free (hooray!)
- Added recyclign section to documentation
- Made various improbvements to readers/writers
- Made included LogWriters thread safe
- Added object cache and recycling for SocketAsyncEventArgs objects to fix memory leak
- Wrapped IDatabaseManager in an interface
- Made PluginRecords an internal class
- Reuploaded the bad word list to the website again
- Fixed incorrect types for IDs in the Unity project
DarkRift 2 has been submitted to the asset store!
where? I only see Dark rift 1 on asset store.
It has only been submitted to the store it needs to be approved by the store moderators before it shows up. You can find the beta versions in this thread if you scroll up
EDIT: It appears I forgot to attach the last beta, sorry!
Is there any console commands for DarkRift.Server.Console.exe?
There's a number of commands you can use or you can configure your own in your plugins. Try invoking help sniffer to see the commands you can run on the sniffer plugin for example