Hi guys,
I am currently working on a multiplayer project, in which there is 1 or 2 “Players” and a “GameMaster” (which lead to 3 Clients).
At first I had the GameMaster being also the host (Server + Client), but now I am trying a dedicated Server, so the GameMaster is just another Client.
The GameMaster can teleport (change location) forcefully of the Players, and can also see through their eyes. I had really no problem doing so in the first architecture as it was on the Server.
Now I tried to adapt my code, and it seems to be finally done, BUT I have a really weird bug which appears:
When I teleport a Player character on SOME locations, its Character is being Destroyed around 5 seconds after the teleportation on the GameMaster’s client, but NOT on the Server neither on the Player’s client. What’s really weird is that it happens only on 2 locations and not on the others, and I never call any “Destroy” on the actor.
Here is the piece of code which do the teleportation from the GameMaster Pawn
Some insights:
- ToServer TeleportSelectedUser is called from an “empty” PlayerController’s ActionInput Event
- PostTPEvents is really just some minor calls such as hiding an object or activating a function
- GetUserPawn / ChangeUserMawn are really just getters and setters. With (Server + Client) architecture, I was able to keep directly the PlayerController of the Players, but now the GameMaster client can’t know the other PlayerControllers, so I have done this workaround which is storing the Pawns instead and adding an index on my PlayerControllers.
- Apart from few changes such as the previous one and handling some more networking, this code is almost exactly the same as what was fully functional with the (Server + Client) architecture for the GameMaster.
Does someone have an idea of what could trigger the “Destroyed” event of the PlayerCharacter of the other Player ?
Thanks,