Skip to content

Commit

Permalink
DW Improvements (#94)
Browse files Browse the repository at this point in the history
* Minor Cleanup (#86)

* Ensure Unbound attributes are replicated properly at startup.

* Additional guards on unbinding filtered tag delegates for gameplay element mapping.

* Ensure Unbound attributes are replicated properly at startup.

* Ensure the garbage check on gameplay element maps works in 5.3 and earlier.

* Add methods to add/remove starting effects (#84)

* Fix heartbeats for locally controlled server pawns causing timeouts

* Add WaitForGMCMontageChange

* Effects:Add Application/Ongoing checks for Must(Not) Have Tags

* Prevent effect from starting if tag requirements not met

* Virtualize ability effect (#90)

* Ensure Unbound attributes are replicated properly at startup.

* virtualize lifecycle function so that AbilityEffect can be subclassed

* remove extra whitespace

---------

Co-authored-by: Rachel Blackman <packetdancer@gmail.com>
Co-authored-by: utf8 <uft8decodeerror@gmail.com>

* Rebased Deep Worlds fork (#93)

* Add UPROPERTY Categories to allow compilation as engine plugin.

* Adding Method CancelAbility, allowing ending an ability without triggering EndAbilityEvent.
Internally, FinishEndAbility Method as also been added and ensure logics (see GAS termination of an ability)

* Moving Activation tag requirement check before instantiation of the ability.

* Added Activity Blocked by ActiveAbility

* Fixing crash in HandleTaskHeartBeat.

* Change behavior for attribute ChangeCallback

- Callback OnAttributeChanged is now also called on SP/AP
- Callback is now also called when the value is affected outside for whatever reason (like by SetAttributeValueByTag)
- Support Replay
- SetAttributeValueByTag now also re-caculate the value.

Signed-off-by: Eric Rajot <aherys@deepworlds.studio>

* BL-279 Clean before merge
- Removed Log message
- Removed irrelevant bounding

Signed-off-by: Eric Rajot <aherys@deepworlds.studio>

* BL-279 Bug fixing and improvement for rep notify

* BL-279 Fixing Attribute notification

* BL-279 Adding Byte data type to Set Target for DW GMC Ability

* Improvement for tags, added duration

* BL-232 Progress

* BL-232 Initial work on External Effect/Ability Pending and Tag application

* BL-232 Working state.

* BL-232 Refactor and cleaning, handled now by Instanced Struct

* BL-232 Progress of the day

* Fixing a bug in remove effect.

They are now removing by specifique ID when outer removed, to ensure the list rest coherent client <-> server

* BL-232 Fixing removing effect

* BL-232 bug fixing in effect

* Bug fixing, adding accessor

* BL-232 Fix effect remove itself even is another instance is running

* Added getter

* Stability
- Fixed name space for SetTargetDataFloat,
- Fixed EEffectType of GMCAbilityEffect sharing same name than playfab
- Fixed wait for input key release with suggestion of Nas
- GetAbilityMapData now return a const ref.

For compability, you probably want to add to core redirect those lines :
```
+EnumRedirects=(OldName="/Script/GMCAbilitySystem.EEffectType",NewName="/Script/GMCAbilitySystem.EGMASEffectType")
+EnumRedirects=(OldName="/Script/GMCAbilitySystem.EEffectState",NewName="/Script/GMCAbilitySystem.EGMASEffectState")
```

* Adding possibility for effect to end an active ability

* Changing Ability Blocking way.

They are now internally stored. An Ability store itself what ability it will block, instead of other ability who will block him.

This allow to modify during execution this behavior.
For example, you may be want to stop an ability activation only during X time in your ability execution.

* Adding a nicer way to end ability

* BL-225 Grenade 100%

* Fix clang error

* Adding Attribute Dynamic Condition to effect.

* Fix crash when an active effect has been destroyed

* Module upload

* GMC Update

* Addition of levitation actor

* Crash fix

* GMC Fix for starting abilities,
Fix for stamina,
Fix for crash,
Adding speed for orb,
Adding plugin for metahuman hairs.

* Update for log

* Fix for GetActiveEffect ?

* Typo fix

* couple of misc fixes from rebasing deep worlds fork

---------

Signed-off-by: Eric Rajot <aherys@deepworlds.studio>
Co-authored-by: Eric Rajot <aherys@deepworlds.studio>

* Update SetTargetDataGameplayTag.cpp

fix: Remove super call for SetTargetDataGameplayTag

---------

Signed-off-by: Eric Rajot <aherys@deepworlds.studio>
Co-authored-by: Peter Gilbert <33180578+petegilb@users.noreply.github.com>
Co-authored-by: Rachel Blackman <packetdancer@gmail.com>
Co-authored-by: Bean's Beans Studios <dylancharleston@gmail.com>
Co-authored-by: utf8decodeerror <30543450+utf8decodeerror@users.noreply.github.com>
Co-authored-by: utf8 <uft8decodeerror@gmail.com>
Co-authored-by: Eric Rajot <aherys@deepworlds.studio>
  • Loading branch information
7 people authored Sep 18, 2024
1 parent 4066d2f commit e427d8e
Show file tree
Hide file tree
Showing 24 changed files with 1,036 additions and 103 deletions.
37 changes: 35 additions & 2 deletions Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ void UGMCAbility::Tick(float DeltaTime)
return;
}
}

if (bEndPending) {
EndAbility();
return;
}

TickTasks(DeltaTime);
TickEvent(DeltaTime);
Expand Down Expand Up @@ -125,6 +130,23 @@ void UGMCAbility::RemoveAbilityCost(){
}
}


void UGMCAbility::ModifyBlockOtherAbility(FGameplayTagContainer TagToAdd, FGameplayTagContainer TagToRemove) {
for (auto Tag : TagToAdd) {
BlockOtherAbility.AddTag(Tag);
}

for (auto Tag : TagToRemove) {
BlockOtherAbility.RemoveTag(Tag);
}
}


void UGMCAbility::ResetBlockOtherAbility() {
BlockOtherAbility = GetClass()->GetDefaultObject<UGMCAbility>()->BlockOtherAbility;
}


void UGMCAbility::HandleTaskData(int TaskID, FInstancedStruct TaskData)
{
const FGMCAbilityTaskData TaskDataFromInstance = TaskData.Get<FGMCAbilityTaskData>();
Expand All @@ -139,7 +161,7 @@ void UGMCAbility::HandleTaskData(int TaskID, FInstancedStruct TaskData)

void UGMCAbility::HandleTaskHeartbeat(int TaskID)
{
if (RunningTasks.Contains(TaskID))
if (RunningTasks.Contains(TaskID) && RunningTasks[TaskID] != nullptr) // Do we ever remove orphans tasks ?
{
RunningTasks[TaskID]->Heartbeat();
}
Expand All @@ -150,6 +172,12 @@ void UGMCAbility::ServerConfirm()
bServerConfirmed = true;
}


void UGMCAbility::SetPendingEnd() {
bEndPending = true;
}


UGameplayTasksComponent* UGMCAbility::GetGameplayTasksComponent(const UGameplayTask& Task) const
{
if (OwnerAbilityComponent != nullptr) { return OwnerAbilityComponent; }
Expand Down Expand Up @@ -210,7 +238,6 @@ bool UGMCAbility::IsOnCooldown() const
}



bool UGMCAbility::PreExecuteCheckEvent_Implementation() {
return true;
}
Expand Down Expand Up @@ -241,6 +268,12 @@ bool UGMCAbility::PreBeginAbility() {
void UGMCAbility::BeginAbility()
{

if (OwnerAbilityComponent->IsAbilityTagBlocked(AbilityTag)) {
CancelAbility();
return;
}


if (bApplyCooldownAtAbilityBegin)
{
CommitAbilityCooldown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ void UGMCAbilityTaskBase::RegisterTask(UGMCAbilityTaskBase* Task)

void UGMCAbilityTaskBase::Tick(float DeltaTime)
{
// Locally controlled server pawns don't need to send heartbeats
if (AbilitySystemComponent->GMCMovementComponent->IsLocallyControlledServerPawn()) return;

// If not the server version of the component, send heartbeats
if (AbilitySystemComponent->GetNetMode() != NM_DedicatedServer)
{
if (ClientLastHeartbeatSentTime + HeartbeatInterval < AbilitySystemComponent->ActionTimer)
Expand All @@ -42,6 +46,7 @@ void UGMCAbilityTaskBase::Tick(float DeltaTime)
{
UE_LOG(LogGMCReplication, Error, TEXT("Server Task Heartbeat Timeout, Cancelling Ability: %s"), *Ability->GetName());
Ability->EndAbility();
EndTask();
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "Ability/Tasks/SetTargetDataByte.h"

#include "GMCAbilityComponent.h"


UGMCAbilityTask_SetTargetDataByte* UGMCAbilityTask_SetTargetDataByte::SetTargetDataByte(UGMCAbility* OwningAbility,
uint8 Byte)
{
UGMCAbilityTask_SetTargetDataByte* Task = NewAbilityTask<UGMCAbilityTask_SetTargetDataByte>(OwningAbility);
Task->Ability = OwningAbility;
Task->Target = Byte;
return Task;
}

void UGMCAbilityTask_SetTargetDataByte::Activate()
{
Super::Activate();

if (AbilitySystemComponent->GetNetMode() != NM_DedicatedServer)
{
ClientProgressTask();
}
}

void UGMCAbilityTask_SetTargetDataByte::ProgressTask(FInstancedStruct& TaskData)
{
Super::ProgressTask(TaskData);
const FGMCAbilityTaskTargetDataByte Data = TaskData.Get<FGMCAbilityTaskTargetDataByte>();

Completed.Broadcast(Data.Target);
EndTask();
}

void UGMCAbilityTask_SetTargetDataByte::ClientProgressTask()
{
FGMCAbilityTaskTargetDataByte TaskData;
TaskData.TaskType = EGMCAbilityTaskDataType::Progress;
TaskData.AbilityID = Ability->GetAbilityID();
TaskData.TaskID = TaskID;
TaskData.Target = Target;
const FInstancedStruct TaskDataInstance = FInstancedStruct::Make(TaskData);

Ability->OwnerAbilityComponent->QueueTaskData(TaskDataInstance);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ void UGMCAbilityTask_SetTargetDataGameplayTag::ProgressTask(FInstancedStruct& Ta
}

void UGMCAbilityTask_SetTargetDataGameplayTag::ClientProgressTask(){
Super::ClientProgressTask();

FGMCAbilityTaskTargetDataGameplayTag TaskData;
TaskData.TaskType = EGMCAbilityTaskDataType::Progress;
TaskData.AbilityID = Ability->GetAbilityID();
Expand Down
7 changes: 5 additions & 2 deletions Source/GMCAbilitySystem/Private/Ability/Tasks/WaitDelay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ void UGMCAbilityTask_WaitDelay::Tick(float DeltaTime)

void UGMCAbilityTask_WaitDelay::OnTimeFinish()
{
Completed.Broadcast();
EndTask();
if (GetState() != EGameplayTaskState::Finished)
{
Completed.Broadcast();
EndTask();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include "Ability/Tasks/WaitForGMCMontageChange.h"

#include "GMCOrganicMovementComponent.h"
#include "Components/GMCAbilityComponent.h"



UGMCAbilityTask_WaitForGMCMontageChange::UGMCAbilityTask_WaitForGMCMontageChange(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{

}

UGMCAbilityTask_WaitForGMCMontageChange* UGMCAbilityTask_WaitForGMCMontageChange::WaitForGMCMontageChange(UGMCAbility* OwningAbility)
{
UGMCAbilityTask_WaitForGMCMontageChange* Task = NewAbilityTask<UGMCAbilityTask_WaitForGMCMontageChange>(OwningAbility);
return Task;
}

void UGMCAbilityTask_WaitForGMCMontageChange::Activate()
{
Super::Activate();
bTickingTask = true;

OrganicMovementCmp = Cast<UGMC_OrganicMovementCmp>(AbilitySystemComponent->GMCMovementComponent);

if (OrganicMovementCmp == nullptr)
{
UE_LOG(LogGMCAbilitySystem, Error, TEXT("WaitForGMCMontageChange called without an Organic Movement Component"));
OnFinish();
return;
}

StartingMontage = OrganicMovementCmp->GetActiveMontage(OrganicMovementCmp->MontageTracker);
if (StartingMontage == nullptr)
{
UE_LOG(LogGMCAbilitySystem, Error, TEXT("WaitForGMCMontageChange called without a running montage"));
OnFinish();
}
}

void UGMCAbilityTask_WaitForGMCMontageChange::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

const UAnimMontage* RunningMontage = OrganicMovementCmp->GetActiveMontage(OrganicMovementCmp->MontageTracker);

// If the montage has changed, finish the task
if (StartingMontage != RunningMontage)
{
OnFinish();
}
}

void UGMCAbilityTask_WaitForGMCMontageChange::OnFinish()
{
if (GetState() != EGameplayTaskState::Finished)
{
Completed.Broadcast();
EndTask();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Ability/Tasks/WaitForInputKeyRelease.h"

#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "Components/GMCAbilityComponent.h"
#include "Kismet/KismetSystemLibrary.h"

Expand Down Expand Up @@ -29,9 +30,15 @@ void UGMCAbilityTask_WaitForInputKeyRelease::Activate()
// Check that the value isn't currently false.
if (bShouldCheckForReleaseDuringActivation)
{
const FInputActionValue ActionValue = InputComponent->GetBoundActionValue(Ability->AbilityInputAction);
if (!ActionValue.Get<bool>())
FInputActionValue ActionValue = FInputActionValue();
APlayerController* PC = AbilitySystemComponent->GetOwner()->GetInstigatorController<APlayerController>();
if (UEnhancedInputLocalPlayerSubsystem* InputSubSystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PC->GetLocalPlayer())) {
ActionValue = InputSubSystem->GetPlayerInput() ? InputSubSystem->GetPlayerInput()->GetActionValue(Ability->AbilityInputAction) : FInputActionValue();
}

if (ActionValue.GetMagnitude() == 0)
{
UE_LOG(LogGMCAbilitySystem, Error, TEXT("UGMCAbilityTask_WaitForInputKeyRelease::Activate: EndOnStart!"));
// We'll want to immediately unbind the binding.
InputComponent->RemoveActionBindingForHandle(Binding.GetHandle());
InputBindingHandle = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ UGMCAbilityAnimInstance::UGMCAbilityAnimInstance(const FObjectInitializer& Objec
#endif
}

UGMCAbilityAnimInstance::~UGMCAbilityAnimInstance()
{
TagPropertyMap.Reset();
}

void UGMCAbilityAnimInstance::NativeInitializeAnimation()
{
Super::NativeInitializeAnimation();
Expand Down
Loading

0 comments on commit e427d8e

Please sign in to comment.