Forum Multiplayer Multiplayer in Unity WebGL

Discussion and help relating to the PlayerIO Multiplayer API.

Multiplayer in Unity WebGL

Postby LorenzGames » February 12th, 2017, 9:25 pm

When is support for Multiplayer in Unity WebGL slated for?
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby Henrik » February 13th, 2017, 7:30 pm

When there's first-class support for TCP sockets in it.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby LorenzGames » February 13th, 2017, 7:35 pm

Do you know if Unity has any plan for that in the future?
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby Henrik » February 13th, 2017, 8:05 pm

I have no idea, sorry.

We are working on a sort of workaround solution though, we'll announce it when it is ready.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby tripknotix » February 21st, 2017, 7:46 am

If you need a beta tester let me know, i can test my mobile game zombie ops online.
tripknotix
Paid Member
 
Posts: 28
Joined: March 12th, 2010, 11:00 am

Re: Multiplayer in Unity WebGL

Postby markloika » February 22nd, 2017, 4:45 am

I'm interested in this functionality as well.
markloika
 
Posts: 76
Joined: July 8th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby Evgeniy_Eliseev » February 28th, 2017, 12:30 pm

Henrik wrote:When there's first-class support for TCP sockets in it.


I don't understand about what TCP sockets you talking.

WebGL builds works only on browsers. Browsers works only with WebSocket. And there nothing on Unity side to make something else.
Evgeniy_Eliseev
 
Posts: 5
Joined: September 14th, 2015, 8:52 pm

Re: Multiplayer in Unity WebGL

Postby Henrik » February 28th, 2017, 9:08 pm

Evgeniy_Eliseev wrote:And there nothing on Unity side to make something else.

Currently, using WebSockets in your Unity code depends on pretty horrible hacks and workarounds. It's possible for Unity to add proper support for it, so that you can use regular Sockets inside your Unity code, and have it actually use WebSockets transparently.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby LorenzGames » March 12th, 2017, 10:25 pm

Henrik wrote:I have no idea, sorry.

We are working on a sort of workaround solution though, we'll announce it when it is ready.


Hi Henrik, I understand this might be difficult to answer, but what is a possible ETA for the workaround?
1 month, 3 months, 6 months...
Just a ballpark would be really appreciated if you can.

Thanks.
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby LorenzGames » March 29th, 2017, 5:34 am

Any news on this?
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby Henrik » March 29th, 2017, 10:49 am

Real soon now!
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby Astrovolts » April 9th, 2017, 4:15 pm

Interesting that the last post in the announcement forums was exactly one year ago. :)
Astrovolts
 
Posts: 7
Joined: March 11th, 2017, 8:29 pm

Re: Multiplayer in Unity WebGL

Postby Henrik » April 21st, 2017, 1:01 pm

The workaround is simply this: Instead of using the multiplayer functionality in the Unity client library, which would need some sort of awkward bridge between Unity and the browser to simulate sockets over websockets and external calls, embed the PlayerIO JavaScript client library on the webpage, and use it for all your multiplayer needs. The external call interface should fit pretty nicely with the message listener interface of the client library:

https://docs.unity3d.com/Manual/webgl-i ... pting.html
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby Evgeniy_Eliseev » April 24th, 2017, 8:33 pm

It is strange that I need write wrapper to wrap unity version of playerio and javascript version of playerio in unity :|

Also, I found that JavaScript SDK uses only insecure protocols (http/ws instead of https/wss). So it impossible to publish game to any social network. Try for example publish test project from package on the facebook.
Evgeniy_Eliseev
 
Posts: 5
Joined: September 14th, 2015, 8:52 pm

Re: Multiplayer in Unity WebGL

Postby Henrik » April 24th, 2017, 9:48 pm

Well, there is no regular socket support in Unity WebGL, so there has to be something somewhere that bridges this. It would be great if Unity added this bridge themselves so that it would be completely automatic, but they haven't. The remaining choices is then either to marshal socket data across the external call interface, or to marshal PlayerIO messages, and the latter just fits the external call interface so much better, that it is the current best choice.

Thanks for pointing out the secure websocket requirement. Annoying, but there's support for secure multiplayer connections in the other client libraries, we just need to get it working in the JS one as well.

We'll be working on polishing the JS client library in the immediate future, your feedback is much appreciated! We'll try to make a proof of concept or recipe for Unity WebGL message marshalling as well that others can use.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby LorenzGames » May 7th, 2017, 2:54 am

Hi Henrik, any ETA regarding the support for secure connection in the JS library?
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby Henrik » May 7th, 2017, 4:37 am

LorenzGames wrote:Hi Henrik, any ETA regarding the support for secure connection in the JS library?

That was fixed and released two days ago. :-)
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby LorenzGames » May 11th, 2017, 5:51 am

Thanks Henrik,
do you guys have an example of marshaling Unity to PlayerIO JS?

And more specifically regarding the connection.OnMessage and PlayerIOClient.Message, how do you send that from JS to Unity?
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby LorenzGames » May 14th, 2017, 9:09 pm

Has anybody been able to successfully interface this with Unity?
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby Henrik » May 18th, 2017, 4:55 am

Hey Lorenz,

Sorry, no, we haven't created any examples yet, we'll try to get it done soon.

In the meantime, have you tried following the steps in the Unity docs I linked above?
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby LorenzGames » May 18th, 2017, 6:01 am

Hi Henrik, yes.
The problem is not implementing the JS part, I am having issues with figuring out a way to deal with the callbacks.

My whole logic to handle the Messages is in C#, so I would like to figure out a way to send the whole "Message" back to C# from JS to be parsed. Maybe if there was a way in JS to say Message.toBase64 and the in C# Message.fromBase64 I could pass it as a string in the SendMessage function?

The best way would be to be able to use the DLLImport but looks like the JS version of PlayerIO is incompatible to be used that way in Unity, unless I am missing something.
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby LorenzGames » May 31st, 2017, 6:46 am

Hi Henrik, any progress regarding a demo project to show best practices for Unity->JS->Unity?
LorenzGames
Paid Member
 
Posts: 108
Joined: March 28th, 2010, 3:46 am

Re: Multiplayer in Unity WebGL

Postby Henrik » June 15th, 2017, 11:52 pm

This is now fixed, and the PlayerIO Unity SDK has built-in support for multiplayer in WebGL builds.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Multiplayer in Unity WebGL

Postby tripknotix » June 16th, 2017, 6:07 am

Thats fantastic news ! , does that mean it also works with facebook gameroom as well?
tripknotix
Paid Member
 
Posts: 28
Joined: March 12th, 2010, 11:00 am

Re: Multiplayer in Unity WebGL

Postby Henrik » June 17th, 2017, 8:06 am

tripknotix wrote:does that mean it also works with facebook gameroom as well?

Yes, it should.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to Multiplayer