JavaScript/HTML5 SDK for Photon Cloud?
Options
Comments
-
A JavaScript/HTML5 SDK for the Photon Cloud is planned for but not in the near future, sorry.0
-
Thanks, Stefan. I'll watch this space0
-
Over 200,000 Construct 2 users potentially await this JavaScript/HTML5 SDK :arrow: :idea:0
-
teahousemoon wrote:Over 200,000 Construct 2 users potentially await this JavaScript/HTML5 SDK :arrow: :idea:
I highly doubt that this is even remotely accurate as JS users have a powerfull server solution already at hand to develop the whole backend with NodeJS.0 -
dreamora wrote:teahousemoon wrote:Over 200,000 Construct 2 users potentially await this JavaScript/HTML5 SDK0
-
Very welcome news about the upcoming JavaScript library ("it will feature a heavily improved Websocket support and is Photon Cloud compatible, sure thing").
Sounds great! Eagerly awaiting!0 -
0
-
Marvellous news! I'm sure it'll be worth the wait. Feedback to come.0
-
Hey, I'm from the Construct 2 dev community and just want to express my support for a Photon Cloud and Construct 2 integration.0
-
laice wrote:Hey, I'm from the Construct 2 dev community and just want to express my support for a Photon Cloud and Construct 2 integration.
In that case, you'll be interested in my just released Construct 2 plugin/behavior for the Photon Cloud.0 -
Velojet: That looks very promising! Cool you're working on that.
If you like to, advertise your plugin in our forum, too. At the moment, the "Any Topic" forum is the best place for it. And the JS forum of course.0 -
I am having a hard time connecting to Photon Cloud using the new Javascript SDK. Following the installation instructions, I specified the address of the masterserver as app-eu.exitgamescloud.com:5055, and added my app_id.
When I open default.html in either example (loadbalancing and particle demo), pretty much nothing happens. The client does not connect. The browser inspector is showing some missing javascript dependencies (photon-lite-constants.js, photon.js, photon-loadbalancing.js, and cloud-app-info.js), but all of them are marked as <dev> in the html, so I am assuming they are not necessary.
Here is the screenshot of the console with all the errors:
See full-size image here: http://s4.postimg.org/addf76we5/error.png
I've asked two of my friends to try to connect to Photon cloud on their computers, and neither of them was able to do so with the examples provided in the SDK.
What are we doing wrong?0 -
cmb wrote:I am having a hard time connecting to Photon Cloud using the new Javascript SDK. Following the installation instructions, I specified the address of the masterserver as app-eu.exitgamescloud.com:5055 ... What are we doing wrong?
MasterAddress: "app-eu.exitgamescloud.com:9090"0 -
Thanks, this helped. But I am still confused as to why the port has to be 9090? Photon Unity Networking uses port 5055. And I have no problem connecting there. Why can't Javascript SDK connect to the same port? When I connect via Javascript SDK I do not see the rooms created by my Unity game. How do I make both of them use the same lobby?
EDIT: After some googling, I understand that Javascript SDK is using Websockets, while PUN is using UDP, and that's why the ports are different. However, I would still like to be able to connect both types of clients to the same game. Is it at all possible?0 -
Even though different ports are used, the clients are able to join the same lobbies and games. The ports are different but either is opened by the Photon Server and operations end up in the same process.
Clients identify themselves as some title by supplying the AppId and their "Game Version" - a string usually set through Connect(version). If AppId and GameVersion are the same on two clients, they end up in the same lobby, no matter which platform they are.
Photon Unity Networking (PUN) is a special case though. It adds a layer of logic on top of the operations, responses and events we provide with "pure" Photon to make it work like Unity's networking API. The problem is: Flash does not have the same logic as Unity has. There are no GameObjects, RPCs, PhotonView components or 3D positions as framework in Flash. Maybe some of that is available but certainly not in the exact same way as Unity.
Instead of trying to make PUN communicate with Flash, use our Photon Unity SDK. It doesn't define the Unity-related workflow and you get direct control of what you send and the format you're sending it in.0 -
Tobias, thanks for your clarification.
I found what was causing the problem. PUN adds its own version number to the game number that one specifies in ConnectUsingSettings("1.0"). So even though I launched both my Javascript client and my PUN client with version "1.0", they didn't see each other because the PUN client actually used "1.01.18" as its version when connecting to Photon Cloud.0 -
Tobias, I think I've come across a bug in the Javascript SDK.
I'm making a Unity-based game in Playmaker that integrates with PUN for networking. Since PUN is built on top of the plain Photon Unity3d SDK, at the low level it uses the same plain API that the Javascript client would. However, some of the events passed by the PUN client do not get parsed by the Javascript client properly, and the latter throws syntax errors due to unexpected input.
In my case, I am using a webapp as a masterclient that does not have any visual frontend, and simply contains authoritative logic for the game. I connect all Unity clients and the Javascript masterclient into the same room, and can exchange events between them most of the time. However, for certain kinds of operations, like network instantiation, Javascript SDK shows the following error:
Full-size image:http://s13.postimg.org/dvrxkeq47/Screen_Shot_2013_05_08_at_6_03_45_PM.png
This corresponds to the line in the SDK where it parses the incoming message:
Full-size image:http://s21.postimg.org/z8cu34t3b/img2.png
Is there a way to fix this problem?
Thanks for your help!
P.S. Most other events get parsed properly:
Full-size image:http://s1.postimg.org/nimnyj64v/img3.png0 -
I almost expected something like this.
Why it works in most cases: When a PUN message (any event) only uses data types that are common to both client types and the server, then the server can "translate" the sent event and JS clients can use the data. Strings and numbers can be translated to Json easily and some messages in PUN are made up of those exclusively.
Like I wrote earlier, the PUN framework adds several "Custom Types" which make (e.g.) Vector3 serializable. This allows us to send a Vector3 in any event.
Other clients don't know this type. Worse: The server doesn't know these types and blindly passes-on the byte-array that represents the Vector3.
This shouldn't exactly break the JS client but it's also nothing we expect to work seamlessly. Sadly, we can't support this level of cross-platform communication and you need to "transform" your sent data into built-in datatypes which JS can understand, too.
You could try to avoid all custom types in PUN but most likely you can't do this for Playmaker. In either case, you would lose most of what PUN could do for you, as those features rely on custom types.
In best case, you could switch to the LoadBalancing API which is in the [urlhttps://www.exitgames.com/download]Photon SDK for Unity[/url] and use common datatypes which JS can consume and send easily. That would be a clean solution.0