Search Unity

standalone library binaries (aka server.dll)

Discussion in 'Multiplayer' started by aabramychev, Apr 14, 2018.

  1. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Ok, we decided to open access to everybody who interesting in "sever.dll" project. It is standalone library whihc allow you writing c# program communication with unity clients via unet. For example you can try to do lobby server, or chat server. and so on.

    Binaries has been released for Windows, Linux and Mac. All of them are 64 bit (do not forget this when you will use them). All of them should work with .Net core. Code base, last version of unet (we did some work on performance recently) should be compatible with any 2017.x and 2018.x clients.

    The library is provided as a preview/beta still, and we’ll provide best effort support for it. It’s under the UCL license included in the zip file.

    I will try to add c++ interface in the few next weeks.

    http://files.unity3d.com/multiplayer/unet-server-1.0.0.9_b8a58aa1e70d.zip
     
    Last edited by a moderator: May 4, 2018
    _FLX, jpthek9, rigidbuddy and 5 others like this.
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Was that only for UNET-Server or for LLAPI in general? And is this in 2017.4 LTS?
     
  3. Fijit

    Fijit

    Joined:
    Sep 1, 2011
    Posts:
    7
    Thanks for the lib,

    Trying to run SharpPart project for testing and apparently there is no entry point for SetReceiveCallbackFunc in UNETServerDLL.dll.

    The exception is on line 33 of SharpTransportProvider.cs which eventually leads to line 31 of GlobalProfileInternal.cs

    Code (CSharp):
    1. GlobalProfileInternal.SetSendCallbackFunc(this.m_PGlobalProfile, config.SendCallback);
    I compiled all libs as x64 and copied the UNETServerDLL.dll file from the /lib folder as per instructions so I must have missed something :)

    Screenshot of exception attached in case it helps

    upload_2018-4-14_12-51-47.png
     
  4. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @Fijit ups, looks like i forget fix examples and docs: Callbacks name did change. Use these please
    Code (CSharp):
    1.  public NetworkEventAvailableCallback NetworkEventAvailable  //old ConnectionReadable
    2.         {
    3.             get { return m_NetworkEventAvailable; }
    4.             set { m_NetworkEventAvailable = value;  }
    5.         }
    6.  
    7.         public ConnectionReadyForSendCallback ConnectionReadyForSend //old SetSendCallbackFunc
    8.         {
    9.             get { return m_ConnectionReadyForSend; }
    10.             set { m_ConnectionReadyForSend = value; }
    11.         }
    Or is it something else?

    @vis2k it is LLAPI in general only, actually it is full llapi part of unity.
    And is this in 2017.4 LTS - so far no, it will work with 2017.4 but has not migrated yet. When will it backported to 2017.4 - probably in month. We still working on performance improving. API and protocol itself have not changed. But i changed couple algorithms inside, removed stl containers and so on.
     
    Fijit and mischa2k like this.
  5. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @Fijit and you will need to change UNETServerAssembly.dll in SharpPart\SharpProject\Assemblies folder to the new one from lib folder. and I attached correct file with fixes

    Sorry about :(
     

    Attached Files:

    Fijit likes this.
  6. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    567
    I see people still have some confusion about what is this library, what is LLAPI, and how they are related to each other.

    UNet itself is a low-level transport and this server library, as well as LLAPI is an interlayer. So yea, they are doing the same job under the hood, but one made for standalone servers and one integrated with Unity for player hosted games primarily.
     
    Last edited: Apr 18, 2018
  7. Fijit

    Fijit

    Joined:
    Sep 1, 2011
    Posts:
    7
    @aabramychev I've applied your fixes and now it works fine, thank you :)
     
    aabramychev likes this.
  8. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    80
    Very good news for everyone using Unet and wanting to communicate with application outside of unity.
     
  9. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    When can we expect the C++ interface?
     
  10. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @TwoTen :( only time, I need 3 days to finish implementation and 2 days for testing and deploying, but I do not have this time... If you really need this, could you please kick my ass every week by mail with reminder that I promised?

    PS. As u can see the last time i was here couple of weeks ago :( No time et al.
     
    TheBrizleOne likes this.
  11. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Hello! I have a few suggestions:

    1. Please add an overload to the GetConnectionInfo merthod where NetworkID and NodeId is not requires as those classes are in the UnityEngine library.
    2. We REALLY need a Offset on the Send method. Right now we are tinkering by moving every byte forwards or backwards before sending the buffer and recalculating the size when we want to for example ignore certain parts of the buffer for sending.
    3. MaxConnections should not be a part of the CRC. We have written a UNET Relay so that users don't have to use Unity's relay as it costs quite a bit and we want self hosting. But we require users to set the MaxConnections very high. On the relay, we want the maxConnections to be very high as it will host many sessions. But we don't want the games to require that large of a maxConnections count. (I think it might be a bug that a CRC is thrown when the MaxConnections are different)
     
    Last edited: May 28, 2018
  12. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @TwoTen
    1. Will do
    2. Will add (but the length will still define the massage length, means
    offset = 5;
    Send(buff, offset, 10) --> means 10 bytes from byte no 5. ok?
    3. MaxConnections, hmm do not understand you, MaxConnection is not part of CRC...
     
  13. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Might be a bug? We are getting CRCDisconnect when changing the MaxConnections.


    Thanks for the implementations anyways!
     
  14. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @TwoTen ok will check today. BTW, c++ iface almost ready (just need to add example) if the changes whihc you pointed out is urgent, I can add them and publish new binaries on this week. Or on the next week with example
     
  15. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    The changes are not "urgent", we worked around it. But they will decrease performance of our application. And since it's a relay. Every bit of performance is important. Just take your time, and thanks a ton for the CPP interface.
     
    aabramychev likes this.
  16. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Please do ignore my MaxConnections "bug report". It was a fault at our end. No need to investigate that!
     
    aabramychev likes this.
  17. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    TwoTen likes this.
  18. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
  19. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @TwoTen Hmm, I do not see this function in browser, but I can use it, check please the path to assembly, if you will fail again ping me i will check zip itself:
    newsend.png
     
  20. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    So one small library and it only contains networking code? Sounds cool.

    There's no way to get PhysX included as well or as some optional module right?
    So we could check collisions against level geometry.
     
  21. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Not through Unity, but you could try through other means.
     
  22. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    I think something is wrong with the Zip, i'm not seeing the overloads after updating all references :(
     
  23. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    TwoTen likes this.
  24. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    aabramychev likes this.
  25. dzamani

    dzamani

    Joined:
    Feb 25, 2014
    Posts:
    122
    Hi @aabramychev, I'm trying to make a C# server using these libs but I'm having an issue when using addwebsockethost. It should be working since it's based on ServerDllDemo-netcore but I have this error : "web socket server has not been supported for this platform". I only replaced AddHost by AddWebsocketHost.

    It seems to be working if I do the same but with NetworkTransport inside Unity so I assume that the library is missing something ? Maybe something to say that we are a standalone build ? (maybe some define ?)

    I'm on a Mac now but I will try on Windows when I have a few minutes.

    Do you have any idea about this issue ?
    Thanks!
     
  26. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @dzamani - it is expected, I didn't include web socket library to server dll, as ("by design") I expected that this library will used only for udp connections. For web socket support it is easier to set real web server for handling web.socket traffic from clients. If you will decide to do this, ping me again i will explain protocol (it is very easy)
     
    nhold and dzamani like this.
  27. dzamani

    dzamani

    Joined:
    Feb 25, 2014
    Posts:
    122
    @aabramychev - Thanks, I've started a conversion with you so to not flood here.
     
  28. am1goo43

    am1goo43

    Joined:
    Dec 1, 2014
    Posts:
    4
    @aabramychev, Hey, Alexey. I have a question. Why this UNet library was stucked and don't invoke GlobalConfig.NetworkEventAvailable if two clients will send input states (1400 bytes limit for pack of input states) with sendrate 50 msg per sec (in FixedUpdate method).
    It's not a packet storming, it's not a much packets, strange situation.
     
  29. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Hmm, bug? Could you send me project for repro? Another possible reason, callbac called from worker thread, if you will do something fancy inside callback it will block network layer. Btw we distribute c++ example and c# example with lib, did you try to simulate this with examples ? It is quite strange:( hmm, not sure, i do not have code, but i guess after callback fired you should reaad packets before you will receive Nothing event. Try this please
     
  30. am1goo43

    am1goo43

    Joined:
    Dec 1, 2014
    Posts:
    4
    @aabramychev yes, it's my fault. Now, I read each message from the netLibrary, put it in incomming message queue, and only then in the main thread I process it.
     
  31. Juzpermsky

    Juzpermsky

    Joined:
    Mar 29, 2017
    Posts:
    5
    Алексей, добрый день! Не знаю, можно ли тут писать кириллицей.
    Во первых, огромное спасибо, что расшарили серверный код.
    Это нам очень помогло.
    Внедрили его в наш игровой сервер написанный на GoLang.
    Еще в мае.
    Игра наша всё ещё в стадии разработки.
    Были сложности со внедрением, но в итоге.
    Всё работает как часы...
    Но, периодически заглядываю в этот трэд, и вижу что динамики обсуждения давно нет.
    Хотелось бы уточнить, это был какой-то разовый импульс/порыв с выкладыванием кода? )
    Новые версии сервера будет как-то в дальнейшем выкладываться?
    Или динамика темы, с вашей стороны определяется потребностью аудитории?
    Или это действительно было разово, и в дальнейшем не планируется?
    Еще раз спасибо.
     
  32. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    UNET планируется удалить из редактора, поэтому я сомневаюсь, что он получает больше обновлений.
    UNET is scheduled to be removed from the editor, so I doubt that it gets more updates.
     
    aabramychev likes this.
  33. Saltless0

    Saltless0

    Joined:
    Apr 6, 2019
    Posts:
    3
    Hi , I want to make a cross platform game for mobile and web. Can you help me for adding websocket to unet ?
    Regards.