Code Monkey home page Code Monkey logo

gasdocumentation's People

Contributors

antonrr avatar c0nscience avatar dumbeldor avatar fp12 avatar gaurang-ingale avatar hoelzl avatar iniside avatar jonzlin95 avatar keymaster- avatar lordzardeck avatar mijeong-go avatar minimpoun avatar roidanton avatar sadunkit avatar sentyaanko avatar sonictimm avatar timoxley avatar tranek avatar vorixo avatar wizardcell avatar yawlighthouse avatar zeldarck avatar zompi2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gasdocumentation's Issues

Is calling EndTask() on AbilityTasks like WaitTargetData still necessary?

From the docs under 4.7.3:

Some AbilityTasks don't automatically end when the GameplayAbility ends like WaitTargetData. These should be manually ended in the GameplayAbility's OnEndAbility if they're still running (WaitTargetData naturally ends when the user presses Confirm or Cancel inputs).

WaitTargetData tasks seems to be ending automatically whether I'm ending or cancelling/interrupting the gameplay ability.
I can't see anything obvious that is preventing these ability tasks to end when the ability ends.
Have I missed something or has this changed in newer engine versions?
I'm on 4.25.

Attribute Modifiers Guarded by Tags Not Testable -- Any Ideas?

Apologies for asking this here, since it's really more of a support question that belongs in the UE4 Answer Hub, but there doesn't seem to be anyone over there answering GAS-related questions, and I think this might be something quick I'm completely missing.

I'm working on a public plug-in for UE4 that implements Pathfinder 2e on the GAS, and writing some specs as part of developing that project since we need to make sure we can keep all the math with stacking, modifiers, etc. straight before the project gets super large.

Anyway, after some initial stops and starts, testing has been going relatively smoothly until I tried to write a test for a Gameplay Effect that calculates a boost to the character's "key ability". We've implemented things such that each of the abilities of the character (Strength, Dexterity, Intelligence, etc.) and their modifiers are Attributes in the Attribute Set; so, there are 6 x 2 = 12 attributes total.
image

Then, we represent the character's "key ability" using a tag on the character's ASC:
image

To calculate the boost, we have an Infinite GE (GE_CalcKeyAbilityBoost) that has one modifier per attribute, invoking a custom MMC that encapsulates the boost logic (+2 if attribute is < 18, +1 thereafter). Each modifier is guarded by its corresponding key ability tag; for example, for the strength attribute:
image

Then we have class-based Infinite GEs that apply the appropriate tags to the character based on the key ability of their class (e.g. warriors have Strength as a key ability, mages have Intelligence, etc). That all seems to work in the game, but getting this to work in a spec/test has been a nightmare. For whatever reason, the effect of an ability boost doesn't seem to "stick" to the attribute score -- neither the base nor current value of the attribute is boosted after the GE that applies the boost is made active on the character (I would expect the current value to increase with the boost, since it's an infinite GE).

Initially, I was adding the tag as a loose tag, but I read the part here about how that doesn't replicate, and I figured that perhaps replication was necessary for tags to be evaluated. Then I tried creating a GE on the fly with the CONSTRUCT_CLASS macro Epic uses in GameplayEffectTests.cpp, but that didn't work; so I read the part here about how GEs that are generated on-the-fly don't work on the server because it can't find the class definition. Eventually I just created a GE that I'm loading in the test that gets applied first, and that is an infinite GE that adds the tags:
image

Regardless, it still doesn't work; no matter what, when the test checks the character's current and base value for the attribute, it's still the starting value set by the test. The test logic is otherwise correct -- if I remove the tag requirement on the attribute in GE_CalcKeyAbilityBoost, the MMC magnitude will stick and increment the attribute, and the test will pass. So, this seems heavily related to how the tags are getting evaluated by the GAS during the test.

I have spent several work days stepping through the GAS and the various aggregator logic to see where this is supposed to be getting evaluated, but so far the logic seems as the though the tag checks are being satisfied, yet the value is not sticking in the attribute set.

Any ideas? Is there something else I need to get tags to be evaluated? Am I somehow looking at a stale copy of the attribute set?

The test code is here:
https://gist.github.com/GuyPaddock/ff8dcba1d30b5e3751c1226f24e24e56

