MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

[vNext] Replace Windows Networking UWP code in GenericNetworkTransmitter with UNET compliant code

Open flarb opened this issue 9 years ago • 11 comments

I'm digging through the SharingWithUNET example and one thing that makes it tricky to work with is that GenericNetworkTransmitter contains a bunch of UWP code that can't be executed in the editor. It makes it a pain to debug, for one thing.

As far as I can tell, it's using this code to send bytestreams to the other client for anchors. I think it would be much easier to use if this code was converted to use UNET's (albeit somewhat cumbersome) method of sending binary data between clients. You can see some examples on how to send large bytearrays via UNET here:

http://answers.unity3d.com/questions/1097155/unet-setting-up-a-new-channel-and-subsequently-mes.html

I'm eventually going to have to replace this code myself, but I was wondering if anyone else was already thinking about this issue or if this code is absolutely necessary to remain UWP code for some reason. (Maybe some Windows UWP security issue or something?)

flarb avatar Jan 18 '17 19:01 flarb

You should be able to build the Visual Studio solution and debug the code with the HoloLens emulator, if there was an immediate thing you wanted to investigate.

Ziugy avatar Jan 31 '17 16:01 Ziugy

Why not provide an Editor-only implementation using System.Net.Sockets instead?

r2d2rigo avatar Feb 07 '17 17:02 r2d2rigo

@flarb any progress?

I strongly desire the ability to create standalone PC builds so that I can quickly debug networking issues. While I understand it won't be perfectly representative of a real HoloLens application I still think there's a vast array of issues that could be quickly debugged and solved on PC if we could spin up more than 2 instances at a time. (The 2 instances are: Unity Editor and HoloLens Emulator through Visual Studio. Perhaps a 3rd could be spun up as a standalone metro app but I don't know how to make it windowed)

Plus, anything that we can do to make it easier for someone to roll off the Unity networking tutorial and immediately begin networking HoloLens applications will reap very strong benefits in usability and adoption.

chadbramwell avatar May 16 '17 15:05 chadbramwell

@chadbramwell I've been working on the same issue. It took a bit but I finally managed to get a version of the Unity networking tutorial app running in the Unity editor connected to an instance running in the emulator. I lightly modified it to work with HoloLens. But this was not using any of the more complex code from the SharingWithUUnet code and not dealing with WorldAnchors, so not sure how useful it would be in a real world setting, but definitely a starting point.

I had gone through the networking tutorial so to that I added the usual HL input management. I added some simple UI to replicate the Network Manager HUD and allow for choosing client or host. I ran the Host on the emulator and the client on the Unity editor. The only trick was that I couldn't use localhost for the Client connection address. It required one of the IPv4 settings on the emulator — I went through them all and it turned out to be an Emulator Adapater that had a subhead of "(Used only for diagnostic purposes)" which threw me for a bit. Once I used that it connected right away, spawned the enemies, could move turn and shoot.

genereddick avatar Jun 23 '17 06:06 genereddick

@genereddick It would be a great help if you could share the code or guide us on how you managed to do it. I have been looking for the same functionality (bare minimum) for some time as a starting platform. Though I was not using HLAPI, I tried to use it with NetworkManager and emulate the NetworkHUD for a simple client/host scene with only player Spawn prefab. But StartHost doesn't even work in emulator. It does in Editor. If I use StartServer in unity and client in hololens, I can see emulator changes in editor. Cant debug the code in emulator since its built in D3D mode. That's another thing I am trying to figure out-how to debug live in emulator when project is Built in D3D (and not XAML) mode in Unity.

krishnan-unni avatar Aug 25 '17 23:08 krishnan-unni

Nevermind. I figured it out. I'll share the code if it is helpful for someone else.

krishnan-unni avatar Sep 01 '17 01:09 krishnan-unni

@krishnan-unni @genereddick I would love if one of you could share code. I'm looking to use UNET to communicate via sockets from HL to a C++ application and trying to test it in the editor, but I've been having a lot of issues. (I've previously used dotnet sockets on my android app, which was MUCH easier but doesn't seem to work on UWP/HL?)

shllybkwrm avatar Nov 20 '17 22:11 shllybkwrm

@shllybkwrm I didn't use sockets to communicate. Its very simple using UNET HLAPI (beginner\novice grade). Also it's in .C# not C++. I have explained the process here: http://unicodeexception.com/2017/10/24/share-holograms-hololens-unity3d/ It contains the code too (its small). So I am not sure if it meets you criteria. Though it may give you a starting point. I'll try to help if you explain what you are trying to achieve or what issue you are facing.

krishnan-unni avatar Nov 20 '17 23:11 krishnan-unni

@krishnan-unni Ah, I see. I don't believe I can use the HLAPI for my purposes - Thanks for the link anyway! My application isn't relevant to this thread so I'll continue trying things and post a new issue if needed.

shllybkwrm avatar Nov 21 '17 20:11 shllybkwrm

Marking as vNext as to avoid risk of breaking changes in master.

david-c-kline avatar Mar 23 '18 20:03 david-c-kline

Revamping the whole service now that uNET is depreciated.

StephenHodgson avatar Nov 09 '18 15:11 StephenHodgson