Which server is better choice for multiplayer in PlayCanvas

Hi,

I’m planning to develop a a multiplayer game which include matchmaking (able to connected connected client or user able to create custom session) and turn base ( each user able to attack once per round) function. I found some game servers is provided part of the service which are :

  1. colyseus.io : The one I most preferable because it provides matchmaking and turn base but it does not provide database (which mean I need to use external database service for login system and store user data)

  2. playfab.com: Provide matchmaking but turn base seem like need to code myself. The benefit is it
    got leaderboard which able to track, compare and reward player success.

  3. photonengine.com: It provide matchmaking and login system.

Are there any better option out of this three that also support node.js ( I’m using node.js glitch as my backend, feel free to comment other method that you using currently) or which one do u think the most easiest and convenient to use.

As I use choose to use Playcanvas as my game engine and I searching for any server that support other functionality. In addition, playcanvas still consider new not like unity and UE4 that their website provide tutorial to connect the server. If there any indication or who have experience link the game server to playcanvas can just let me know under the thread.

I really appreciate any opinion or advice.

There’s a photon starter kit that a forum user had made public https://github.com/utautattaro/Photon-for-PlayCanvas

Other services (that I haven’t tried) are

Any of the service that you and I have listed should have JS SDK and documentation that all you to use any JS based engine.

Eg Colyseus has the following documentation for browser based games and engines https://docs.colyseus.io/getting-started/javascript-client/

1 Like

@DevilZ, you’ve used photon before for a few projects right? Can you sure some of your experience using it with PlayCanvas please?

Hey @yaustar, sure, I’d be very happy to share our experience with the framework. The primary reason we use photon is because of the very low setup time, since almost all server side boilerplate is taken care of by the photon cloud. Something to note here - if extra server control is required, you can go for the photon server option instead, both are supported in the plugins. Despite this, the speed offered by the framework is phenomenal, and faster than what we’ve seen from a regular node.js server or Nakama.

In terms of documentation, @Ryotaro.TSUDA’s github link that you shared goes a long way in explaining how it works(https://github.com/utautattaro/Photon-for-PlayCanvas). In our experience, creating a project from scratch using your own credentials from the photon dashboard and not by forking the starter kit is a far better way of understanding how to integrate it. Here, we must ensure that the scripts loading order is exactly as mentioned in the documentation. The starter kit should be used as a reference, but the logic that needs to be written in terms of user interaction naturally depends upon the project. As long as the event listener that receives the events from other players is in the update method, any kind of data can be sent across. Photon also provides a very useful ‘actorNumber’ with each event that allows one to pinpoint which ‘actor’, i.e which player, has sent that message, so one can take the correct action based on that.

I hope this has helped @Elliot, and please let me know if you face any problems.

3 Likes

Thanks @yaustar for the recommendations. I will look into it and compare which one is better for my budget and situation. And the photon starter kit is a good start to have further understanding on how game server work with Playcanvas.

Wow… Sound like photon is a a good choices for me which provide multiplayer and server at the same time. Yesss, your experience definitely help me a lot to start my project. So far you already answer my question and thanks for help. Appreciate for your reply as well.

1 Like

Sorry for disturb you again @DevilZ, something strange happen in the process implement the photon engine.

As you mention early, don’t fork the starter kit better do it myself so I able to understand how the photon engine function. So I create a new project and try to do it. I follow the steps and issue come in Step4:

app.js to become playcanvas script object
app.js must be playcanvas object.
INSPECTOR > SCRIPT > SCRIPTS click "PARSE"

which write in githuh . I unable parse the script and keep the appear at the left corner.
Error1 .

I not even able to fill my appid :joy: :joy: and attach it to an entity. Is the SDK problem that haven’t update for 2 years or my personal issue. I also already make sure my scripts loading order same as the documentation.

Can I know what wrong with my project??

PS: the Photon-Javascript_SDK.js is the file that I download from Photon website. The version that I using is V4.1.1.0


> type or paste code here

Yeah I’ve had this problem in my last project, I think it’s to do with the new SDK. Go ahead and delete your old app.js script, and then create a brand new blank script called ‘app.js’. Inside this, erase all old content and paste the contents of app.js from the starter kit. No need to fork it, just copy paste the contents of the script from that project.

Another error happen :joy: Is that happen to you too?

error3
Thanks for your quick reply.

Hey @Elliot,

No I haven’t seen that issue before :thinking:. Can you post your console output? And if possible, could you please share a public project link?

Sure @DevilZ This is my link to editor
https://playcanvas.com/project/801852/overview/photon-testing

I’ve put in the app.js script I use for my projects and it seems to work fine now. https://playcanvas.com/editor/scene/1170822

1 Like

WOW…The app.js that your give me look a bit different from the githuh but that reason why it working. Thankssss.

Sorry for one last question :disappointed_relieved: When I hit play it give me the error Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS. after I fill the appid. Is that normal or abnormal behavior?

And I notice my demoloadbalancing.js unable to parse as well.

Really sorry keep disturbing you :disappointed_relieved: :disappointed_relieved: Hope you don’t mind it.

Have you created a manager.js as is done in the starter kit?

I’ve never had to parse that, that doesn’t need to be added to any entity.

Ya , I already create manager.js as well and attached it to an empty entity.

Hmm, that is odd, I’ll definitely have a look when I’m back at my PC, but it didn’t happen to me when I ran the project last night. Can you post console output?

Here you go.

I also feel frustrated when doing this.

Hi @Elliot,
Can you please take a look at this project? I think it may help you…

Unfortunately, i did not get time to continue experiments… :roll_eyes:

1 Like

Thanksss, I didn’t noticed this thread before. I try out this method but unfortunately same error come out after I launch WebSocket connection may not be initiated from a page loaded over HTTPS. which also happen to you as well. I suspected something go wrong with Photon_JavaScript_SDK.js but I unable to fix it. Sad man :disappointed_relieved: :disappointed_relieved:

Hey @Elliot, I’m sorry for the late reply, but had a very busy day despite it being a weekend. I’ve fixed the issues your project has, and Photon is working perfectly now. https://playcanvas.com/editor/scene/1170822.

1 Like