It depends on other code from the project:
https://github.com/OpenPF2/PF2Core/tree/feature/specs-and-unit-tests/Source/OpenPF2Core/Private/Tests

How Jump Abiity works?

Hi again,
I couldn't find the reference where the JumpAbility is being bind to the Spcaebar key binding.

Copy paste error 4.6 Critical Hits

Change

The ExecutionCalculation checks if the GameplayEffectSpec has that Effect.CanLifesteal GameplayTag

to

The ExecutionCalculation checks if the GameplayEffectSpec has that Effect.CanCrit GameplayTag

Btw, thank you very much for this documentation ! It's very good ^^

Bug with stun gameplay cue activation

Hi, i found a bug in the stun gameplay cue. When you stun an enemy the animation is ok, you see the explosion of the effect, the loop and the end. If you stun again the enemy the animation jump the start animation and starts from the loop.

Why is Addition Used in "4.5.12.1.2 Backing Data Attribute Calculation Modifier"?

In both section 4.5.12.1.2 Backing Data Attribute Calculation Modifier and in the Epic Action RPG sample, damage GEs snapshot the source damage before adding the weapon damage to it. Why?

  • Is the "source" in this context the character who initiated the damage or is it the ASC on which the damage GE is being executed?
  • If the "source" is the character who initiated the damage, wouldn't this mean that if a character who just received damage ("character A") attacks another character ("character B"), character A's injury/damage would add to damage being inflicted on character B?

Client crash on kill if no death montage set

If a character has no death montage set then when they die they will be instantly destroyed.

if (DeathMontage)
{
PlayAnimMontage(DeathMontage);
}
else
{
FinishDying();
}
}
void AGDCharacterBase::FinishDying()
{
Destroy();
}

This causes issues when a client kills a character because in AHSPlayerController::ShowDamageNumber_Implementation, TargetCharacter is null which causes a crash.

