Integration with Photon Cloud: Multiplayer

0 favourites
From the Asset Store
This is a simple login feature to access Metamask in construct 3. Requires a Chrome Browser and Metamask Extension.
  • which was Taurian's original challenge.

    Watch this space!

    Yeah well beggars can't be choosers. Can't wait to give it a shot. Amazing work Velojet!

  • Awesome work, I look forward to experimenting with this.

  • [EDIT 4 April 2013: PLEASE NOTE: My Dropbox files in this message are no longer available. They're superseded by the

    PhotonClient behavior that I've now released.]

    OK. Here's the alpha version of my PhotonPlayer multiplayer plugin:

    PhotonPlayer

    Be warned that, as an alpha version, it's quite rudimentary. But it does implement the essential multiplayer functionality: it allows you to run the same (grid-based) game in a second locally-hosted browser window and see the first browser's player moving around the grid in real time.

    What it doesn't let you do at this stage is:

    • have more than two players, each in their own browser window
    • have any sort of interaction between the two players.

    So it's basically just a proof of concept at this stage, which is why I'm not yet announcing an official release in the 'Plugins for Construct 2' forum.

    To see it in action, you'll need a HTTP web server running on localhost (I use WAMP server, but you may prefer XAMPP or plain Apache or IIS ...). Set up a folder on that web server from which to serve games that use the PhotonPlayer plugin.

    Change the <font face="Courier New, Courier, mono">scriptsDir</font> variable in the PhotonPlayer plugin runtime.js (line 34) to point to that folder.

    (You may like to check out the rest of the code - hopefully, I've put enough comments in there for it to make sense to anyone who knows JavaScript and Photon.)

    Next, download and install the Photon 3 server SDK to run on localhost (port 9090), together with a free license (here's help).

    You'll also need to download and install the Photon JavaScript SDK: Photon-JavaScript_v-3-0-0-3-Beta_SDK.zip - there's an INSTALL.txt file in the package.

    Now take this capx of a demo 'game':

    PhotoDemo

    You can preview it in Construct 2, but you won't see its multiplayer character until you export it (don't minify it) and install the resulting files (c2runtime.js, index.html, ...) in the folder you've set up for it on your web server.

    Now fire up your web server.

    Start Photon Control as an application.

    Open a browser (either Firefox or Chrome) and access the localhost address where you installed PhotonDemo (with its c2runtime.js and index.html) (for me, the address is localhost/dev/photon). You should see a screen similar to the one in my screenshot above (my post of 29 June).

    Click the 'join' button. Open a second browser, give another nickname to your second player and click 'join'.

    Move your first player and you should see it also move in the second window. Move your second player and you should see it also move in the first window. You're multiplaying with Construct 2!

    -------------------

    The PhotonPlayer edittime is just a duplicate of the Sprite edittime at this stage. Obviously, it needs some added actions, conditions and expressions (ACEs) e.g. to be able to check the positions of remote players. Those ACEs will be added in due course, but not for a week or so, yet. Next week, my Construct 2 time is going to be spent on trying to throw together a competition video <img src="smileys/smiley2.gif" border="0" align="middle">

    In the meatime, please feel free to ask questions. And of course, I'd welcome any comments you might have.

    And a BIG THANKS to Taurian for putting me onto Photon! <img src="smileys/smiley20.gif" border="0" align="middle">

  • I'm new here, so I'm not sure about my posting boundaries, but I would love to just interject that I am very excited for the streamlining of the multiplayer aspect for Construct 2. I began doing the outlining on my first big project and it turns out that it may rely heavily on multiplayer and it will be worlds better if it can be more than just local. Everywhere I have looked for real info on Construct 2 and Multiplayer has wound me back to Taurian's work, so a special thanks to him. I'm looking forward to seeing the knots hammered out of the deal and implemented into a future update. This was the make/break decision that will have me developing for Construct.

  • Stercus

    Thanks for your positive feedback!

    Try out my multiplayer PhotonPlayer and let's know what knots need hammering out!

  • Velojet

    This is really exciting work!

    I'm just trying out your multiplayer game but can't seem to get it working. Can you clarify what you mean by installing the Photon SDK on localhost port 9090? I think this is where my error is. The Photon site isn't super helpful.

    I have the server up and running and I run Photon control as application but I don't see my player move in the other window when I move in the first window.

  • iprene

    Thanks for your comments!

    I agree that the Photon site isn't super helpful!

    I could have been more helpful too! I see that I omitted a crucial step (now corrected):

    ** You'll also need to download and install the Photon JavaScript SDK: Photon-JavaScript_v-3-0-0-3-Beta_SDK.zip - there's an INSTALL.txt file in the package. **

    If Photon is properly installed locally, it should run on port 9090 - that's where the PhotonPlayer plugin expects to find it.

    Does the Photon Testclient return the expected results for you?

  • really nice... I will try to hop on to find out how to get the most out of it in combination with Construct :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Velojet

    Thanks for the fix! I've downloaded the JavaScript zip file and I believe I followed the install instructions. I can run their chat.html test sample and that seems to work fine with two browsers.

    Sorry for the problems (I'm very new to servers and such), but I still can't get it to work with your gridgame. I've re-exported and restarted Photon Control. When I run the Testclient, it tells me the game server is at 127.0.0.1:4530, so this is what I suspect is the problem, but I don't know how to make it run on port 9090...

    Thanks again!

  • iprene

    No need to apologise! We were all new to servers once (and I'm still new to the Photon server!). (@Taurian is more familiar with it, and offered to help, so he might like to chime in on this one.)

    It does sound as if it's the port setting that's your problem.

    The WebSocketListener port that Photon uses is set in PhotonServer.config line 70: Port="9090"

    (PhotonServer.config is in app\deploy\bin_Win...

    (I can't recall setting this by hand, so something in my install must have done it.)

    Don't hesitate to keep on asking (but I hope it works for you now <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I'm very excited to get into using this, but unfortunately, my game model is not ready to be exported into a playable demo (As I've only put about 12 hours into it thusfar). I'm praying that development is rapidly continuing on this as it has been and will be more familiar to the engine when I have something that I can run. Keep up the great work, guys!

  • Just posting to say this is awesome ;] Keep up the good work!

  • Velojet

    Thanks for the fix! I've downloaded the JavaScript zip file and I believe I followed the install instructions. I can run their chat.html test sample and that seems to work fine with two browsers.

    Sorry for the problems (I'm very new to servers and such), but I still can't get it to work with your gridgame. I've re-exported and restarted Photon Control. When I run the Testclient, it tells me the game server is at 127.0.0.1:4530, so this is what I suspect is the problem, but I don't know how to make it run on port 9090...

    Thanks again!

    iprene, you can load up the photon console log to see what is going on. Maybe post it here.

    Right click on the Photon Server in the task bar and click "Open Logs"

  • That's a very interesting concept about multiplayer in C2.

    I'm pretty sure the developers will come up with something solid for the tool in the future.

  • From the first post in this topic:

    This would be a great addon. The ability to communicate with Exit Games: Photon Cloud Service ...

    They have a Photon Javascript SDK ...

    I'm just not quite sure yet how to make the two communicate.

    It's clear to me now that their Javascript SDK doesn't communicate with the Photon Cloud. It requires a standalone Photon server (as does my PhotonPlayer Construct 2 plugin, that uses their SDK).

    I've posted an enquiry in the Photon forum about chances of getting a JavaScript/HTML5 SDK for the Photon Cloud.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)