[SOLVED] Troubleshooting Photon multiplayer FPS prototype

This is the multiplayer FPS game prototype that I have been troubleshooting for a few days. I am essentially replacing the original third-person point-and-click gameplay with a first-person movement system. FPS movement code is “borrowed” from the “First Person Shooter Starter Kit” demo project. Everything else followed the Photon Multiplayer Tutorial by the book.

The problem is that a player creates a server, and can move around and stuff without a problem and decent fps. (Running mainly on a Samsung Chromebook 3)
When a second player or instance joins that room, the new instance shows the first as directly next to it no matter where the first instance actually is.
For the first instance, the second one joins as expected. In both instances, the players end up moving each other whenever they move.
They are also both colored blue as if they are both being considered the main player on each other’s screens.
I assumed it was an issue with the template attached to the root, so I updated it with no change.
I tried running them on separate computers instead of different tabs. The problem appears the same as before.
I tried making a backup titled “Trying Again” and tried a different, slightly more convincing approach that more resembles the original Photon Multiplayer project. It worked worse than the first.

In a very old project of mine, I had a similar issue, which I eventually fixed. However, I do not believe that it would work for this, for it used the old multiplayer system tutorial which makes use of a second player asset that acts as a dummy or actor. The Photon multiplayer does not make use of this.

Here are a few screenshots that might be helpful.


The first instance joined and moved next to the box with no problem(above)

The second instance joined, but the first instance appears to be right next to the second, and it is also colored as if it is the main player (also above)

(in the POV of the first instance again) the first instance is in the place in which the second one joined in, and the second one appears where the first was. Nobody has moved since the second one joined in. the POV of the second one appears the same as it was in screenshot #2 at this point.

link to the “Trying Again” project
original prototype (titled Switch-A-Roo)
Any help is appreciated.
Thank you for your time.

Hi @Stink_Head! Can you share the editor link of your project or can I see your Photon script?

yeah!
I apologize. I meant to do that, but I forgot to. one moment.

Why your Root entity has the character controller scripts on it?

in the original (titled Switch-A-Roo), the character controller scripts were attached to the player asset. When I looked over the tutorial project, I saw that the script doing the movement for the player was on the root asset along with where the player template thing was put in. To me, it made sense that it would work like that, but it showed to not work. While writing this, I might have an idea to fix this so ill test this on a backup and reply with screenshots of what i did and the results

This seems correct to me.

The logic of this script is different and doesn’t use this.entity to move a character.

2 Likes

Wait
is it as simple as altering the movement and/or input scripts to check for position and rotation updates and tell the server?

Not exactly sure what you mean with this.

When I’m home I will debug your project.

By that, I mean that perhaps the server is not being given position and rotation updates, so the issue might be solved by simply adding a couple of lines of code to send those updates to the server.
I will see what I can do when I wake up.
Thank you for your help. It has been very annoying to troubleshoot, for there are no error messages to guide me through the problem.

It’s done in the player.js script.

It works something like this: Player > raiseEvent (send) > onEvent (receive) > Others

2 Likes

I have debugged your project.

Each player starts with the player that is in your hierarchy. This entity has the scripts and camera. The player template you use for the other players should not have any scripts or camera, because this entity will only make the other players visible to the local player.

  1. Unlink the player entity in your hierarchy from the template.

    image

  2. Drag your template asset into your scene and remove the scripts and camera.

  3. Apply all changes to the template.

    image

  4. Remove the template from the scene.

In summary, the player entity in your hierarchy should have the scripts and camera and the player entity you add to the attribute should not.

3 Likes

Thank you very much! I also further understand how templates work.
Because my friends and I are intending on making this a full-fat game, are you good with being added to the credits?

1 Like

Nice goal, good luck!

Thank you, but you don’t have to.

1 Like