void AGDPlayerController::ShowDamageNumber_Implementation(float DamageAmount, AGDCharacterBase * TargetCharacter)
{
UGDDamageTextWidgetComponent* DamageText = NewObject<UGDDamageTextWidgetComponent>(TargetCharacter, DamageNumberClass);

I don't know why this doesn't crash the server, it seems that when AHSPlayerController::ShowDamageNumber_Implementation runs on the server, TargetCharacter is not null. I'm not sure if there is a preferred way of fixing this but for now my quick fix has just been to add an if (TargetCharacter) inside AHSPlayerController::ShowDamageNumber_Implementation but I may add a timer in the future so damage numbers still show on death.

Crash at AGDHeroCharacter::SetupPlayerInputComponent()

Rare crash where ASC is null in AGDHeroCharacter::SetupPlayerInputComponent().

Can only get it to happen when I have 2 players on dedicated server with play in new editor window.

PlayerController is calling ClientRetryClientRestart and ClientRestart before PlayerState is created.

Why not put ASC in player controller?

Thanks for this great documentation about GAS.

Sorry, I can't find a way to contact you, so I opened this issue.

Why it it is recommended to put ASC in player state instead of player controller?

If your Actor will respawn and need persistence of Attributes or GameplayEffects between spawns (like a hero in a MOBA), then the ideal location for the ASC is on the PlayerState.

Player controller can also support "respawn persistence", and it don't need to adjust the NetUpdateFrequency.

Note: If your ASC is on your PlayerState, then you will need to increase the NetUpdateFrequency of your PlayerState. It defaults to a very low value on the PlayerState and can cause delays or perceived lag before changes to things like Attributes and GameplayTags happen on the clients. Be sure to enable Adaptive Network Update Frequency, Fortnite uses it.

So, I am curious about the reason behind this.

Suggestion for 12. GAS Changelog - 4.27

Hi tranek, thanks a lot for your documentation.
Recenlty I found that the method "GrantAndActivateAbilityOnSelfWithParams" seems to be replaced with "GiveAbilityAndActivateOnce".
It would be better if you could change the function name. Anyway, it's not a big problem.

Applying a Gameplay Effect Spec with Source/Target Tags Requirements in C++ inside Gameplay Ability Class

I'm trying to cast a gameplay effect on a character with a gameplay effect spec to use the tag requirements and manage the modifiers that will be used. But I'm confused because my test character has all the requirement tags, but the effect doesn't apply and i'm going crazy trying to figure out where i'm failing.

void UGASGameplayAbility::ApplyEffectToSelf()
{
     for (const auto& _Effect : AbilityEffects)
     {
         GetCurrentAbilitySpec()->SetByCallerTagMagnitudes.Add(_Effect.Key, AbilityActiveTime);
         auto _SpecHandle = MakeOutgoingGameplayEffectSpec(GetCurrentAbilitySpecHandle(), GetCurrentActorInfo(), GetCurrentActivationInfo(), _Effect.Value.Get());
 
         if (_SpecHandle.IsValid())
         {
             ApplyAbilityTagsToGameplayEffectSpec(*_SpecHandle.Data.Get(), GetCurrentAbilitySpec());
             ApplyGameplayEffectSpecToOwner(GetCurrentAbilitySpecHandle(), GetCurrentActorInfo(), GetCurrentActivationInfo(), _SpecHandle);
         }
     }
 }

ue5pebug

IAbilitySystemInterface usage at 2 places.

Hi buddy,
First of really thanks for wonderful work and sharing it.
I got confused since you are using IAbilitySystemInterface for PlayerState and BaseCharacter class.

Can you explain your logic please?

Add info to README about targeting reticles

Can either pull example from Belica from Paragon Demo or wait until the next sample project is complete. It's probably better to wait so that I can point to a working example that other people can try.

Dynamic GE Creation

Received PreReplicatedRemove with no UGameplayEffect def.

Not sure why but I get this error when I create a GE dynamically. This is my code:

        UGameplayEffect* GE_StatusEffect = NewObject<UGameplayEffect>(GetTransientPackage(),
	                                                              FName(TEXT("StatusEffect")));
	GE_StatusEffect->DurationPolicy = EGameplayEffectDurationType::HasDuration;
	GE_StatusEffect->DurationMagnitude = FGameplayEffectModifierMagnitude(FScalableFloat(Duration));


	// Add one new modifier to the list. 
	const int32 Idx = GE_StatusEffect->Modifiers.Num();
	GE_StatusEffect->Modifiers.SetNum(Idx + 1);
	FGameplayModifierInfo& ModifierInfo = GE_StatusEffect->Modifiers[Idx];
	GE_StatusEffect->InheritableOwnedTagsContainer.AddTag(FGameplayTag::RequestGameplayTag(FName("Status.Slowed")));
	ModifierInfo.ModifierMagnitude = FScalableFloat(Magnitude);
	ModifierInfo.ModifierOp = ModOp;
        ModifierInfo.Attribute = UMy_AttributeSet::GetMovementSpeedAttribute();

Projectile Issue

Hi,

I'm not sure if this is out of scope of GAS but I noticed the following issue.

When I shoot at a minion from a certain distance shot projectiles fly right through the target. I think this is because the projectile is seen by the physics engine only in front and behind the target when it ticks. So I tried the projectile shots from the same position/angle/distance using Slomo .01 which seems to "fix" this because it probably gives the physics engine more time to actually see the projectile hitting the target.

Here's a short video that demonstrates this:
https://youtu.be/YSxnr08OVBc

Can this be solved using GAS? Maybe some sort of sweep collision tests?

EDIT
I forgot to mention an important detail! This seems to only happen when the game is run as a standalone application.

Clarification about GameplayDebuger

Use the Gameplay Debugger when you want to see the GameplayTags, GameplayEffects, and GameplayAbilities on other Characters. Unfortunately it does not show the CurrentValue of the target's Attributes. It will target whatever Character is in the center of your screen. Look at a different Character and press Apostrophe (') again to switch to inspecting its ASC. The currently inspected Character has the largest red circle above it."

In PIE mode you can select any character in the Wolrld Outline tab. That character will become Debug Actor(it name will be displayed in top right corner). If that character has a GAS component then its parameters will be displayed in the Gameplay Debugger.

Problem in Animation Instance

I am using plugin "AnimIK" from the marketplace. Basically I do create with it Animation Blueprint. After, setting all things in that AnimBP. I do use from that plugin the custom FullbodyIK node in AnimGraph what is pined to OutputPose Everything works fine until I do restart the project. After it FullbodyIK node always does disappears, like it ha been removed. I did test it on GAShooter temple as well and the same problem. I did also test on ActionRPG temple that uses GAS and there works fine.
I am not really good with coding, still learning so it is hard for me to track the bug or find the reason why it is happening.

