I’m developing MMORPG using custom tcp server.
My game is 2D side-scroll game and I have two player classes, for the local player and other players.
class definitions:
class APlayerBase : public APaperZDCharacter;
class ALocalPlayer : public APlayerBase // this is for local player
Only ALocalPlayer possesses on BeginPlay function.
And my question is if I can’t possess all players how can i use AddMovementInput function for other players? (my server gives other players’ move info).
First attempt: Calling AddMovementInput without possessing. → Doesn’t work.
Second attempt: Creating AiController and possess to other players and call AddMovementInput → Doesn’t work.
If i get you right, you replicated the move info from custom server back to client and trying to apply it to local pawn. This way, to keep things consistent between sides, your movement component have to be identical on both sides. That means that you either:
copyied the ue’s movement component (well, it should be quite a difficult task i suppose) into custom code and should understand how it works in ue so no such questions about owning should arise;
have a custom implementation on both sides and you understand how it works so no such questions about owning should arise;
you have a different implementations on both sides… well, don’t do it or it’ll be a hella debug of desyncs.
In custom code you can call the SetActorLocation at anytime, on any side without being gated by owning. But for smooth movement you’d need more than that