No Owning Connection for Actor

Hello Everybody,

So I have had a post on the AnswerHub here for awhile now with no luck, so I thought I would post the question here.

Please read the original post on AnswerHub! It has more details and I am only going to give a brief of what I am trying to do below. It also has the source files attached to it.

Essentially I am trying to modify the ShooterGame example project by adding jet pack functionality. I started this modification by extending the ShooterCharacter class. The only problem is that I am getting a cryptic message in the Output saying “No owning connection for actor PlayerPawn_Afflicted_C_3. Function ServerSetJetting will not be processed” when trying to use my new class.

If you know what is going on here please post your answer on the AnswerHub so that I can accept it if it is correct.

Thank you for your time,
Farshooter

In your code:



	if (Role < ROLE_Authority)
	{
		// Remember. Do not call the implementation!
		ServerSetJetting(bNewJetting);
	}


should be like this:



	if (Role == ROLE_AutonomousProxy)
	{
		// Remember. Do not call the implementation!
		ServerSetJetting(bNewJetting);
	}


  • it make sure that ServerSetJetting will call only on client who own this actor, i.e. in case when this actor owned by connection.

Here some info about this.

1 Like

Unless the Player is an Owner of the actor, they cannot call RPC’s on it, even in the example shown above.

If you have to, you can call an RPC ‘through’ the Player Controller, passing the actor as reference.

2 Likes

Thanks for the information D.L.S. I made the change you mentioned and now the warning message doesn’t pop up in the console but for some reason I still don’t have control over the character. What will happen is that as soon as the game plays the pawn will be possessed correctly, meaning that everything will look correct but I have no control. Any input I give it to move forward, fire, look around, etc. gets ignored.

As a test to make sure it is the code that is the problem, I deleted everything from my header and source files. Sure enough after doing that, the input started to work.

Why and how could something be blocking my input?

Hello TheJamsh,

I am new to network replication, so could you further elaborate. For instance how and when would you set the player as an owner of a actor.

A question I have for both D.L.S. and TheJamsh is, why isn’t what I did in the first place working when I essentially copied what the ShooterCharacter class was already doing for running? I literally copied the setup function by function, variable by variable and yet it catastrophically fails. This is really confusing for me. I am trying to learn network replication by studying the ShooterCharacter class and when I try to replicate it I get nothing, but errors.

I did the same thing that you are doing. Modifying the ShooterGame to include jetpacks. First I started off with the examples given here:

https://forums.unrealengine.com/showthread.php?48-Victor-s-ShooterGame-Jetpack-TUTORIAL

I also created it successfully with replication. I have some nice samples for you in regards to that:

The declarations:


UCLASS()
class SHOOTERGAME_API UJetpackCharacterMovement : public UShooterCharacterMovement
{
	GENERATED_BODY()
	
public:
	UJetpackCharacterMovement( const class FObjectInitializer& ObjectInitializer );

	/**Override the Perform Movement function so we can add the jetpack logic there */
	virtual void PerformMovement( float DeltaTime ) override;

	/** Upwards Strenght of the jetpack, the more it is, the bigger is the acceleration for the jetpack, if its too low, the gravity has more power and you dont even fly */
	UPROPERTY( Category = "Character Movement", EditAnywhere, BlueprintReadWrite )
		float JetpackStrength;

	/** maximum fuel for the jetpack, this goes in seconds, and its depleted with simple time, so if its 2, you can only fly for 2 seconds */
	UPROPERTY( Category = "Character Movement", EditAnywhere, BlueprintReadWrite )
		float JetpackMaxFuel;

	/** Multiplier for the jetpack fuel regeneration, uses the time, if its 0.5, and the JetpackMaxFuel is 2 seconds, that means that it will take 4 seconds to be back at 100% */
	UPROPERTY( Category = "Character Movement", EditAnywhere, BlueprintReadWrite )
		float JetpackRefuelRate;


	/** Holds the current fuel amount */
	float Jetpackfuel;	
};

The definitions:


UJetpackCharacterMovement::UJetpackCharacterMovement( const FObjectInitializer& ObjectInitializer )
: Super( ObjectInitializer )
{
	JetpackStrength = 3000.0f;

	JetpackMaxFuel = 10.0f;
	JetpackRefuelRate = 0.5;


	Jetpackfuel = 10.0f;
}