I did test also with some other plugin and I am having the same issue.

PassiveArmor stacking using Period in effect

Hey, just wanted to let you know that in GE_PassiveArmor you can set the period in the effect itself to achieve the same task that your ability is doing. For example if you put period as 0.25 s then every 0.25 s your effect will be applied automatically. This will mean you don't have to do the task wait delay in the GA_PassiveArmor and just wait and listen for incoming damage.

You might add a section for this since the 'period' (works only in infinite and duration gameplay effects) provides a good way to do health regen, mana regen, health potions and any periodic effects that repeatedly change a attribute over time.

Love the documentation by the way :D

Problem with AttributeSetBase when no default pawn class chosen

Apologies if this issue is not relevant to the repo, however, with some experimenting with the example project it is reasonably easy to reproduce.
I have changed the game mode BP to have no default pawn and added a spawn function which creates a BP_HeroCharacter and posseses it with the player controller. This would be useful if you wanted a character select screen for example.
Capture
When this spawn function is triggered from the PC's begin play everything seems to work fine, however, when this function is triggered in play instead, some weird behaviour happens.
When using a listen server and client, the listen server is setup correctly but the client's call to PS->GetAttributeSetBase() returns all the attributes set to 0.


Capture1
This causes the client to die because its max health is set to 0.

Again, apologies if this kind of issue is out of scope, however, it seems to me to be connected to how the AbilitySystemComponent is setup in this project so I thought it might be useful to ask here.

Adding and removing AttributeSets has problems

I have a Character and Weapon classes in my project.

Weapon keeps its stats, such as MagazineAmmoCount on an attributeset that it owns. My "shoot" ability costs "1 MagazineAmmoCount" attribute to shoot. However, because these attributes are not initialized properly and instead I add them through SpawnedAttributes.AddUnique (as shown in this documentation), system crashes somewhere and my project closes.

Crash tells me that faulty line is following
UFUNCTION() void OnRep_MagazineAmmoCount() { GAMEPLAYATTRIBUTE_REPNOTIFY(UZWeaponAttributeSet, MagazineAmmoCount); }

I have come up with following solution to work around this problem:
AbilitySystem->InitStats(UZWeaponAttributeSet::StaticClass(), Weapon->StatInitializer); Weapon->InitializeAttributesFromThis(AbilitySystem);

Idea is to basically initialize attributes as standard, and then updating them manually using attribute set located at weapon. I havent tested the unequip function yet.

Attribute snapshotting description not accurate

The description of the way snapshotting works found in the documentation is missing the differences between snapshotting a source-captured and a target-captured attribute value. From the testing I've done, here are the four outcomes that GAS can have:

Snapshot + Source = Captured at spec creation
Snapshot + Target = Captured at spec application
NoSnapshot + Source = Always refreshed when attribute changes
NoSnapshot + Target = Always refreshed when attribute changes

Add another reason to the warning mentioned in section 9.1

9.1 LogAbilitySystem: Warning: Can't activate LocalOnly or LocalPredicted ability %s when not local!
You need to initialize the ASC on the client.

You may also get this warning if you have a local only ability that you grant on the server and try to activate on the server.

Suggestion for section 4.11.1 (Target Data)

