Extremely Bizzarre character movement component bug when playing as client

I’m developing a multiplayer topdown shooter and using a C++ ACharacter as base for my C++ character, which I then create a blueprint based on that for iterating with.

I was experiencing very weird jittering when I was playing as client and moving around.
I felt like it was some kind of replication / prediction issue and spent a few hours trying to understand what might be happening.

However after a while I got my C++ class into a weird state and the character movement component detail pane was showing no info. In order to fix the character movement component detail issue I found a post saying I could try reparenting to Actor then back to my base class.
This worked!
But weirdly, it also removed the jittering!!! :open_mouth: :open_mouth:
However - here’s the horrible part. ANY TIME I recompile the character C++, the jittering comes back until I reparent to Actor and back to my base class. Which means I lose any BP data I’ve added…

Has anyone any idea what might be going on?


NOTE:
I don’t think this is related but I had been following a tutorial which used a custom movement component and initialized it in the character constructor as such:

AActionGameCharacter::AActionGameCharacter(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer.SetDefaultSubobjectClass<UAG_CharacterMovementComponent>(ACharacter::CharacterMovementComponentName))

However since I didn’t need to do anything in the custom movement component I decided to remove that.

My Class now doesn’t do anything with the movement component:

--- GC_Character.h ---
class MYGAME_API AGC_Character : public ACharacter, public IAbilitySystemInterface
{
...
}

--- GC_Character.cpp ---
AGC_Character::AGC_Character()
{
...
}

On removing and recompiling my BP class no longer showed the movement component correctly (the details were blank) and I needed to reparent to Actor then back to GC_Character to make it work again. That is how I actually discovered that this also seemed to fix the jittering…

I’ve now resolved the issue. The jittering I was sure was some client prediction issue, but then the reparenting completely through a curve ball and sent me off in a different direction.

After going back to the idea it was a client/server issue I finally discovered!

I am setting the ‘maxmovementspeed’ based on an attribute using the gameplay ability system.

The AttributeSet ovement speed was 350, on the movement component the default is 600.

I had forgot to add a ‘onchangeddelegate’ to my ability system for the movement speed, so the result was that the client thinks it’s 600 then the server corrects it to 350!!

I added this to the constructor of my character and then defined the delegate:

---CONSTRUCTOR---
	AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(AttributeSet->GetMaxMovementSpeedAttribute())
		.AddUObject(this, &AGC_Character::OnMaxMovementSpeedChanged);

....

void AGC_Character::OnMaxMovementSpeedChanged(const FOnAttributeChangeData& Data)
{
	GetCharacterMovement()->MaxWalkSpeed = Data.NewValue;
}

And the issue is now resolved