Time for action – Unbreaking the player
We'll start with the most game-breaking problem first, the fact that we can't move. If we take a look in the PlayerController
class in UnCodeX, we can see a huge comment starting with this line:
Here's how player movement prediction, replication and correction works in network games:
Reading this section we can see that we've put our code too far down the chain of events. The ProcessMove
function isn't used for network games. We need to move it up to PlayerMove
instead. Let's do that now.
Create the
PlayerMove
function in ourAwesomePlayerController
'sPlayerWalking
state:function PlayerMove(float DeltaTime) { local vector X, Y, Z, AltAccel; local rotator OldRotation; GetAxes(CurrentCameraRotation, X, Y, Z); AltAccel = PlayerInput.aForward * Z + PlayerInput.aStrafe * Y; AltAccel.Z = 0; AltAccel = Pawn.AccelRate * Normal(AltAccel); OldRotation = Rotation; UpdateRotation(DeltaTime...