Pull Request: #102
At the end of the section it talks about how Target Data is polymorphic so you can add your own types but nowhere in the code or in the document is it explained on get your custom FGameplayAbilityTargetData from a FGameplayAbilityTargetDataHandle, the source code only shows examples of overriding the base functions inside FGameplayAbilityTargetData and using those. I wanted to suggest adding examples for how to add a custom FGameplayAbilityTargetData to a FGameplayAbilityTargetDataHandle and an example of how to get that custom FGameplayAbilityTargetData from the handle to get custom values.
As a suggestion(you're totally welcome to rip this apart and say the code is bad I just want to help improve the documentation as much as possible):
Declaring the custom FGameplayAbilityTargetData

USTRUCT(BlueprintType)
struct MYGAME_API FGameplayAbilityTargetData_CustomData : public FGameplayAbilityTargetData
{
        GENERATED_BODY()
public:

        FGameplayAbilityTargetData_CustomData()
        { }

        UPROPERTY()
        FName CoolName = NAME_None;

        UPROPERTY()
        FPredictionKey PredictionForAbility;

	// This is required for all child structs of FGameplayAbilityTargetData
	virtual UScriptStruct* GetScriptStruct() const override
	{
		return FGameplayAbilityTargetData_CustomData::StaticStruct();
	}

	// This is required for all child structs of FGameplayAbilityTargetData
        bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
        {
                CoolName.NetSerialize(Ar, Map, bOutSuccess);
                PredictionForAbility.NetSerialize(Ar, Map, bOutSuccess);
                bOutSuccess = true;
                return true;
        }
}

template<>
struct TStructOpsTypeTraits<FGameplayAbilityTargetData_CustomData> : public TStructOpsTypeTraitsBase2<FGameplayAbilityTargetData_CustomData>
{
	enum
	{
		WithNetSerializer = true // This is REQUIRED for FGameplayAbilityTargetDataHandle net serialization to work
	};
};

And for adding the value to a handle

FGameplayAbilityTargetData_CustomData* CustomData = new FGameplayAbilityTargetData_CustomData();
CustomData->CoolName = FName("Hello there!");
FGameplayAbilityTargetDataHandle Handle;
Handle.Add(CustomData);

And for getting the value/safely casting

FGameplayAbilityTargetData* data = Handle.Data[0].Get();
// Valid check we have something to use :D
if(data == nullptr)
{
    return;
}
// This is basically the type checking pass, static_cast does not have type safety, this is why we do this check. If we don't do this then it will object slice(google it if you don't know what that is) the struct and we have no way of making sure its that type, 
// Another approach is to input gameplay tag(s) and filter based on that gameplay tag(s), different ways to do stuff sort of thing
if(data->GetScriptStruct() == FGameplayAbilityTargetData_CustomData::StaticStruct())
{
    // Here is when you would do the cast
    FGameplayAbilityTargetData_CustomData* CustomData = static_cast<FGameplayAbilityTargetData_CustomData*>(data);
}

How to call and use AbilityTask_SpawnActor in C++

How do we call BeginSpawningActor(), and FinishSpawningActor()? They require an AActor* for FinishSpawningActor, and BeginSpawningActor requires an AActor*&? Also, UAbilityTask_SpawnActor::SpawnActor() also requires a reference to the class, but not location, but beginspawning requires location. This whole function is bizarre to call in C++. Any tips?

Unable to launch or generate .sln file in 4.23

HI, I'm having trouble getting this working in 4.23. When I try to create an .sln 4.23 I get this message

Running C:/Program Files/Epic Games/UE_4.23/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project="D:/Git Hub/GASDocumentation/GASDocumentation.uproject" -game -rocket -progress -log="D:\Git Hub\GASDocumentation/Saved/Logs/UnrealVersionSelector-2020.02.25-12.18.01.log"
Discovering modules, targets and source code for project...
While compiling D:\Git Hub\GASDocumentation\Intermediate\Build\BuildRules\GASDocumentationModuleRules.dll:
d:\Git Hub\GASDocumentation\Source\GASDocumentationEditor.Target.cs(11,3) : error CS0103: The name 'DefaultBuildSettings' does not exist in the current context
d:\Git Hub\GASDocumentation\Source\GASDocumentationEditor.Target.cs(11,26) : error CS0103: The name 'BuildSettingsVersion' does not exist in the current context
ERROR: Unable to compile source files.

Any plan to add Tags for UE4?

Do you have a plan to add "git-project-tag" for UE 4.27?
After converting to UE5, It's quite hard to get UE4 version. I think some beginners would have to pay lots of time on this
Someone struggling with How to use this project on UE4, Use this command

git clone
git reset --hard 756524f
you can see above hash (756524....) on git log

Anyway, thank you for making this opensource-project. Awesome!

'ValidTransientAggregatorIdentifiers' cannot package

When I try to package my game, I get the following error when using 'ValidTransientAggregatorIdentifiers':

error C2065: 'ValidTransientAggregatorIdentifiers': undeclared identifier

Everything works fine in the editor.

In VS I also can only build with "...Editor" solution config without getting errors,

Using UE 2.27.1

Edit: Found out that the variable ValidTransientAggregatorIdentifiers is in a "#if WITH_EDITORONLY_DATA" section in the GameplayEffectExecutionCalculation.h

Why do you do this Epic?!

PassiveArmor ability is not activated at respawn.

If you change AGDHeroCharacter::PossessedBy() to the following, it will work.

void AGDHeroCharacter::PossessedBy(AController * NewController)
{
//...
		AddStartupEffects();
#if 1
		// Forcibly set the DeadTag count to 0
		AbilitySystemComponent->SetTagMapCount(DeadTag, 0);
#endif
		AddCharacterAbilities();

		AGDPlayerController* PC = Cast<AGDPlayerController>(GetController());
		if (PC)
		{
			PC->CreateHUD();
		}

		InitializeFloatingStatusBar();


		// Respawn specific things that won't affect first possession.

#if 0
		// Forcibly set the DeadTag count to 0
		AbilitySystemComponent->SetTagMapCount(DeadTag, 0);
#endif
//...
}

Suggestion for section 4.5.4.1

At the end of the section it's suggested that devs change engine code if they want their modifiers to be multiplied or divided instead of being added before the operation. While researching this issue, I ran into the concept of evaluation channels that were added in 4.14.

All you need to do is add the section below to DefaultGame.ini and then you can keep the original behavior and multiple or divide channels together.

[/Script/GameplayAbilities.AbilitySystemGlobals]
bAllowGameplayModEvaluationChannels=true
GameplayModEvaluationChannelAliases[0]="MyChannel01"
GameplayModEvaluationChannelAliases[1]="MyChannel02"

There are 10 channels defined in GameplayEffectTypes.h (EGameplayModEvaluationChannel), and for each channel you give a name to in the ini, you'll get to select that channel in the gameplay effect.

Then you can do Attribute * MyChannel01Mod * MyChannel02Mod.
Or even Attribute * MyChannel01Mod * (MyChannel02Mod1 + MyChannel02Mod2).

Since a lot of people rely on this documentation, which is great btw, I thought I'd suggest an alternate solution.

Clarification for "InitAbilityActorInfo" vs "RefreshAbilityActorInfo"

From my initial point of view, this isn't really a standard way to create an ability system, yes it does display that you can move components around, however because that this is on Player State, rather than being in a Character actor (Monsters, NPC's, etc can use Ability System, it's not really limited to the player) it could yield undesired results if implemented differently

While I was trying to implement the GAS system into my project, I found that the PlayerController was always set to null, since I was using the component to be per-character, rather than per-player-state (Reference where it's used https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp#L1164) thus any ability that tried to run was always being denied with "Can't activate LocalOnly or LocalPredicted ability %s when not local! Net Execution Policy is %d.".

This issue can be resolved by calling RefreshAbilityActorInfo() on PossessedBy() override your player actor.

TLDR: InitAbilityActorInfo is called automatically whenever the component is constructed, but if you have a player controller, it will not take it into the account, you must call RefreshAbilityActorInfo().

I haven't seen this being noted anywhere in the documentation, so hope the knowledge here would help someone that was stuck in the same boat.

Reference commit: 831ec2e

Custom Trace Profile / Collision Preset

I noticed the project has a Custom Channel "Ability" and custom Preset "TargetActorGroundLocation"

Are those critical to the project, and if so should they be documented?

Reason I ask, I'm trying to implement the Meteor GA in C++. I know I have to take care of the "K2Node_LatentGameplayTaskCall automagic sorcery" myself, but for some reason the target just paints at 0,0,0 but doesn't animate or track when I move around. I've been stepping through the code and thought maybe I'm missing some configuration regarding collisions.

image

Client ability cancellation could cause unwanted behavior

Thanks for sharing, I learned alot from you. Today I want to contribute a little bit.
In UGameplayAbility, there is an option called "bServerRespectsRemoteAbilityCancellation" which is enabled by default. It allows client to cancel the ability at will, whenever or not server is ready for it. This cause alot of unexpected behaviors. Take this one example.

  1. Start ability (local predicted)
  2. Set user movement to fly mode
  3. Play an aerial animation montage (which requires character in fly mode to display properly)
  4. Wait a little bit and do damage
  5. Set user back to walk mode
  6. End ability

Since this is local predicted, client performs this ability earlier than server and thus ends earlier than server. By the time client wants to end ability, server is still some where between playing animation and doing damage. That results in player doing no damage and floating around in fly mode.
In my opinion, this option should be disabled by default. When turned on, use with caution.

// Just realized you have it included already. Silly me.

Question & Doc Suggestion: ASC for RTS Games, PlayerState own all unit avatars?

How would you implement ASCs for a RTS game, I know MOBA is referred to here though which is similar.

From reading the docs for GAS implementation for a RTS game, I am not 100% sure if I should be
A) adding the ASC to the PlayerState as the OwnerActor and making all units AvatarActors owned by the PlayerState ASC
B) or if I should be adding separate individual ASCs for every unit and every unit is its own Avatar and OwnerActor.

