BitBoy92
(sp-entertainment)
September 25, 2015, 3:29pm
4
I will try to help you, but that’s not an easy part.
You have to create a new class that will override some FSavedMove function
1 - uint8 FSavedMove_YourProjectCharacter::GetCompressedFlags() const
Here you will set the flag in a Int8 so your bool data will be transfered to the server from the client. FLAG_JumpPressed && FLAG_WantsToCrouch are already used. So you have 6 bool flag that you can use. 2 are reserved by Epic but not used and FLAG_Custom_0 to FLAG_Custom_2 that are available for you.
void FSavedMove_YourProjectCharacter::Clear()
Here you are reseting all the value that you set in GetCompressedFlags
void FSavedMove_YourProjectCharacter::SetMoveFor(ACharacter* Character, float InDeltaTime, FVector const& NewAccel, class FNetworkPredictionData_Client_Character & ClientData)
Here you will “save” the data that you want inside Variable that are host in FSavedMove. Those value will be used in GetCompressedFlags() to set the flag.
Ex: Create a bool bSavedMyAbility, set it to true when you ability is True. And use bSavedMyAbility inside GetCOmpressedFlags to set the output Int8 Result.
2- void UYourProjectCharacterMovement::UpdateFromCompressedFlags(uint8 Flags)
Here you will read the flag that you set inside the GetCompressedFlags (it is called on the server side)
I hope this will help.
In the source code, you need to track how the Crouch is done and you will find all the steps I mentionned.
Last, if you want the abilities to be seen on other clients, you will to set Rep variable on the character and manage them properly. (again check the RepIsCrouched).
good luck, this is a bit tricky at the beginning, but once you have all the steps in mind, it becomes fluent.
Thank you Elvince for the detailed answer. I will definitely be studying and digesting this information.
I do have one question. Would you recommend this method for all character movement? For instance if you wanted a networked character to sprint, jump, fly, etc., should you use the same method illustrated above or should you take a different approach? I am just curious as to whether or not I should repeat the methods above for all of my character’s movement.