About 'Replicating Structs'!

  • What do we have already?
  • Replicating state via a struct.
  • Sending the Move struct via RPC.

(Unique Video Reference: 17_KK_UEM)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

I have some mess after this lecture
my question is about challenge part “which client should create it ?” (it’s 16:00 minute lecture time)
here is code which is changed in the lecture

void AGoKart::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if (IsLocallyControlled())
	{
		FGoKartMove Move;
		Move.DeltaTime = DeltaTime;
		Move.SteeringThrow = SteeringThrow;
		Move.Throttle = Throttle;
		//TODO: Set time

		Server_SendMove(Move);
	}

	FVector Force = GetActorForwardVector() * MaxDrivingForce * Throttle;

	Force += GetAirResistance();
	Force += GetRollingResistance();

	FVector Acceleration = Force / Mass;

	Velocity = Velocity + Acceleration * DeltaTime;

	ApplyRotation(DeltaTime);

	UpdateLocationFromVelocity(DeltaTime);

	if (HasAuthority()) 
	{
		ServerState.Tranform = GetActorTransform();
		ServerState.Velocity = Velocity;
		//TODO: Update last move
	}

}

and in here you have used IsLocallyControlled() condition as you have told: "We don’t want to just send it from the autonomous proxy though because then the server wouldn’t be creating these moves"

  1. what this means, we don’t use IsLocallyControlled() condition but move simulation, calculate force and acceleration, is available for server. and now why this code is not executed for server without IsLocallyControlled() ? or do you mean Server-Client?
  2. what is different and relationship between Client and Autonomous Proxy ? I guess that Client is which owned the Actor and Autonomous Proxy indicate the Actor that is receiving inputs from a human controller, and In some sense Client and Autonomous Proxy is the same, but what is different in code ?
    which code of part is execute only Autonomous Proxy and which only Client ?
    and why it’s necessary to distinguish code such way?
  3. and here I want to ask the question from next lecture. for the move simulation you use Input data Move.Throttle instead of Throttle which is a member variable of class and you explained “I don’t want to just get the input data from the actor. That’s maybe not correct especially if we’re not being locally controlled.”
    what is mean under not locally controller ?
    until now we use Throttle for move simulation and what is different now ?

sorry many questions, but I need clear this ?

Privacy & Terms