I went with B and I am currently running into problems binding unit abilities to player input since Player Controller doesn't control the units.

I think doc might benefit if RTS is mentioned

Crash when calling InitGlobalData from EngineSubsystem

Replicate crash by adding a attribute set table in DefaultGame.ini as below:

[/Script/GameplayAbilities.AbilitySystemGlobals] +GlobalAttributeSetDefaultsTableNames=/Game/DataTables/InitialAttributes.InitialAttributes

Crash will occur due to trying to bind to delegate

GEditor->GetEditorSubsystem<UImportSubsystem>()->OnAssetReimport.AddUObject(this, &UAbilitySystemGlobals::OnTableReimported);

In the function UAbilitySystemGlobals::InitAttributeDefaults

Guessing this crashes since the EngineSubsystem is initialized before the EditorSubsystem

Suggested fix is to call InitGlobalData from the GameInstance instead

Suggestion to add to the Gameplay Effect section

Also something to note in the Gameplay Effect section is that Gameplay Effects have a property called "UIData". UIData is used for data for the UI representation of this effect(for like buffs and debuffs). UI layer can listen(or playercontroller/state) for when Gameplay Effect deactivate or activate, and use the UGameplayEffectUIData object from that effect to display to the HUD/UI. That way you can design the ui text, icons, etc from blueprints.

