Skip to content

Commit

Permalink
Merge pull request #381 from dyanikoglu/dev
Browse files Browse the repository at this point in the history
Hotfix v4.23.3
  • Loading branch information
dyanikoglu committed Apr 19, 2022
2 parents 9cb3622 + 906bb30 commit f68a77e
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 105 deletions.
2 changes: 1 addition & 1 deletion ALSV4_CPP.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "4.23.2",
"VersionName": "4.23.3",
"FriendlyName": "Advanced Locomotion System Community",
"Description": "Performance optimized community version of LongmireLocomotion's Advanced Locomotion System V4",
"Category": "Animation",
Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Advanced Locomotion System Community
# Advanced Locomotion System - Community Version
![image](https://github.com/dyanikoglu/ALS-Community/raw/main/Resources/Readme_Content_2.gif)

Replicated and optimized community version of [Advanced Locomotion System V4](https://www.unrealengine.com/marketplace/en-US/product/advanced-locomotion-system-v1) for **Unreal Engine 5.0** with additional bug fixes.
Replicated and optimized version of [Advanced Locomotion System V4](https://www.unrealengine.com/marketplace/en-US/product/advanced-locomotion-system-v1) for **Unreal Engine 5.0** with additional bug fixes

<p align="center">
<a href="https://discord.gg/wYYMHFu"><img src="https://i.imgur.com/LP9bZQj.png"></a>
Expand All @@ -14,16 +14,14 @@ Replicated and optimized community version of [Advanced Locomotion System V4](ht
*Mac, Android, IOS, and console builds are not tested and supported at the moment. Use the plugin on those platforms with your own risk.*

## Features
- Based on latest marketplace release (V4) of Advanced Locomotion System
- Fully implemented in C++
- Full replication support with low bandwidth usage (Ragdoll replication is in experimental state)
- Plugin structure
- Animation Blueprint is optimized with new property binding feature
- Inputs are handled with Enhanced Input System
- Highly optimized for production
- Mantling and debugging features are implemented as a separate actor components to reduce total overhead on base character class
- Improved footstep behavior with Niagara particle & decal support
- Lots of bug fixes additional to marketplace version
- Fully implemented and optimized in C++. Implementation is based on latest marketplace release (V4) of ALS
- Complete replication support with low bandwidth usage (Ragdoll replication is in experimental state)
- Redesigned as plugin
- Animation blueprint is optimized with new property binding feature
- Player input is handled with new Enhanced Input Plugin
- Mantling and debugging features are implemented as separate actor components to reduce total overhead on base character class
- Improved footstep system with decal & Niagara particle support
- Lots of additional bug fixes

## Known Issues & Discussion
- See [Issues](https://github.com/dyanikoglu/ALS-Community/issues) section for list of known issues
Expand Down
10 changes: 5 additions & 5 deletions Source/ALSV4_CPP/Private/Character/ALSBaseCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void AALSBaseCharacter::Replicated_PlayMontage_Implementation(UAnimMontage* Mont
{
GetMesh()->GetAnimInstance()->Montage_Play(Montage, PlayRate);
}

Server_PlayMontage(Montage, PlayRate);
}

Expand Down Expand Up @@ -186,7 +186,7 @@ void AALSBaseCharacter::RagdollStart()

// Fixes character mesh is showing default A pose for a split-second just before ragdoll ends in listen server games
GetMesh()->bOnlyAllowAutonomousTickPose = true;

SetReplicateMovement(false);
}

Expand Down Expand Up @@ -653,7 +653,7 @@ void AALSBaseCharacter::GetCameraParameters(float& TPFOVOut, float& FPFOVOut, bo
void AALSBaseCharacter::RagdollUpdate(float DeltaTime)
{
GetMesh()->bOnlyAllowAutonomousTickPose = false;

// Set the Last Ragdoll Velocity.
const FVector NewRagdollVel = GetMesh()->GetPhysicsLinearVelocity(NAME_root);
LastRagdollVelocity = (NewRagdollVel != FVector::ZeroVector || IsLocallyControlled())
Expand Down Expand Up @@ -686,7 +686,7 @@ void AALSBaseCharacter::SetActorLocationDuringRagdoll(float DeltaTime)
}
}

// Determine wether the ragdoll is facing up or down and set the target rotation accordingly.
// Determine whether the ragdoll is facing up or down and set the target rotation accordingly.
const FRotator PelvisRot = GetMesh()->GetSocketRotation(NAME_Pelvis);

if (bReversedPelvis) {
Expand Down Expand Up @@ -1143,7 +1143,7 @@ EALSGait AALSBaseCharacter::GetActualGait(EALSGait AllowedGait) const
{
// Get the Actual Gait. This is calculated by the actual movement of the character, and so it can be different
// from the desired gait or allowed gait. For instance, if the Allowed Gait becomes walking,
// the Actual gait will still be running untill the character decelerates to the walking speed.
// the Actual gait will still be running until the character decelerates to the walking speed.

const float LocWalkSpeed = MyCharacterMovementComponent->CurrentMovementSettings.WalkSpeed;
const float LocRunSpeed = MyCharacterMovementComponent->CurrentMovementSettings.RunSpeed;
Expand Down
4 changes: 2 additions & 2 deletions Source/ALSV4_CPP/Private/Character/ALSPlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void AALSPlayerController::OnPossess(APawn* NewPawn)
}

SetupInputs();

UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
if (DebugComp)
{
Expand All @@ -39,7 +39,7 @@ void AALSPlayerController::OnRep_Pawn()
PossessedCharacter = Cast<AALSBaseCharacter>(GetPawn());
SetupCamera();
SetupInputs();

UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
if (DebugComp)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void UALSCharacterAnimInstance::NativeInitializeAnimation()
Character = Cast<AALSBaseCharacter>(TryGetPawnOwner());
if (Character)
{
Character->OnJumpedDelegate.AddDynamic(this, &UALSCharacterAnimInstance::OnJumped);
Character->OnJumpedDelegate.AddUniqueDynamic(this, &UALSCharacterAnimInstance::OnJumped);
}
}

Expand Down Expand Up @@ -509,7 +509,7 @@ void UALSCharacterAnimInstance::SetFootOffsets(float DeltaSeconds, FName EnableF
FVector ImpactNormal = HitResult.ImpactNormal;

// Step 1.1: Find the difference in location from the Impact point and the expected (flat) floor location.
// These values are offset by the nomrmal multiplied by the
// These values are offset by the normal multiplied by the
// foot height to get better behavior on angled surfaces.
CurLocationTarget = (ImpactPoint + ImpactNormal * Config.FootHeight) -
(IKFootFloorLoc + FVector(0, 0, Config.FootHeight));
Expand Down Expand Up @@ -549,7 +549,7 @@ void UALSCharacterAnimInstance::TurnInPlaceCheck(float DeltaSeconds)
{
// Step 1: Check if Aiming angle is outside of the Turn Check Min Angle, and if the Aim Yaw Rate is below the Aim Yaw Rate Limit.
// If so, begin counting the Elapsed Delay Time. If not, reset the Elapsed Delay Time.
// This ensures the conditions remain true for a sustained peroid of time before turning in place.
// This ensures the conditions remain true for a sustained period of time before turning in place.
if (FMath::Abs(AimingValues.AimingAngle.X) <= TurnInPlaceValues.TurnCheckMinAngle ||
CharacterInformation.AimYawRate >= TurnInPlaceValues.AimYawRateLimit)
{
Expand Down Expand Up @@ -646,7 +646,7 @@ void UALSCharacterAnimInstance::UpdateRotationValues()
// Set the Movement Direction
MovementDirection = CalculateMovementDirection();

// Set the Yaw Offsets. These values influence the "YawOffset" curve in the animgraph and are used to offset
// Set the Yaw Offsets. These values influence the "YawOffset" curve in the AnimGraph and are used to offset
// the characters rotation for more natural movement. The curves allow for fine control over how the offset
// behaves for each movement direction.
FRotator Delta = CharacterInformation.Velocity.ToOrientationRotator() - CharacterInformation.AimingRotation;
Expand Down Expand Up @@ -764,7 +764,7 @@ float UALSCharacterAnimInstance::CalculateStandingPlayRate() const

float UALSCharacterAnimInstance::CalculateDiagonalScaleAmount() const
{
// Calculate the Diagnal Scale Amount. This value is used to scale the Foot IK Root bone to make the Foot IK bones
// Calculate the Diagonal Scale Amount. This value is used to scale the Foot IK Root bone to make the Foot IK bones
// cover more distance on the diagonal blends. Without scaling, the feet would not move far enough on the diagonal
// direction due to the linear translational blending of the IK bones. The curve is used to easily map the value.
return DiagonalScaleAmountCurve->GetFloatValue(FMath::Abs(VelocityBlend.F + VelocityBlend.B));
Expand All @@ -773,7 +773,7 @@ float UALSCharacterAnimInstance::CalculateDiagonalScaleAmount() const
float UALSCharacterAnimInstance::CalculateCrouchingPlayRate() const
{
// Calculate the Crouching Play Rate by dividing the Character's speed by the Animated Speed.
// This value needs to be separate from the standing play rate to improve the blend from crocuh to stand while in motion.
// This value needs to be separate from the standing play rate to improve the blend from crouch to stand while in motion.
return FMath::Clamp(
CharacterInformation.Speed / Config.AnimatedCrouchSpeed / Grounded.StrideBlend / GetOwningComponent()->
GetComponentScale().Z,
Expand All @@ -784,7 +784,7 @@ float UALSCharacterAnimInstance::CalculateLandPrediction() const
{
// Calculate the land prediction weight by tracing in the velocity direction to find a walkable surface the character
// is falling toward, and getting the 'Time' (range of 0-1, 1 being maximum, 0 being about to land) till impact.
// The Land Prediction Curve is used to control how the time affects the final weight for a smooth blend.
// The Land Prediction Curve is used to control how the time affects the final weight for a smooth blend.
if (InAir.FallSpeed >= -200.0f)
{
return 0.0f;
Expand Down Expand Up @@ -853,7 +853,7 @@ FALSLeanAmount UALSCharacterAnimInstance::CalculateAirLeanAmount() const
EALSMovementDirection UALSCharacterAnimInstance::CalculateMovementDirection() const
{
// Calculate the Movement Direction. This value represents the direction the character is moving relative to the camera
// during the Looking Cirection / Aiming rotation modes, and is used in the Cycle Blending Anim Layers to blend to the
// during the Looking Direction / Aiming rotation modes, and is used in the Cycle Blending Anim Layers to blend to the
// appropriate directional states.
if (Gait.Sprinting() || RotationMode.VelocityDirection())
{
Expand All @@ -872,7 +872,7 @@ void UALSCharacterAnimInstance::TurnInPlace(FRotator TargetRotation, float PlayR
FRotator Delta = TargetRotation - CharacterInformation.CharacterActorRotation;
Delta.Normalize();
const float TurnAngle = Delta.Yaw;

// Step 2: Choose Turn Asset based on the Turn Angle and Stance
FALSTurnInPlaceAsset TargetTurnAsset;
if (Stance.Standing())
Expand Down Expand Up @@ -914,7 +914,7 @@ void UALSCharacterAnimInstance::TurnInPlace(FRotator TargetRotation, float PlayR
PlaySlotAnimationAsDynamicMontage(TargetTurnAsset.Animation, TargetTurnAsset.SlotName, 0.2f, 0.2f,
TargetTurnAsset.PlayRate * PlayRateScale, 1, 0.0f, StartTime);

// Step 4: Scale the rotation amount (gets scaled in animgraph) to compensate for turn angle (If Allowed) and play rate.
// Step 4: Scale the rotation amount (gets scaled in AnimGraph) to compensate for turn angle (If Allowed) and play rate.
if (TargetTurnAsset.ScaleTurnAngle)
{
Grounded.RotationScale = (TurnAngle / TargetTurnAsset.AnimatedAngle) * TargetTurnAsset.PlayRate * PlayRateScale;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright: Copyright (C) 2022 Doğa Can Yanıkoğlu
// Source Code: https://github.com/dyanikoglu/ALS-Community
// Source Code: https://github.com/dyanikoglu/ALS-Community


#include "Character/Animation/Notify/ALSAnimNotifyCameraShake.h"
Expand All @@ -8,7 +8,7 @@
void UALSAnimNotifyCameraShake::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
Super::Notify(MeshComp, Animation, EventReference);

APawn* OwnerPawn = Cast<APawn>(MeshComp->GetOwner());
if (OwnerPawn)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ FName UALSAnimNotifyFootstep::NAME_Foot_R(TEXT("Foot_R"));
void UALSAnimNotifyFootstep::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
Super::Notify(MeshComp, Animation, EventReference);

if (!MeshComp)
{
return;
}

AActor* MeshOwner = MeshComp->GetOwner();
if (!MeshOwner)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
void UALSAnimNotifyGroundedEntryState::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
Super::Notify(MeshComp, Animation, EventReference);

AALSBaseCharacter* Character = Cast<AALSBaseCharacter>(MeshComp->GetOwner());
if (Character)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void UALSNotifyStateEarlyBlendOut::NotifyTick(USkeletalMeshComponent* MeshComp,
float FrameDeltaTime, const FAnimNotifyEventReference& EventReference)
{
Super::NotifyTick(MeshComp, Animation, FrameDeltaTime, EventReference);

if (!MeshComp || !MeshComp->GetAnimInstance())
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void UALSNotifyStateMovementAction::NotifyBegin(USkeletalMeshComponent* MeshComp
float TotalDuration, const FAnimNotifyEventReference& EventReference)
{
Super::NotifyBegin(MeshComp, Animation, TotalDuration, EventReference);

AALSBaseCharacter* BaseCharacter = Cast<AALSBaseCharacter>(MeshComp->GetOwner());
if (BaseCharacter)
{
Expand All @@ -22,7 +22,7 @@ void UALSNotifyStateMovementAction::NotifyEnd(USkeletalMeshComponent* MeshComp,
const FAnimNotifyEventReference& EventReference)
{
Super::NotifyEnd(MeshComp, Animation, EventReference);

AALSBaseCharacter* BaseCharacter = Cast<AALSBaseCharacter>(MeshComp->GetOwner());
if (BaseCharacter && BaseCharacter->GetMovementAction() == MovementAction)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void UALSNotifyStateOverlayOverride::NotifyBegin(USkeletalMeshComponent* MeshCom
float TotalDuration, const FAnimNotifyEventReference& EventReference)
{
Super::NotifyBegin(MeshComp, Animation, TotalDuration, EventReference);

AALSBaseCharacter* Character = Cast<AALSBaseCharacter>(MeshComp->GetOwner());
if (Character)
{
Expand All @@ -22,7 +22,7 @@ void UALSNotifyStateOverlayOverride::NotifyBegin(USkeletalMeshComponent* MeshCom
void UALSNotifyStateOverlayOverride::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
Super::NotifyEnd(MeshComp, Animation, EventReference);

AALSBaseCharacter* Character = Cast<AALSBaseCharacter>(MeshComp->GetOwner());
if (Character)
{
Expand Down
Loading

0 comments on commit f68a77e

Please sign in to comment.