Multi-Player Question

Hello! I want to add multi-player to my first person backrooms game, and I’m going to use this example: PlayCanvas 3D HTML5 Game Engine
Just one question though, can I just add the first person movement script to the player? and it be a first person multi-player game still? Thank you!

Hi @SoySauceStudios!

Yes, but be aware in this tutorial the rotation is not multiplayer yet, so you need to add this yourself.

1 Like

Thank you, @Albertos ! Would you mind telling me how to do this? Thank you!

1 Like

I added the rotation in the example project below.

https://playcanvas.com/project/827020/overview/custom-multiplayer

Wow. Ok, thank you! One more question, do you know how to test multi-player with the project you just provided? Thank you!

As far as I know you just can open two launch tabs with the same project.

This uses Node.js?

Yeah… When I do that it doesn’t work… Is it just because my chromebook is operated by a school, because the server link in the network script is blocked. So is that it? Would I have to switch to a non-operated school chromebook? Thank you!

I checked the project(s) and it seems they are broken at the moment.

Ok. Is there any other way you know how to do multi-player?

First of all, creating a multiplayer game can be very complex. There are different ways of creating a multiplayer game and it need a lot of research to find out what is the best way for you.

Below an alternative with Photon instead of Glitch.

https://developer.playcanvas.com/en/tutorials/real-time-multiplayer-photon/

2 Likes

Ok thank you! I made my own Photon app and server and forked this project: PlayCanvas 3D HTML5 Game Engine; and put my app Id in and uploaded the Photon-Javascript_SDK.min.js. Mostly everything worked fine, but when I opened the room list(when I had another launch tab open,) I couldn’t see the room I created with the other launch tab, and the only way to join that room was to select ‘Join Existing Room Or Create’. That was a problem because in my backrooms game, I want it to show rooms so players can join their friends instead of joining a random room with the ‘Join Existing Room Or Create’ button. Thank you!

Here is my project link if you need it: PlayCanvas 3D HTML5 Game Engine

Thank you again!

1 Like

Hello, I am @ryutohaga, the author of this tutorial.

I have confirmed that the error depicted below is occurring.

In the forked project, could you please parse the script named “Room List” that is set to the Root entity within the “Room List” scene?

I believe the correct name should be “roomList”, but it appears the script was registered incorrectly.

This should resolve the functioning issue. However, please note that the functionality to JOIN a room is not currently present.

1 Like

It’s a simple implementation, but I believe that by modifying

room-list.js

photon-loadbalancing-playcanvas.js

you should be able to join a room!

https://playcanvas.com/project/1151585

1 Like

Wow… That worked perfectly! Thank you so much @RyutoHaga ! Another question though if you don’t mind, do you think I can turn it into a first person game by just adding the first person script to the player? Thank you again!

Regarding your question, the Player.js attached to player.js is primarily for synchronizing the position when there’s movement.

To turn it into a first-person game, you can go into the GameRoom scene and disable the movement script attached to the Root entity.

After doing this, if you add a first-person movement script to the player, it should achieve a basic first-person gameplay experience! I hope this helps!

Publish: https://playcanv.as/e/p/NNuBTH80/
Project: https://playcanvas.com/project/1151585

2 Likes

Ok thank you so much @RyutoHaga ! One more thing, do you know how to also update the rotation of the player like you update the position in the game?

1 Like

Oh wait, never mind I figured it out. Thank you!

1 Like

If I decide to change scenes while in the game room on a trigger that one of the players activated can I send all the players that were in the previous room to the new scene? Thank you!

1 Like