void  UJetpackCharacterMovement::PerformMovement( float DeltaTime )
{
	AShooterCharacter* ShooterCharacterOwner = Cast<AShooterCharacter>( GetPawnOwner() );

	if ( ShooterCharacterOwner )
	{

		// using jetpack, so fly up
		if ( ShooterCharacterOwner->bIsUsingJetpack )
		{
			// make fuel decrease, as you are flying
			Jetpackfuel -= DeltaTime;
			// jetpack is depleted, disable it and stop flying
			if ( Jetpackfuel < 0 )
			{
				ShooterCharacterOwner->StopJetpack();
				ShooterCharacterOwner->DisableJetpack();
			}
			// Add some acceleration to the Upward velocity, so the character is propulsed upwards
			Velocity.Z += JetpackStrength * DeltaTime;
		}

		else if ( ShooterCharacterOwner->bIsJetpackEnabled == true )
		{
			// only refuel the jetpack when you are not flying and the jetpack is enabled
			Jetpackfuel += DeltaTime * JetpackRefuelRate;
			if ( Jetpackfuel >= JetpackMaxFuel )
			{
				Jetpackfuel = JetpackMaxFuel;
			}
		}
	}

	// do the CharacterMovement version of PerformMovement, this function is the one that does the normal movement calculations.
	Super::PerformMovement( DeltaTime );
}

Then I just added the jetpack movement as a component to the character by injecting it into the Character Movement, the tutorial will show you that.

Rather than having the Jetpack be an attached actor, just use it as a movement component, and if you want different jetpacks, copy the properties over.

In regards to knowing who owns what in Client-Server model for UE4, I would go here:
https://docs.unrealengine.com/latest/INT/Gameplay/Networking/Actors/Roles/index.html

And here I will include the definition of the input for jetpacks as it worked just fine for me:


void AShooterCharacter::StopJetpack() //for jetpack button released
{
	if ( Role < ROLE_Authority )
	{
		ServerSetJetpack( false );
	}
	bIsUsingJetpack = false;
}

void AShooterCharacter::StartJetpack() //for jetpack button pressed
{
	if ( bIsJetpackEnabled )
	{
		if ( Role < ROLE_Authority )
		{
			ServerSetJetpack( true );
		}
		bIsUsingJetpack = true;
	}
}

This:



void AShooterCharacter_Afflicted::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	check(InputComponent);
	InputComponent->BindAction("Jet", IE_Pressed, this, &AShooterCharacter_Afflicted::OnStartJetting);
	InputComponent->BindAction("Jet", IE_Released, this, &AShooterCharacter_Afflicted::OnStopJetting);
}


  • you should call parent version of SetupPlayerInputComponent(which contain setup code for player input):


void AShooterCharacter_Afflicted::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	Super::SetupPlayerInputComponent(InputComponent);
	//your code here
}


But still looks like you have some issues with possessing(or setting ownership) of your pawn.

Thank you so much for the information smartyMARTY. This will be a huge help and I will be moving forward with the information you provided. It should be a great learning resource for me.

I think you are right D.L.S., it definitely looks like I forgot to call the Super on my input method. Unfortunately, I won’t be able to test it because because my editor crashes whenever I try using my character in a level and they’re no error messages in the logs for me to tell what is going on. I think I am going to create a clean project and move forward with the information smartyMARTY presented.

Thank you for all your help,
Farshooter

I almost have my implementation working smartyMARTY, but I am running into one problem. I get the error message, “AJetpackCharacter::CanJump’ : method with override specifier ‘override’ did not override any base class methods,” regarding my header file for JetpackCharacter. While it is true that there is no CanJump function in AShooterCharacter, there is a CanJump function in ACharacter which is AShooterCharacter’s parent.

So is it possible to override a function in the parent class of your a class’s parent in C++?

I also attached my JetpackCharacter and JetpackCharacterMovement files so you can see my code implementation and compare it to yours if you like.

I can answer one question real quick.

Also, my implementation was not as architectural refined, I simply added the needed code to the AShooterCharacter rather than inherit from it and add the jet pack funtionality.

I forgot about this snag, you need to override this instead of CanJump:


virtual bool CanJumpInternal_Implementation() const override;

Thank you for the help smartyMARTY. I finally got it to work. I did in the end have to modify my ShooterCharacter class.

Awesome, I am so glad you got it to work, can’t wait to see the game you are working on in the WIP forum!

I had similar problem : LogNet:Warning: UIpNetDriver::ProcesRemoteFunction: No owning connection for actor MyActor. Function ServerMove will not be processed.
on match restart i had player controller lost connection with the controlling pawn.

After some digging i found that i had PlayerController replication attempt. i removed that and issue is gone.
so now as a rule : Do not ever replicate player controller! :slight_smile:

Yup you shouldn’t do that. All Player Controllers exist on the Server, but only local controllers exist on the client, so it’s trying to replicate to something that isn’t there. Insta-crash.

Also, bacon bump-tastic.