Integration with Photon Cloud: Multiplayer

Discuss game development design and post your game ideas

Post » Tue Apr 02, 2013 1:17 am

As @Taurian said in the OP, "This would be a great addon. The ability to communicate with Exit Games: Photon Cloud Service."

But we had to wait six months before ExitGames came out with their JavaScript Cloud SDK. And then you had to wait while I converted the alpha version of my PhotonPlayer plugin for the Photon Server (see my post of 7 July 2012) to a PhotonClient behavior for the Photon Cloud. And I had to wait till the busy Photon team found time to join in on the development.

But I decided I couldnt wait, so Ive pressed ahead on my own, picking my way through the rather sparse internal documentation of the Photon Cloud JavaScript SDK, to come up with a Construct 2 demo of my PhotonClient behaviour for the Photon Cloud.

This is what you can expect to see when you run the demo and youre the third to join in with two players already playing on two other PCs (Ive not tested it on other devices):



So, to get my Workout demo up and running:

1) Register with ExitGames for a Photon Cloud Account on their Forever Free Plan, which gets you an app with a maximum of 20 CCU. Youll be given an Application ID that youll need in Step 4. (Its a generated identifier for your Photon Cloud application, used when an app client connects. It separates the users of your app from users of other Cloud apps.)

2) You now need access to a HTTP web server (if you haven't got access to a remote server, you can use localhost for an in-house demo). Set up a folder on that web server from which to serve your workout demo Ill call it photonclient.workout in the following steps.

3) Download the Workout demo files from my Dropbox account: https://dl.dropbox.com/u/54915877/photon.workout.zip

4) Into your photonclient.workout folder, copy all the files from the Dropbox download, preserving the subfolders (css, images, media, photon).

5) Load into a text editor the cloud-app-info-template.js file thats in the photonclient.workout folder.

6) Save that file back into the same folder renamed as cloud-app-info.js.

7) Edit it to change the MasterAddress string value to your nearest Photon Cloud Master Server you can find a list of them at http://doc.exitgames.com/photon-cloud/Regions/#cat-reference. You'll need to replace 'port' (following the colon) with '9090' (just the four digits, not the quotes).

8) Change the AppId string value to the Application ID you were given in Step 1.

9) Open a browser (Firefox/Chrome/Safari/IE10) and access the photonclient.workout address where you copied my Workout demo files, and which now also contains your own edited cloud-app-info.js file.

10) Type in your 3 character nickname and click the 'Join' button.

11) Text a friend and get them to do the same. (If you havent got a friend, you can go to another computer yourself and do the same. If you havent got another computer, you can open a second browser and do the same.)

12) Move your player and your friend/you should see it move in their/your other computer/browser. You're multiplaying with Construct 2!

13) Try banging into one of the other players.

OK, so now youre keen to load my PhotonClient behavior into Construct 2 and try developing a multiplayer game for yourself. Im afraid youll have to wait (yes, again!) for a couple of days while I complete the documentation. In the meantime, heres a tantalising excerpt from the event sheet for my workout demo (just to prove it really has been made in Construct 2):

Velojet2013-04-07 22:08:00
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Tue Apr 02, 2013 3:36 am

@velojet
THIS IS GONNA BE SO AWESOMEEEEEE
Also, I dont get step 2! D:InvaderX2013-04-02 03:37:07
B
29
S
7
G
3
Posts: 361
Reputation: 6,187

Post » Tue Apr 02, 2013 4:22 am

I dont know how to do the HTTP Server thing hehe, my game is not linking with my friend's game.
B
13
S
3
G
3
Posts: 62
Reputation: 2,192

Post » Tue Apr 02, 2013 4:29 am

@InvaderX
@SpacialPumpkin
Step 2 / "the HTTP server thing" is crucial. Maybe wait till you've mastered how to set up and deliver files from a web server.
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Tue Apr 02, 2013 4:32 am

I don't understand. I thought this whole thing was so that way we wouldn't have to use a server, that photon's cloud would handle everything. I don't know anything about http servers.
B
13
S
3
G
3
Posts: 62
Reputation: 2,192

Post » Tue Apr 02, 2013 5:24 am

@SpacialPumpkin
OK. Let me try to explain ...

The HTTP server is needed to deliver the web page that allows (multi)players to access the game itself - just like any C2 game you make, when you export your project to a HTML5 website.

The Photon Cloud server handles the interactions between the players - which of course is something that's not needed when you play a game on a single computer/device. It saves you having to create a game server to do that.

And my PhotonClient behavior saves you having to fiddle with a low level socket plugin to get your players to interact with the game server Velojet2013-04-02 06:21:39
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Tue Apr 02, 2013 6:19 am

Ok so is there a way to do this easily? Like can I use dropbox for hosting the http server? If not dropbox, is there something like dropbox that does it for you, without your pc having to be turned on to host the server?
B
13
S
3
G
3
Posts: 62
Reputation: 2,192

Post » Tue Apr 02, 2013 6:27 am

@SpacialPumpkin
No, your PC doesn't have to be turned on to host the server. What you would do instead is get an account with a web hosting provider that would give you a web server from which you could deliver your game. That's the "access to a HTTP web server" that my Step 2 refers to.

(Dropbox is not a web hosting provider.)Velojet2013-04-02 06:35:03
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Tue Apr 02, 2013 6:35 am

@Velojet

I have a free 000webhost. This is my site. http://evantarctica.netau.net/ Is this an http server? Like could I just put the files there? How would I write the URL? Sorry for asking so many questions.SpacialPumpkin2013-04-02 06:36:57
B
13
S
3
G
3
Posts: 62
Reputation: 2,192

Post » Tue Apr 02, 2013 9:17 am

@SpacialPumpkin
That is indeed a HTTP server (see the http:// at the front of the URL) and the files could go there.

If you load them into a photonclient.workout folder (step 4), your URL will be http://evantarctica.netau.net/photonclient.workout/

No problem about the number of questions. HTH!Velojet2013-04-02 09:26:01
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

PreviousNext

Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 1 guest