Photon works only for 2 player

My project works perfect but only for 2 player, since when entering the 3 player and shot, Power submits to all. It’s wrong? HELP ME

playcanvas.com/project/1064885/overview/gtp

Thanks for helping

It sounds like there might be an issue with how your code is handling multiple players in your Playcanvas project. Here are a few suggestions for how to troubleshoot and fix the problem:

  1. Check your code for shared variables - It’s possible that you have a variable that is being shared across all players, causing the power level to be set for all players at once. Check your code to make sure that variables related to power level or shooting are being tracked separately for each player.

  2. Review your input handling code - If the power level is being set for all players when a single player shoots, it’s possible that your input handling code is not properly identifying which player is shooting. Make sure that your input handling code is correctly identifying which player is performing an action.

  3. Use player-specific entities - If you’re using the same entity for all players, any changes made to that entity will affect all players. Try using a separate entity for each player so that changes made to one player’s entity don’t affect the others.

  4. Debugging - Use console.log statements in your code to help identify where the issue is occurring. You can also use the browser’s debugger to step through your code and see where variables are being set.

  5. Review documentation and tutorials - Check the Playcanvas documentation and forums to see if there are any resources that can help you troubleshoot your issue. You might also find tutorials or sample projects that demonstrate how to handle multiple players.

I hope these suggestions help you identify and solve the problem! If they dont, please reply the script that is causing the issue and I will take a look at it.

Thanks for answering, this is the part of the code where players are created …

A constant is being used every time that a player is created, so the strange one?

Greetings and if you solve the problem I invite you a coffee $$$$

It’s difficult to determine the exact issue without more information about the code and the error message you’re receiving. However, based on the information you provided, it seems like the issue might be related to the number of players in your game. If your game is designed to only work with two players, then the code you provided may work fine. However, if you’re trying to support more than two players, you may need to modify your code to handle the additional players. One thing to check is whether you have defined the “ortoPlayer” entity to support multiple players. If the entity is only designed to work with two players, then you may need to create additional entities to support additional players.

I would search online for a better answer with other game engines and see if you can find a solution

If you want to help, you have to look at the project @Mason_Rocchio1. You have to check the setup and scripts to find the cause of the problem.

2 Likes

@erikaleonard I am not sure if you are going off of the example tutorial or not. Photon is very usable for more than 2 players. Currently I have tested up to 17 of which the limit for the free licensing only goes to 20. This forum has a large amount of resources available. Please have a look to this thread for a good starter base. In this thread the third person tutorial example was turned into first person and a link to that project has been provided.

I have looked at your createPlayer and don’t see something that stands out but, I noticed that you have your player clone enabled. This should be disabled so instances can be created on the fly as new players join. I have tried to run 3 instances of your posted game. All 3 seemed to work well and I was able to position the players and see the movements occur. One thing I did find a bit off is the fact that you are not using the WASD standard movement.

I see also that there are two players here.
image

There should only be one and it should be the clone entity which will create the players in the room. It looks as if you added the second one.

image
Above is the standard way to handle this. PlayerRobot is the template of your clone item.

1 Like

THANKS @Tirk182 . PlayerRobot is also not used. I will continue to test

1 Like