Trouble with multiplayer

I got it to connect me and my father, but when I moved, it moved him, and vise versa. If it is helpful, I used the first person movement taken from the example project with a neat map. I have no idea why it is doing this, I have been trying for a couple of hours, so any help is greatly appreciated.

Hi @HandsomeBoy476! Looks like you need to swap something. Can you share links of your project so someone can take a look?

yes, but it will be a copy in case they mess it all up.

here is a link to the game. the scene “test map” is where all the stuff is happening.

https://playcanvas.com/project/811349/overview/emergency-copy

Nobody can change anything if they are not a team member of your project. They can only view your project.

I have forked your project and was able to solve the problem. For this I disabled all script components and the camera component of the Other entity. After that, the multiplayer works as expected. If you look closely at the example project you will also see that the Other entity is really just a visual model.

do you disable script components for both entities labeled player and other? and what do you mean by visual model? i disabled scripts for other, and the multiplayer worked more, they could move on their own accord, but you cannot see the stuff attached to the other player’s camera, such as arms and gun. may you please explain or a link to the fork?
Thank you.

No, I only mentioned the Other entity.

That’s because you disabled the camera entity and not only the camera component. If you disable a parent entity then you disable also all child entities. So enable the camera entity and disable the camera component.

https://playcanvas.com/project/825829/overview/multiplayer

I believe I found an issue with your copy but should be a quick fix. Did you intend to make “other” a child of the plane(which is the floor) i think that is what is making the other player very wide.

I think I did that by accident. It should not be a child of the plane entity.

Edit: I fixed it.

I understand how it works more. I made the changes and playtested it with my father. we played tag virtually. it was fun, but we noticed that the other player seemed to always be looking in one direction, even when they actually are looking somewhere else. I think the source of the issue is in the camera, but I am not too savvy with programming. do you know the reason?
I really appreciate the help.

You probably only send and receive the position via the network. As a result, the other computer only knows the position. You need to extend the teleport line with the rotation data of the entity.

I’ve never done this myself, but I think if you look closely at how the network script works, you can do it. The link below will help you with how the teleport code should look like.

https://developer.playcanvas.com/en/api/pc.RigidBodyComponent.html#teleport

1 Like

By the way, you can also test your game without anyone else’s by starting your game twice in a separate browser/tab.

thank you!

1 Like

i will try to do the rotation position thing.

1 Like

I tried adding rotation to the original multiplayer tutorial and I think I succeeded. (I also made some adjustments to the player’s movement, otherwise it would go in the wrong direction).

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

1 Like