Now typically, I will have the ASC expose a much simpler delegate which just takes in the UGameplayEffectUIData object, and Gameplay Tag that is trigger when a Gameplay Effect activate and has UIData, and also a deactivation delegate that passes a Gameplay Tag. These two delegates are really for the UI layer, and to avoid having to pass around a huge Gameplay Effect Object.

suggestion about SendEventToActor function

GameplayTag

GameplayTag must be a sub-tag of event,otherwise RPGAbilityTask_PlayMontageAndWaitForEvent will not receive event.

Payload(GameplayEventData)

GameplayEventData have OtionalObject parameter.Through a UObject to send more data.
In blueprint,you can use "Construct Object".Instantiate an UObject asset as input.
And When an event is received.You can get this UObject instance.

I think this is very useful.And hope you can add to document.

Suggestion for Section 5.5 (Generating a Random Number on Client and Server)

You mention using the prediction activation key as the seed for the pseudo random number generator, but list a series of (valid) downsides to that approach.

The alternative suggestion could be an extension of the prediction activation key approach, but with additional information hashed in that the server and client both know. For instance, hashing together the prediction activation key and a server-set, replicated Match ID number would make the values different per match, and the first values wouldn't be seeded with 0.

You might also hash the prediction activation key with the client's network ID. The server and client both know the requesting client's network ID, so no new information need be sent in that case, and you get the added bonus that each peer gets a different series of numbers they'll generate.

Basic Combo Attack Ability.

Hi
I need some guidance regarding setting up new Ability and Ability Task.

So What I m doing is I have 3 montages to play for a basic combo attack move.
And that combo attack is one ability.
So my concern how do I play montage. I have figured out few options

  1. Fire AbilityTaskToPlayMontage when the BasicComboAttackAbility is triggered.
  2. When BasicComboAttackAbility is triggered play a simple montage inside of character class.

I prefer C++.

The AsyncTask listeners never terminate

The AsyncTask listeners for attribute, cooldown, and GE stack change never terminate until the game is closed.

They don't return a reference to themselves so we can't just manually make and call an EndTask() function when the widget is destroyed.

If a solution can't be found, they need to be removed so that people referencing this project don't use them and end up with zombie AsyncTasks in their games.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.