diff --git a/ALSV4_CPP.uplugin b/ALSV4_CPP.uplugin index 464bf7a6..51155d5b 100644 --- a/ALSV4_CPP.uplugin +++ b/ALSV4_CPP.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 1, - "VersionName": "4.8", + "VersionName": "4.9", "FriendlyName": "Advanced Locomotion System V4 on C++", "Description": "Performance optimized C++ port of LongmireLocomotion's Advanced Locomotion System V4", "Category": "Animation", diff --git a/Content/AdvancedLocomotionV4/Blueprints/UI/ALS_HUD.uasset b/Content/AdvancedLocomotionV4/Blueprints/UI/ALS_HUD.uasset index a63b550a..90c46a79 100644 Binary files a/Content/AdvancedLocomotionV4/Blueprints/UI/ALS_HUD.uasset and b/Content/AdvancedLocomotionV4/Blueprints/UI/ALS_HUD.uasset differ diff --git a/Content/AdvancedLocomotionV4/CharacterAssets/MannequinSkeleton/ALS_AnimBP.uasset b/Content/AdvancedLocomotionV4/CharacterAssets/MannequinSkeleton/ALS_AnimBP.uasset index 82187750..21bbce8f 100644 Binary files a/Content/AdvancedLocomotionV4/CharacterAssets/MannequinSkeleton/ALS_AnimBP.uasset and b/Content/AdvancedLocomotionV4/CharacterAssets/MannequinSkeleton/ALS_AnimBP.uasset differ diff --git a/Content/AdvancedLocomotionV4/Data/Curves/MantleCurves/Mantle_Timeline.uasset b/Content/AdvancedLocomotionV4/Data/Curves/MantleCurves/Mantle_Timeline.uasset index a4c201fb..3b10081d 100644 Binary files a/Content/AdvancedLocomotionV4/Data/Curves/MantleCurves/Mantle_Timeline.uasset and b/Content/AdvancedLocomotionV4/Data/Curves/MantleCurves/Mantle_Timeline.uasset differ diff --git a/README.md b/README.md index ea444c47..380591fc 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,33 @@ # Advanced Locomotion System V4 on C++ ![image](https://github.com/dyanikoglu/ALSV4_CPP/raw/main/Resources/Readme_Content_2.gif) -Performance optimized & replicated C++ port of [Advanced Locomotion System V4](https://www.unrealengine.com/marketplace/en-US/product/advanced-locomotion-system-v1) for **Unreal Engine 4.25** with additional bug fixes. +Replicated & optimized C++ port of [Advanced Locomotion System V4](https://www.unrealengine.com/marketplace/en-US/product/advanced-locomotion-system-v1) for **Unreal Engine 4.25** with additional bug fixes. -## Features -- Converted into plugin structure (by [AHGS-Jens](https://github.com/AHGS-Jens)). You can immediately start using it in your project without doing any serious change in your project configuration. -- Source code is highly optimized while being ported from blueprints. For 100 characters in a scene, CPU time is decreased from ~17ms to ~10ms. -- Currently, only Windows & Linux are supported, and tested. -- Network performance optimized, and comes with full replication support (Big kudos to [senfkorn92](https://github.com/senfkorn92) for his work). ALSV4_CPP currently beats ALS V3 and other BP based V4 replication implementations on network performance: -``` -Advanced Locomotion System V3 (BP): -Total outgoing bandwidth is 686KB over 60 seconds (30 seconds playing server, 30 on client). -Character Actor Data sent over network - 43KB -'ReplicatedMovement' Data sent over network - 19KB -Highest RPC Data sent over network - 90KB -Overall Property Size - 46KB -Overall RPC Size - 201KB +## Supported Systems +- Windows 64-bit +- Linux -Advanced Locomotion System V4 (BP): -Total outgoing bandwidth is 2.7MB over 60 seconds (30 seconds playing server, 30 on client). -Character Actor Data sent over network - 116KB -'ReplicatedMovement' Data sent over network - 45KB -Highest RPC Data sent over network - 536KB -Overall Property Size - 209KB -Overall RPC Size - 1.7MB +*Mac, Android, IOS, and console builds are not tested and supported at the moment* -Advanced Locomotion System V4 (C++): -Total outgoing bandwidth is 618KB over 60 seconds (30 seconds playing server, 30 on client). -Character Actor Data sent over network - 38KB -'ReplicatedMovement' Data sent over network - 14KB -Highest RPC Data sent over network - 48KB -Overall Property Size - 41.1KB -Overall RPC Size - 91.1KB +## Features +- Full replication support with low bandwith usage +- Plugin structure +- Highly optimized for production +- Lots of bug fixes additional to marketplace version -Netprofiler benchmark by @Scragnog -``` +## Known Issues +- See [Issues](https://github.com/dyanikoglu/ALSV4_CPP/issues) section ## Setting Up The Plugin -- Clone the repository inside your project's `Plugins` folder, or download the source code zip file for latest release and extract it into your project's `Plugins` folder. +- Clone the repository inside your project's `Plugins` folder, or download the latest release and extract it into your project's `Plugins` folder. - Put `Config/DefaultInput.ini` from the plugin folder inside your project's config folder. If your project already have this .ini file, merge it into yours. - Add the lines below into your `DefaultEngine.ini`, below `[/Script/Engine.CollisionProfile]` tag (Create the tag if it doesn't exist): ``` +Profiles=(Name="ALS_Character",CollisionEnabled=QueryAndPhysics,bCanModify=True,ObjectTypeName="Pawn",CustomResponses=((Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="Climbable",Response=ECR_Ignore)),HelpMessage="Custom collision settings for the capsule in the ALS_BaseCharacter.") +DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="Climbable") ``` -- Generate Visual Studio Project files, and compile your project. (Unreal Engine 4.25.2 & 4.25.3 update broke compiling distribution binaries for plugins, so you need to compile them yourself) -- Launch the project, and enable plugin content viewer as seen below. This will show contents of the ALS in your content browser: +- Launch the project, and enable plugin content viewer as seen below. This will show contents of the plugin in your content browser: ![image](https://github.com/dyanikoglu/ALSV4_CPP/raw/main/Resources/Readme_Content_1.png) -- If you're getting problems with the plugin binaries, try compiling them yourself from the source. ## License & Contribution **Source code** of the plugin is licensed under MIT license, and other developers are encouraged to fork the repository, open issues & pull requests to help the development. diff --git a/Source/ALSV4_CPP/Private/Character/ALSBaseCharacter.cpp b/Source/ALSV4_CPP/Private/Character/ALSBaseCharacter.cpp index 05f530bf..1176fe2e 100644 --- a/Source/ALSV4_CPP/Private/Character/ALSBaseCharacter.cpp +++ b/Source/ALSV4_CPP/Private/Character/ALSBaseCharacter.cpp @@ -21,7 +21,6 @@ #include "Kismet/KismetMathLibrary.h" #include "Kismet/GameplayStatics.h" #include "TimerManager.h" -#include "Logging/TokenizedMessage.h" #include "Net/UnrealNetwork.h" AALSBaseCharacter::AALSBaseCharacter(const FObjectInitializer& ObjectInitializer) @@ -107,6 +106,9 @@ void AALSBaseCharacter::BeginPlay() { Super::BeginPlay(); + // If we're in networked game, disable curved movement + bDisableCurvedMovement = !IsNetMode(ENetMode::NM_Standalone); + FOnTimelineFloat TimelineUpdated; FOnTimelineEvent TimelineFinished; TimelineUpdated.BindUFunction(this, FName(TEXT("MantleUpdate"))); @@ -963,7 +965,7 @@ void AALSBaseCharacter::SetEssentialValues(float DeltaTime) // Determine if the character has movement input by getting its movement input amount. // The Movement Input Amount is equal to the current acceleration divided by the max acceleration so that - // it has a range of 0-1, 1 being the maximum possible amount of input, and 0 beiung none. + // it has a range of 0-1, 1 being the maximum possible amount of input, and 0 being none. // If the character has movement input, update the Last Movement Input Rotation. SetMovementInputAmount(ReplicatedCurrentAcceleration.Size() / EasedMaxAcceleration); SetHasMovementInput(MovementInputAmount > 0.0f); @@ -991,10 +993,19 @@ void AALSBaseCharacter::UpdateCharacterMovement() } // Use the allowed gait to update the movement settings. - UpdateDynamicMovementSettings(AllowedGait); + if (bDisableCurvedMovement) + { + // Don't use curves for movement + UpdateDynamicMovementSettingsNetworked(AllowedGait); + } + else + { + // Use curves for movement + UpdateDynamicMovementSettingsStandalone(AllowedGait); + } } -void AALSBaseCharacter::UpdateDynamicMovementSettings(EALSGait AllowedGait) +void AALSBaseCharacter::UpdateDynamicMovementSettingsStandalone(EALSGait AllowedGait) { // Get the Current Movement Settings. CurrentMovementSettings = GetTargetMovementSettings(); @@ -1005,6 +1016,19 @@ void AALSBaseCharacter::UpdateDynamicMovementSettings(EALSGait AllowedGait) const float MappedSpeed = GetMappedSpeed(); const FVector CurveVec = CurrentMovementSettings.MovementCurve->GetVectorValue(MappedSpeed); + // Update the Character Max Walk Speed to the configured speeds based on the currently Allowed Gait. + GetCharacterMovement()->MaxWalkSpeed = NewMaxSpeed; + GetCharacterMovement()->MaxAcceleration = CurveVec.X; + GetCharacterMovement()->BrakingDecelerationWalking = CurveVec.Y; + GetCharacterMovement()->GroundFriction = CurveVec.Z; +} + +void AALSBaseCharacter::UpdateDynamicMovementSettingsNetworked(EALSGait AllowedGait) +{ + // Get the Current Movement Settings. + CurrentMovementSettings = GetTargetMovementSettings(); + float NewMaxSpeed = CurrentMovementSettings.GetSpeedForGait(AllowedGait); + // Update the Character Max Walk Speed to the configured speeds based on the currently Allowed Gait. if (IsLocallyControlled() || HasAuthority()) { @@ -1012,19 +1036,10 @@ void AALSBaseCharacter::UpdateDynamicMovementSettings(EALSGait AllowedGait) { MyCharacterMovementComponent->SetMaxWalkingSpeed(NewMaxSpeed); } - if (GetCharacterMovement()->MaxAcceleration != CurveVec.X - || GetCharacterMovement()->BrakingDecelerationWalking != CurveVec.Y - || GetCharacterMovement()->GroundFriction != CurveVec.Z) - { - MyCharacterMovementComponent->SetMovementSettings(CurveVec); - } } else { GetCharacterMovement()->MaxWalkSpeed = NewMaxSpeed; - GetCharacterMovement()->MaxAcceleration = CurveVec.X; - GetCharacterMovement()->BrakingDecelerationWalking = CurveVec.Y; - GetCharacterMovement()->GroundFriction = CurveVec.Z; } } diff --git a/Source/ALSV4_CPP/Private/Character/ALSCharacter.cpp b/Source/ALSV4_CPP/Private/Character/ALSCharacter.cpp index cccbe6d5..b8182222 100644 --- a/Source/ALSV4_CPP/Private/Character/ALSCharacter.cpp +++ b/Source/ALSV4_CPP/Private/Character/ALSCharacter.cpp @@ -88,7 +88,7 @@ ECollisionChannel AALSCharacter::GetThirdPersonTraceParams(FVector& TraceOrigin, FTransform AALSCharacter::GetThirdPersonPivotTarget() { return FTransform(GetActorRotation(), - (GetMesh()->GetSocketLocation(TEXT("Head")) + GetMesh()->GetSocketLocation(TEXT("Root"))) / 2.0f, + (GetMesh()->GetSocketLocation(TEXT("Head")) + GetMesh()->GetSocketLocation(TEXT("root"))) / 2.0f, FVector::OneVector); } diff --git a/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp b/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp index 27eedc45..48b71b8d 100644 --- a/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp +++ b/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp @@ -1,7 +1,7 @@ // Project: Advanced Locomotion System V4 on C++ // Source Code: https://github.com/dyanikoglu/ALSV4_CPP // Original Author: Haziq Fadhil -// Contributors: +// Contributors: Doga Can Yanikoglu #include "Character/ALSCharacterMovementComponent.h" @@ -26,14 +26,6 @@ void UALSCharacterMovementComponent::OnMovementUpdated(float DeltaTime, const FV { MaxWalkSpeed = MyNewMaxWalkSpeed; MaxWalkSpeedCrouched = MyNewMaxWalkSpeed; - MaxAcceleration = MyNewMaxAcceleration; - BrakingDecelerationWalking = MyNewBraking; - GroundFriction = MyNewGroundFriction; - - // Ensures server Movement Settings values updates to latest - bRequestMovementSettingsChange = MaxAcceleration != RealMaxAcceleration - || BrakingDecelerationWalking != RealBraking - || GroundFriction != RealGroundFriction; } } @@ -46,7 +38,7 @@ void UALSCharacterMovementComponent::UpdateFromCompressedFlags(uint8 Flags) // C class FNetworkPredictionData_Client* UALSCharacterMovementComponent::GetPredictionData_Client() const { - check(PawnOwner != NULL); + check(PawnOwner != nullptr); if (!ClientPredictionData) { @@ -82,7 +74,7 @@ uint8 UALSCharacterMovementComponent::FSavedMove_My::GetCompressedFlags() const bool UALSCharacterMovementComponent::FSavedMove_My::CanCombineWith(const FSavedMovePtr& NewMove, ACharacter* Character, float MaxDelta) const { - // Set which moves can be combined together. This will depend on the bit flags that are used. + // Set which moves can be combined together. This will depend on the bit flags that are used. if (bSavedRequestMovementSettingsChange != ((FSavedMove_My*)&NewMove)->bSavedRequestMovementSettingsChange) { return false; @@ -103,13 +95,6 @@ void UALSCharacterMovementComponent::FSavedMove_My::SetMoveFor(ACharacter* Chara } } -void UALSCharacterMovementComponent::FSavedMove_My::PrepMoveFor(class ACharacter* Character) -{ - Super::PrepMoveFor(Character); - - UALSCharacterMovementComponent* CharacterMovement = Cast(Character->GetCharacterMovement()); -} - UALSCharacterMovementComponent::FNetworkPredictionData_Client_My::FNetworkPredictionData_Client_My( const UCharacterMovementComponent& ClientMovement) : Super(ClientMovement) @@ -124,9 +109,7 @@ FSavedMovePtr UALSCharacterMovementComponent::FNetworkPredictionData_Client_My:: // Set Movement Settings RPC to transfer the current Movement Settings from the Owning Client to the Server bool UALSCharacterMovementComponent::Server_SetMaxWalkingSpeed_Validate(const float NewMaxWalkSpeed) { - if (NewMaxWalkSpeed < 0.f || NewMaxWalkSpeed > 2000.f) - return false; - return true; + return NewMaxWalkSpeed >= 0.f && NewMaxWalkSpeed <= 2000.f; } void UALSCharacterMovementComponent::Server_SetMaxWalkingSpeed_Implementation(const float NewMaxWalkSpeed) @@ -143,34 +126,3 @@ void UALSCharacterMovementComponent::SetMaxWalkingSpeed(float NewMaxWalkSpeed) } bRequestMovementSettingsChange = true; } - -// Set Max Walking Speed RPC to transfer the current Max Walking Speed from the Owning Client to the Server -bool UALSCharacterMovementComponent::Server_SetMovementSettings_Validate(const FVector NewMovementSettings) -{ - return true; -} - -void UALSCharacterMovementComponent::Server_SetMovementSettings_Implementation(const FVector NewMovementSettings) -{ - MyNewMaxAcceleration = NewMovementSettings.X; - MyNewBraking = NewMovementSettings.Y; - MyNewGroundFriction = NewMovementSettings.Z; - bRequestMovementSettingsChange = true; -} - -void UALSCharacterMovementComponent::SetMovementSettings(FVector NewMovementSettings) -{ - if (PawnOwner->IsLocallyControlled()) - { - MyNewMaxAcceleration = NewMovementSettings.X; - MyNewBraking = NewMovementSettings.Y; - MyNewGroundFriction = NewMovementSettings.Z; - Server_SetMovementSettings(NewMovementSettings); - } - bRequestMovementSettingsChange = true; - - // Save Server Movement Settings for comparison during movement update - RealMaxAcceleration = NewMovementSettings.X; - RealBraking = NewMovementSettings.Y; - RealGroundFriction = NewMovementSettings.Z; -} diff --git a/Source/ALSV4_CPP/Private/Character/ALSPlayerCameraManager.cpp b/Source/ALSV4_CPP/Private/Character/ALSPlayerCameraManager.cpp index b5898eb4..e60bf3f3 100644 --- a/Source/ALSV4_CPP/Private/Character/ALSPlayerCameraManager.cpp +++ b/Source/ALSV4_CPP/Private/Character/ALSPlayerCameraManager.cpp @@ -9,7 +9,6 @@ #include "Character/ALSPlayerCameraManager.h" -#include "DrawDebugHelpers.h" #include "Character/ALSBaseCharacter.h" #include "Character/Animation/ALSPlayerCameraBehavior.h" #include "Kismet/KismetMathLibrary.h" diff --git a/Source/ALSV4_CPP/Private/Character/Animation/ALSCharacterAnimInstance.cpp b/Source/ALSV4_CPP/Private/Character/Animation/ALSCharacterAnimInstance.cpp index e968c57e..a676c477 100644 --- a/Source/ALSV4_CPP/Private/Character/Animation/ALSCharacterAnimInstance.cpp +++ b/Source/ALSV4_CPP/Private/Character/Animation/ALSCharacterAnimInstance.cpp @@ -257,6 +257,8 @@ void UALSCharacterAnimInstance::UpdateLayerValues() void UALSCharacterAnimInstance::UpdateFootIK(float DeltaSeconds) { + FVector FootOffsetLTarget; + FVector FootOffsetRTarget; // Update Foot Locking values. SetFootLocking(DeltaSeconds, FName(TEXT("Enable_FootIK_L")), FName(TEXT("FootLock_L")), FName(TEXT("ik_foot_l")), FootIKValues.FootLock_L_Alpha, FootIKValues.UseFootLockCurve_L, @@ -274,11 +276,11 @@ void UALSCharacterAnimInstance::UpdateFootIK(float DeltaSeconds) else if (!MovementState.Ragdoll()) { // Update all Foot Lock and Foot Offset values when not In Air - SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_L")), FName(TEXT("ik_foot_l")), FName(TEXT("Root")), FootOffsetLTargetCached, + SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_L")), FName(TEXT("ik_foot_l")), FName(TEXT("root")), FootOffsetLTarget, FootIKValues.FootOffset_L_Location, FootIKValues.FootOffset_L_Rotation); - SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_R")), FName(TEXT("ik_foot_r")), FName(TEXT("Root")), FootOffsetRTargetCached, + SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_R")), FName(TEXT("ik_foot_r")), FName(TEXT("root")), FootOffsetRTarget, FootIKValues.FootOffset_R_Location, FootIKValues.FootOffset_R_Rotation); - SetPelvisIKOffset(DeltaSeconds, FootOffsetLTargetCached, FootOffsetRTargetCached); + SetPelvisIKOffset(DeltaSeconds, FootOffsetLTarget, FootOffsetRTarget); } } diff --git a/Source/ALSV4_CPP/Private/Character/Animation/Notify/ALSNotifyStateOverlayOverride.cpp b/Source/ALSV4_CPP/Private/Character/Animation/Notify/ALSNotifyStateOverlayOverride.cpp index fc4bc725..66fdefa0 100644 --- a/Source/ALSV4_CPP/Private/Character/Animation/Notify/ALSNotifyStateOverlayOverride.cpp +++ b/Source/ALSV4_CPP/Private/Character/Animation/Notify/ALSNotifyStateOverlayOverride.cpp @@ -31,6 +31,6 @@ void UALSNotifyStateOverlayOverride::NotifyEnd(USkeletalMeshComponent* MeshComp, FString UALSNotifyStateOverlayOverride::GetNotifyName_Implementation() const { FString Name(TEXT("Overlay Override State: ")); - Name.Append(GetEnumerationToString(static_cast(OverlayOverrideState))); + Name.Append(FString::FromInt(OverlayOverrideState)); return Name; } diff --git a/Source/ALSV4_CPP/Public/Character/ALSBaseCharacter.h b/Source/ALSV4_CPP/Public/Character/ALSBaseCharacter.h index dc43f666..055b20b6 100644 --- a/Source/ALSV4_CPP/Public/Character/ALSBaseCharacter.h +++ b/Source/ALSV4_CPP/Public/Character/ALSBaseCharacter.h @@ -157,7 +157,7 @@ class ALSV4_CPP_API AALSBaseCharacter : public ACharacter UFUNCTION(BlueprintCallable, NetMulticast, Reliable, Category = "ALS|Character States") void Multicast_MantleStart(float MantleHeight, const FALSComponentAndTransform& MantleLedgeWS, EALSMantleType MantleType); - /** Ragolling*/ + /** Ragdolling*/ UFUNCTION(BlueprintCallable, Category = "ALS|Character States") void ReplicatedRagdollStart(); @@ -333,7 +333,7 @@ class ALSV4_CPP_API AALSBaseCharacter : public ACharacter void SetActorLocationDuringRagdoll(float DeltaTime); - /** Stace Changes */ + /** State Changes */ virtual void OnMovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode = 0) override; @@ -365,7 +365,9 @@ class ALSV4_CPP_API AALSBaseCharacter : public ACharacter void UpdateCharacterMovement(); - void UpdateDynamicMovementSettings(EALSGait AllowedGait); + void UpdateDynamicMovementSettingsNetworked(EALSGait AllowedGait); + + void UpdateDynamicMovementSettingsStandalone(EALSGait AllowedGait); void UpdateGroundedRotation(float DeltaTime); @@ -450,13 +452,13 @@ class ALSV4_CPP_API AALSBaseCharacter : public ACharacter /** Input */ - UPROPERTY(EditAnywhere, replicated, BlueprintReadWrite, Category = "ALS|Input") + UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "ALS|Input") EALSRotationMode DesiredRotationMode = EALSRotationMode::LookingDirection; - UPROPERTY(EditAnywhere, replicated, BlueprintReadWrite, Category = "ALS|Input") + UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "ALS|Input") EALSGait DesiredGait = EALSGait::Running; - UPROPERTY(EditAnywhere, BlueprintReadWrite, replicated, Category = "ALS|Input") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "ALS|Input") EALSStance DesiredStance = EALSStance::Standing; UPROPERTY(EditDefaultsOnly, Category = "ALS|Input", BlueprintReadOnly) @@ -554,10 +556,10 @@ class ALSV4_CPP_API AALSBaseCharacter : public ACharacter UPROPERTY(BlueprintReadOnly, Category = "ALS|Essential Information") float EasedMaxAcceleration; - UPROPERTY(BlueprintReadOnly, replicated, Category = "ALS|Essential Information") + UPROPERTY(BlueprintReadOnly, Replicated, Category = "ALS|Essential Information") FVector ReplicatedCurrentAcceleration; - UPROPERTY(BlueprintReadOnly, replicated, Category = "ALS|Essential Information") + UPROPERTY(BlueprintReadOnly, Replicated, Category = "ALS|Essential Information") FRotator ReplicatedControlRotation; /** State Values */ @@ -645,7 +647,7 @@ class ALSV4_CPP_API AALSBaseCharacter : public ACharacter UPROPERTY(BlueprintReadOnly, Category = "ALS|Ragdoll System") FVector LastRagdollVelocity; - UPROPERTY(BlueprintReadOnly, replicated, Category = "ALS|Ragdoll System") + UPROPERTY(BlueprintReadOnly, Replicated, Category = "ALS|Ragdoll System") FVector TargetRagdollLocation; /* Server ragdoll pull force storage*/ @@ -677,4 +679,7 @@ class ALSV4_CPP_API AALSBaseCharacter : public ACharacter /* Smooth out aiming by interping control rotation*/ FRotator AimingRotation; + + /** We won't use curve based movement on networked games */ + bool bDisableCurvedMovement = false; }; diff --git a/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h b/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h index a13de4c2..7b341769 100644 --- a/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h +++ b/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h @@ -1,7 +1,7 @@ // Project: Advanced Locomotion System V4 on C++ // Source Code: https://github.com/dyanikoglu/ALSV4_CPP // Original Author: Haziq Fadhil -// Contributors: +// Contributors: Doga Can Yanikoglu #pragma once @@ -28,7 +28,6 @@ class ALSV4_CPP_API UALSCharacterMovementComponent : public UCharacterMovementCo virtual uint8 GetCompressedFlags() const override; virtual void SetMoveFor(ACharacter* Character, float InDeltaTime, FVector const& NewAccel, class FNetworkPredictionData_Client_Character& ClientData) override; - virtual void PrepMoveFor(class ACharacter* Character) override; // Walk Speed Update uint8 bSavedRequestMovementSettingsChange : 1; @@ -52,16 +51,9 @@ class ALSV4_CPP_API UALSCharacterMovementComponent : public UCharacterMovementCo // Movement Settings Variables - uint8 bRequestMovementSettingsChange : 1; + uint8 bRequestMovementSettingsChange = 1; - float MyNewBraking; - float MyNewGroundFriction; - float MyNewMaxWalkSpeed; - float MyNewMaxAcceleration; - - float RealBraking; - float RealGroundFriction; - float RealMaxAcceleration; + float MyNewMaxWalkSpeed = 0; // Set Max Walking Speed (Called from the owning client) UFUNCTION(BlueprintCallable, Category = "Movement Settings") @@ -69,11 +61,4 @@ class ALSV4_CPP_API UALSCharacterMovementComponent : public UCharacterMovementCo UFUNCTION(reliable, Server, WithValidation) void Server_SetMaxWalkingSpeed(float NewMaxWalkSpeed); - - // Set Movement Settings (Called from the owning client) - UFUNCTION(BlueprintCallable, Category = "Movement Settings") - void SetMovementSettings(FVector NewMovementSettings); - - UFUNCTION(reliable, Server, WithValidation) - void Server_SetMovementSettings(FVector NewMovementSettings); }; diff --git a/Source/ALSV4_CPP/Public/Character/ALSPlayerCameraManager.h b/Source/ALSV4_CPP/Public/Character/ALSPlayerCameraManager.h index 164652bd..1c3de6f5 100644 --- a/Source/ALSV4_CPP/Public/Character/ALSPlayerCameraManager.h +++ b/Source/ALSV4_CPP/Public/Character/ALSPlayerCameraManager.h @@ -39,7 +39,7 @@ class ALSV4_CPP_API AALSPlayerCameraManager : public APlayerCameraManager virtual void UpdateViewTargetInternal(FTViewTarget& OutVT, float DeltaTime) override; UFUNCTION(BlueprintCallable) - FVector CalculateAxisIndependentLag( + static FVector CalculateAxisIndependentLag( FVector CurrentLocation, FVector TargetLocation, FRotator CameraRotation, FVector LagSpeeds, float DeltaTime); UFUNCTION(BlueprintCallable) diff --git a/Source/ALSV4_CPP/Public/Character/Animation/ALSCharacterAnimInstance.h b/Source/ALSV4_CPP/Public/Character/Animation/ALSCharacterAnimInstance.h index b31c2105..a9b38c41 100644 --- a/Source/ALSV4_CPP/Public/Character/Animation/ALSCharacterAnimInstance.h +++ b/Source/ALSV4_CPP/Public/Character/Animation/ALSCharacterAnimInstance.h @@ -294,6 +294,4 @@ class ALSV4_CPP_API UALSCharacterAnimInstance : public UAnimInstance bool bCanPlayDynamicTransition = true; - FVector FootOffsetLTargetCached; - FVector FootOffsetRTargetCached; }; diff --git a/Source/ALSV4_CPP/Public/Character/Animation/Notify/ALSAnimNotifyFootstep.h b/Source/ALSV4_CPP/Public/Character/Animation/Notify/ALSAnimNotifyFootstep.h index a7e2c95c..ef806c2c 100644 --- a/Source/ALSV4_CPP/Public/Character/Animation/Notify/ALSAnimNotifyFootstep.h +++ b/Source/ALSV4_CPP/Public/Character/Animation/Notify/ALSAnimNotifyFootstep.h @@ -32,7 +32,7 @@ class ALSV4_CPP_API UALSAnimNotifyFootstep : public UAnimNotify USoundBase* Sound = nullptr; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AnimNotify) - FName AttachPointName = FName(TEXT("Root")); + FName AttachPointName = FName(TEXT("root")); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AnimNotify) EALSFootstepType FootstepType = EALSFootstepType::Step; diff --git a/Source/ALSV4_CPP/Public/Library/ALSStructEnumLibrary.h b/Source/ALSV4_CPP/Public/Library/ALSStructEnumLibrary.h index 15cbff29..e2a79f3f 100644 --- a/Source/ALSV4_CPP/Public/Library/ALSStructEnumLibrary.h +++ b/Source/ALSV4_CPP/Public/Library/ALSStructEnumLibrary.h @@ -268,8 +268,8 @@ struct FALSGait { Gait = NewGait; Walking_ = Gait == EALSGait::Walking; - Running_ = Gait == EALSGait::Running, - Sprinting_ = Gait == EALSGait::Sprinting; + Running_ = Gait == EALSGait::Running; + Sprinting_ = Gait == EALSGait::Sprinting; } };