☑ How To Use Photon With Playcanvas

I downloaded the mmo server sdk for javascript from Photon but I have a problem. I have no idea how to attach it to my PlayCanvas project. If anyone can tell me how to do this or preferably do it, tell me.

Could you please provide your question with a link to SDK?


Hi .

I was successful to create multiplayer sample using photon with playcanvas.
I was to refer to load-balancingsample in photon-js SDK.

Project overview is here :

Please refer to it : )


Thank you man! Thank you a lot for taking the time to program this!

@Ryotaro.TSUDA Real quick, which scripts do I copy? All of them there? Or can you set them up yourself? The project is here.

Hi @AmbushGames

  1. After forking project, you should copy all script that is under the “photon” directory.

  2. You should create empty entity as photon control manager on playcanvas.
    Next, you will attach app.js for control entity. you will be able to use photon cloud, after you create photon account and get AppID.

  • If you want to use Photon server, you must change app.js, loadbalansing.js.

Oops! is your project using Legacy scripting ?

The project by me is created by script2.0,so you must change script to legacy if you want.

I’ve connected the Photon server in another project, but the UI is in the way and my Doom style fps controller won’t accept keyboard input. The project is here. Is you want to change anything yourself lemme know, but I just need to know how to move the UI out of the way and fix my controller script.

As far as I can tell, you don’t have the first person script controller in the project @AmbushGames

In terms of the UI, Ryotaro moves the UI out of the way by switching the CSS from style.css to gamestyle.css. You can see the swap in manager.js, lines 43 and 108 when the player joins and leaves the ‘room’.

Ah, thank you for the explanation. I don’t remember implementing the controller, I will have to do that.

Thanks @steven for adding explain :slight_smile:

@AmbushGames I just released Photon-for-PlayCanvas plugin!

The plugin is wrappered photon-jsSDK for using playcanvas.
It is to small, so you can insert to your project easy.


Thank you for adding this. This will help very much in my online projects. I will install it immediately.

Hi @Ryotaro.TSUDA, I forked your project: https://github.com/utautattaro/Photon-for-PlayCanvas
But it is showing error in my playcanvas account.
i.e :

But when I play from your project it doesn’t showing any error.

Moreover you instructed in Git Readme instructions that upload PhotonJascript_SDK.(min).js in project. But in this project I am unable to see that script anywhere.

Heh I’ve came close to fixing this problem when I was trying to make a simple multiplayer game but there was always a problem with the appid or the photon cloud server didnt connect the way it should I’ve been to figure out this but I just doesn’t work.
So now I’m either gonna do multiplayer manually or I’ll be purchasing a higher account on playfab to do the server stuff on there:wink:

you need to download Photon Javascript Sdk,
Here is the link

Then insert Photon-Javascript_SDK.js file inside project and manage Script execution order same as like @Ryotaro.TSUDA said in his tutorial.

1 Like