Giter Site home page Giter Site logo

gasshooter's Introduction

GASShooter

Introduction

GASShooter is an advanced FPS/TPS Sample Project for Unreal Engine 4's GameplayAbilitySystem (GAS) plugin. This is a sister project to the GASDocumentation and information about the techniques demonstrated here will be discussed in detail in the README there.

This is not production-ready code but a starting point for evaluating different techniques in GAS relating to using weapons. TargetActors with persistent hit results and ReticleActors particularly do a lot of code on Tick().

Assets included come from Epic Games' ShooterGame learning project, Epic Games' Infinity Blade assets, or made by myself.

GASShooter is current with Unreal Engine 4.27. There are branches of this Sample Project for older versions of Unreal Engine, but they are no longer supported and are liable to have bugs or out of date information.

Keybind Action
T Toggles between first and third person.
Left Mouse Button Activates the weapon's primary ability. Confirms targeting.
Middle Mouse Button Activates the weapon's alternate ability.
Right Mouse Button Activates the weapon's secondary ability.
Mouse Wheel Up Swaps to next weapon in inventory.
Mouse Wheel Down Swaps to previous weapon in inventory.
R Reloads the weapon.
Left Ctrl Cancels targeting.
Left Shift Sprint.
E Interact with interactable objects.
Console Command Action
kill Kills the local player.

The Hero character does have mana but no abilities currently use it. This project's inception started when the new BioShock was announced and the idea was to include BioShock-like upgradeable abilities. That made the scope too large, but it is something that may be revisited in the future.

Secondary ammo is not used. It would be used for things like rifle grenades.

Concepts covered

  • Ability Batching
  • Equippable weapons that grant abilities
  • Predicting weapon switching
  • Weapon ammo
  • Simple weapon inventory
  • Headshot bonus damage
  • Reusable, custom TargetActors
  • GameplayAbilityWorldReticles
  • Play replicated montages on multiple Skeletal Mesh Components belonging to the AvatarActor in an ability
  • Subclassing FGameplayEffectContext to send additional information to GameplayCues
  • Character shield that drains before health is removed by damage
  • Item pickups
  • Single button interaction system. Press or Hold 'E' to interact with interactable objects including player reviving, a weapon chest, and a sliding door.

This project does not show predicting projectiles. I refer you to the Unreal Tournament source code for how to do that using a fake projectile on the owning client.

Weapon Primary Ability (Left Mouse Button) Secondary Ability (Right Mouse Button) Alternate Ability (Middle Mouse Button)
Rifle Fire hitscan bullets based on the current fire mode. Aim down sights, reduces firing spread. Changes fire modes between full auto, semi auto, and burst.
Rocket Launcher Fire a rocket. Aim down sights. Starts lock-on targeting for homing rockets. Press LMB to fire homing rockets at targets. None
Shotgun Fire hitscan pellets based on the current fire mode. Aim down sights, reduces firing spread for pellets. Changes fire modes between semi auto and full auto.

Acknowledgements

KaosSpectrum provided significant contributions to figuring out how the ability batching system works and general feedback. Check out his game development blog.

gasshooter's People

Contributors

matzeogh avatar nicobatty avatar pladux avatar roidanton avatar sentyaanko avatar tranek avatar yawlighthouse 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

gasshooter's Issues

meta data update in 4.26 to hide from modifiers

GSAttributeSetBase.h line 97

currently meta = (HideFromLevelInfos)
doesn't work in 4.26

this looks to be new one for 4.26.1 tested
meta = (HideFromModifiers))

thanks for this amazing resource! working through it all at the moment.

Why We Captured the Damage Attribute From Source?

On line 21 of GSDamageExecutionCalc.cpp
DEFINE_ATTRIBUTE_CAPTUREDEF(UGSAttributeSetBase, Damage, Source, true);

According to your description, 'Damage' is a meta attribute, it can distribute the value to own attributes, Eg. health or armor.
Well, my question is why we need to captured the 'Damage' from the 'source'?

I think 'Source' is the GE's instigator. If A was injured by B, Then Why A need to care about B's meta attribute 'Damage'.

Integration with EnhancedInputComponent

As of now there is lack of information on this topic. The one example is how it is done in ValleyoftheAncient project, but it is more specific on single-player flow.

Issue in GSAbilitySystemGlobals

After packing the project and running it I do get crash with an error. In the beginning, I did think that I did maybe something wrong in my project but after downloading this clean sample it happens as well in it. I did try then ver UE4.24 and after packing works fine.

error

CrashLog:

GASShooter.log

I did find out that there is some issue(bug) with UGSAbilitySystemGlobals::InitGlobalTags() in GSAbilitySystemGlobals.cpp and GSAbilitySystemGlobals.h
So I did disable that and did replace where it needed to be

	DeadTag = UGSAbilitySystemGlobals::GSGet().DeadTag; 
	KnockedDownTag = UGSAbilitySystemGlobals::GSGet().KnockedDownTag;
	InteractingTag = UGSAbilitySystemGlobals::GSGet().Interacting;
	InteractingRemovalTag = UGSAbilitySystemGlobals::GSGet().InteractingRemoval;

with

	DeadTag = FGameplayTag::RequestGameplayTag("State.Dead");
	KnockedDownTag = FGameplayTag::RequestGameplayTag("State.KnockedDown");
	InteractingTag = FGameplayTag::RequestGameplayTag("State.Interacting");
	InteractingRemovalTag = FGameplayTag::RequestGameplayTag("State.InteractingRemoval");

seems to be working now

GSWeapon Crash

AGSWeapon crashes during level changes, as it uses a destructor rather than BeginDestroy

See ~AGSWeapon()

Listen for attribute change crashes the editor

Hi

First of all thanks for the great work you have done with the project.

Edit: I just realised that this is a known issue with 4.25. The issue has just been resolved with 4.25.1. I will keep the issue open in case you need to know - you can close the issue when you read this. :)

I have been inspecting the UI_HUD and found the "Listen for attribute change" function, which seems like a good way to track all the attributes for the UI. I am unfortunately getting an error when I try to save the UI_HUD and I get the same problem, when I try to use it in my own project:
Error

On further inspection it seems that the problem doesn't reside with the "Listen for attribute change" function, but instead when attributes are accessed. I get the same error when I use "Float attribute from ability system component":
Error2

A related question:
Is it a good idea to have this task living with the game state? What if you have 100's or 1000's of players in the same world - wouldn't that mean that the game state have as many async calls?

Best regards,
Morten

A question about attribute changes

Hi! First of all, thanks for the great documentation and the example, it helped me a lot.
But one thing is unclear to me. In your code you listen for attribute change value here on server and client:

HealthChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(AttributeSetBase->GetHealthAttribute()).AddUObject(this, &AGSPlayerState::HealthChanged);

And then applying knock or death logic. But can an attribute change be mispredicted? Or is this delegate is called only if the value was confirmed from server?

Hero Pawn doesnt render properly in split screen multiplayer

So i have been using this project as a bases to learn the ability system and when i tried to implement split screen multiplayer i ran into an odd problem. The Hero character acts like all the players are the owner of the Hero character and will only show the first person arms and gun, BUT The body is still shootable even though it doesnt render.

If you change PIE to use multiple windows and do multiplayer that way it works fine.

I've been working through the HeroCharacter code, and the player base class code but i'm not really figuring it out. if you do the normal Show only to owner on the first person and show to everyone else on the 3rd person mesh, nothing shows up, just a gun floating there.

Any Thoughts? insights? recommendations?

When possessing a new pawn crash from WaitInteractableTarget::PerformTrace()

Is this actually an issue with the sphere trace or something else, I'm pulling my hair out over it right now because i want to implement a simple vehicle system. and anytime i possess the vehicle bang crash.

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000000

UE4Editor_GASShooter!UGSAT_WaitInteractableTarget::PerformTrace() [C:\Users\joshk\source\repos\GASShooter\Source\GASShooter\Private\Characters\Abilities\AbilityTasks\GSAT_WaitInteractableTarget.cpp:196]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll

Server crash if client dies and quits before respawn

In dedicated server mode, when a client enters the revive state, and subsequently dies, if they quit before respawn, it causes the server to crash with the following error:

[2021.02.09-06.03.10:646][771]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 127.0.0.1:63692, Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: BP_PlayerController_C_2, Owner: BP_PlayerController_C_2, UniqueId: NULL:DESKTOP-DOMAN1B-9D6A29F545EE0383A7E145AED9D69AE5, Channels: 56, Time: 2021.02.09-06.03.10
[2021.02.09-06.03.10:650][771]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 127.0.0.1:63692, Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: BP_PlayerController_C_2, Owner: BP_PlayerController_C_2, UniqueId: NULL:DESKTOP-DOMAN1B-9D6A29F545EE0383A7E145AED9D69AE5
[2021.02.09-06.03.10:658][771]LogOnlineSession: Warning: OSS: No game present to leave for session (GameSession)
[2021.02.09-06.03.19:164][810]LogWindows: Error: === Critical error: ===
[2021.02.09-06.03.19:198][810]LogWindows: Error:
[2021.02.09-06.03.19:198][810]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x000000000000006c
[2021.02.09-06.03.19:199][810]LogWindows: Error:
[2021.02.09-06.03.19:200][810]LogWindows: Error: [Callstack] 0x00007ff8cbd7e964 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-06.03.19:200][810]LogWindows: Error: [Callstack] 0x00007ff8cbdf28de UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-06.03.19:201][810]LogWindows: Error: [Callstack] 0x00007ff8b007ea61 UE4Editor-GASShooter.dll!AGASShooterGameModeBase::RespawnHero() [I:\Unreal Projects\GASShooter\Source\GASShooter\GASShooterGameModeBase.cpp:84]
[2021.02.09-06.03.19:202][810]LogWindows: Error: [Callstack] 0x00007ff8ccfe05cc UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-06.03.19:203][810]LogWindows: Error: [Callstack] 0x00007ff8cd00faf9 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-06.03.19:204][810]LogWindows: Error: [Callstack] 0x00007ff8cc7347c2 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-06.03.19:206][810]LogWindows: Error: [Callstack] 0x00007ff8cc506a4f UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-06.03.19:210][810]LogWindows: Error: [Callstack] 0x00007ff6b7589bda UE4Editor.exe!UnknownFunction []
[2021.02.09-06.03.19:211][810]LogWindows: Error: [Callstack] 0x00007ff6b75a11ac UE4Editor.exe!UnknownFunction []
[2021.02.09-06.03.19:211][810]LogWindows: Error: [Callstack] 0x00007ff6b75a128a UE4Editor.exe!UnknownFunction []
[2021.02.09-06.03.19:214][810]LogWindows: Error: [Callstack] 0x00007ff6b75b52ed UE4Editor.exe!UnknownFunction []
[2021.02.09-06.03.19:235][810]LogWindows: Error: [Callstack] 0x00007ff6b75b801a UE4Editor.exe!UnknownFunction []
[2021.02.09-06.03.19:240][810]LogWindows: Error: [Callstack] 0x00007ff920787c24 KERNEL32.DLL!UnknownFunction []
[2021.02.09-06.03.19:241][810]LogWindows: Error: [Callstack] 0x00007ff921a4d4d1 ntdll.dll!UnknownFunction []
[2021.02.09-06.03.19:245][810]LogWindows: Error:
[2021.02.09-06.03.19:275][810]LogExit: Executing StaticShutdownAfterError
[2021.02.09-06.03.19:281][810]LogWindows: FPlatformMisc::RequestExit(1)
[2021.02.09-06.03.19:283][810]LogCore: Engine exit requested (reason: Win RequestExit)
[2021.02.09-06.03.19:313][810]Log file closed, 02/08/21 23:03:19

Interaction Prompt stays if object is killed

If you kill a character that is able to be revived, the revive prompt doesn't go away. I think I've fixed it in GSAT_WaitInteractableTarget.cpp in the block of code starting at 221.

if (!ReturnHitResult.bBlockingHit)
{
// No valid, available Interactable Actor

	//ReturnHitResult.Location = TraceEnd;   <----------Remove
	if (TargetData.Num() > 0 /*&& (TargetData.Get(0)->GetHitResult()->Actor.Get()*/)  <------Change
	{
		// Previous trace had a valid Interactable Actor, now we don't have one
		// Broadcast last valid target
		LostInteractableTarget.Broadcast(TargetData);
		TargetData.Clear();       <-------Add
	}

	//TargetData = MakeTargetData(ReturnHitResult);   <------Remove
}

this was causing TargetData.Num() > 0 to always be true which was fine unless the actor in the data just up and disappeared. I'm assuming it's because the reference to the actor isn't valid anymore so it comes back as false when you need it to be true. Hope that helps and doesn't cause more issues... Sorry, I don't know how to do the whole pull request stuff, I'm not really a programmer.

Phil

Not an Issue, just a Comment :)

I've been staring at ActionRPG for awhile now. It's a nice project, but a little confusing how it's put together. For example the whole attribute system which you describe and use so succinctly seems lost on that project.

Then I found this project. Superb. I think this project will literally shave months, possibly years off development, tysm for sharing!

Implements crouching

Have you thought about adding the possibility of crouching? I have seen the system you use to do Sprint and Jump a little complex, and I think it would be a little complex to do crouch, or roll, for example.

Thanks for this great template.

There's no overridden FGameplayEffectContext

The documentation says:

Subclassing FGameplayEffectContext to send additional information to GameplayCues

However, I can't find any such subclassing, either in this project, nor in GASDocumentation.
Is this a TODO item?
Did not not work, and the documentation should be removed?

BeamEnd wrong location in GC Rifle

On gameplayCue Rifle, you are using the Trace End for the BeamEnd location and not the impact location.
As a consequence, the trailing is going way behind the impact location.

It is not so visible with the current particles but if you tweak hit to be like a laser and change the camera in 3rd you will see it clearer.

thanks!

Last Equipped Weapon GameplayTag is not Cleared on Death on Clients

Server properly sets the equipped weapon tag to Weapon.Equipped.None and then back to Weapon.Equipped.Rifle on respawn. The reason is because this is called in AGSHeroCharacter::UnEquipCurrentWeapon() which is called eventually from AGSHeroCharacter::FinishDying() which is only called on the server and the Weapon.Equipped tag is a loose GameplayTag (not replicated).

The client was expected to receive the call to AGSHeroCharacter::UnEquipCurrentWeapon() to set the weapon tag back to Weapon.Equipped.None, but the AGSHeroCharacter::OnRep_CurrentWeapon() is never fired, most likely because the hero is marked pending kill in the same frame.

GC_Sprinting on Listen Server plays sound in wrong place.

When the Net Mode is set to Play As Listen Server and Sprint is executed on the client side, the Listen Server will play the sound on the RootComponent of Pawn, which is controlled by the Listen Server itself.

Currently, GetPlayerController->IsLocalPlayerController is used to determine if sound should be played or not.
OnRemove and OnActive receive MyTarget, so I suggest using MyTarget->GetOwner->CastToPlayerController->IsLocalPlayerController.

Batching Suggestion

Instead of having another ability to run the instant one in batch mode, for example the GA_RiflePrimary, we can batch the abilities when they are activating by input, so we can modify the AbilityLocalInputPressed like this:

if (GA && GA->bActivateOnInput)
{
    if (GA->bBatchActivation)
    {
	FScopedServerAbilityRPCBatcher GSAbilityRPCBatcher(this, Spec.Handle);
	TryActivateAbility(Spec.Handle);
    }
    else
    {
	// Ability is not active, so try to activate it
	TryActivateAbility(Spec.Handle);
    }
}

OnRep_PlayerState CreateHUD can fail if Player state has replicated on GSHeroCharacter.cpp before the player controller

Only noticed this when I was testing my code on dedicated server that I had set up with player state with the GAS components on it as the example, but guess it applies to yours as well.

When you call PC->CreateHUD(); line 855 GSHeroCharacter.cpp we know we have a valid Player state as it's called from OnRep_PlayerState and we also check the cast.

However On dedicated server I think there is a timing issue and in more real world situation I was getting a lot of occasions where the check for Player state in void AGSPlayerController::CreateHUD() (line 35) GSPlayerCOntroller.cpp was nullptr even tho it was replicated in the base character so the hud would create but not populate with the initial replicated values.

As the calling function was always guaranteed to have player state as it was called OnRep_PlayerState I updated the code to just pass a reference to that player state over to the player controller and not rely on the player controller also replicating at the same time and having it available to set the initial HUD values.

so just updated to

void CreateHud(class AGSPlayerState* PS);

and always passing it then it works every time.

Only small tweak but it was really obscure and seemingly random so thought I'd share just in case it was worth updating and it was small update.

I also tweaked the HUD class so you explicitly call start listening for attributes from C++ via blueprint event rather than having it start on HUD construct so I could really make sure initial replication had happened first before listening for more changes.

thanks again for the resource, learning so much from the code base.

Dedicated server sometimes crashes with a message dialog: "Pure virtual function being called while application was running (GIsRunning == 1)."

Haven't been able to consistently reproduce it, though the logs would suggest it seems to happen when a player dies while being revived.

[2021.02.09-05.56.53:153][361]Message dialog closed, result: Ok, title: Message, text: Pure virtual function being called while application was running (GIsRunning == 1).
[2021.02.09-05.56.53:155][361]LogOutputDevice: Warning:

Script Stack (6 frames):
GSInteractable.InteractableCancelInteraction
GA_RiflePrimaryInstant_C.ExecuteUbergraph_GA_RiflePrimaryInstant
GA_RiflePrimaryInstant_C.HandleTargetData
GA_RiflePrimaryInstant_C.ExecuteUbergraph_GA_RiflePrimaryInstant
GA_RiflePrimaryInstant_C.ValidData_CB2156954C4C16A1CDC040919D8AB16B
AbilitySystemComponent.ServerSetReplicatedTargetData

[2021.02.09-05.56.53:160][361]LogWindows: Windows GetLastError: The operation completed successfully. (0)
[2021.02.09-05.56.53:904][361]LogWindows: Error: === Critical error: ===
[2021.02.09-05.56.53:906][361]LogWindows: Error:
[2021.02.09-05.56.53:907][361]LogWindows: Error: Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Core/Private/Windows/WindowsPlatformMisc.cpp] [Line: 475]
[2021.02.09-05.56.53:907][361]LogWindows: Error: Pure virtual function being called
[2021.02.09-05.56.53:908][361]LogWindows: Error:
[2021.02.09-05.56.53:909][361]LogWindows: Error:
[2021.02.09-05.56.53:909][361]LogWindows: Error: [Callstack] 0x00007ff91e9a3b29 KERNELBASE.dll!UnknownFunction []
[2021.02.09-05.56.53:910][361]LogWindows: Error: [Callstack] 0x00007ff8cf25d096 UE4Editor-Core.dll!UnknownFunction []
[2021.02.09-05.56.53:911][361]LogWindows: Error: [Callstack] 0x00007ff8cf2607f8 UE4Editor-Core.dll!UnknownFunction []
[2021.02.09-05.56.53:911][361]LogWindows: Error: [Callstack] 0x00007ff8cef6e98d UE4Editor-Core.dll!UnknownFunction []
[2021.02.09-05.56.53:912][361]LogWindows: Error: [Callstack] 0x00007ff8cf2773c0 UE4Editor-Core.dll!UnknownFunction []
[2021.02.09-05.56.53:913][361]LogWindows: Error: [Callstack] 0x00007ff906d76994 VCRUNTIME140.dll!UnknownFunction []
[2021.02.09-05.56.53:913][361]LogWindows: Error: [Callstack] 0x00007ff8b006e515 UE4Editor-GASShooter.dll!IGSInteractable::InteractableCancelInteraction_Implementation() [I:\Unreal Projects\GASShooter\Source\GASShooter\Private\Characters\Abilities\GSInteractable.cpp:75]
[2021.02.09-05.56.53:914][361]LogWindows: Error: [Callstack] 0x00007ff8b00a5048 UE4Editor-GASShooter.dll!IGSInteractable::execInteractableCancelInteraction() [I:\Unreal Projects\GASShooter\Intermediate\Build\Win64\UE4Editor\Inc\GASShooter\GSInteractable.gen.cpp:31]
[2021.02.09-05.56.53:917][361]LogWindows: Error: [Callstack] 0x00007ff8d36c26a4 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:918][361]LogWindows: Error: [Callstack] 0x00007ff8d3950ef3 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:919][361]LogWindows: Error: [Callstack] 0x00007ff8cbe1c125 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:919][361]LogWindows: Error: [Callstack] 0x00007ff8b00a14ce UE4Editor-GASShooter.dll!IGSInteractable::Execute_InteractableCancelInteraction() [I:\Unreal Projects\GASShooter\Intermediate\Build\Win64\UE4Editor\Inc\GASShooter\GSInteractable.gen.cpp:776]
[2021.02.09-05.56.53:920][361]LogWindows: Error: [Callstack] 0x00007ff8b0061d50 UE4Editor-GASShooter.dll!AGSHeroCharacter::EndPlay() [I:\Unreal Projects\GASShooter\Source\GASShooter\Private\Characters\Heroes\GSHeroCharacter.cpp:664]
[2021.02.09-05.56.53:921][361]LogWindows: Error: [Callstack] 0x00007ff8cbdf36b4 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:921][361]LogWindows: Error: [Callstack] 0x00007ff8cc6f43db UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:922][361]LogWindows: Error: [Callstack] 0x00007ff8cbdf290a UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:923][361]LogWindows: Error: [Callstack] 0x00007ff8b00651b6 UE4Editor-GASShooter.dll!AGSHeroCharacter::FinishDying() [I:\Unreal Projects\GASShooter\Source\GASShooter\Private\Characters\Heroes\GSHeroCharacter.cpp:282]
[2021.02.09-05.56.53:923][361]LogWindows: Error: [Callstack] 0x00007ff8b006cfb8 UE4Editor-GASShooter.dll!AGSPlayerState::HealthChanged() [I:\Unreal Projects\GASShooter\Source\GASShooter\Private\Player\GSPlayerState.cpp:279]
[2021.02.09-05.56.53:924][361]LogWindows: Error: [Callstack] 0x00007ff8b0063bc0 UE4Editor-GASShooter.dll!TBaseUObjectMethodDelegateInstance<0,AGSPlayerState,void __cdecl(FOnAttributeChangeData const &),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [I:\UnrealEngine\UE_4.26\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:611]
[2021.02.09-05.56.53:925][361]LogWindows: Error: [Callstack] 0x00007ff8b097dd10 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:925][361]LogWindows: Error: [Callstack] 0x00007ff8b09ba5c8 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:926][361]LogWindows: Error: [Callstack] 0x00007ff8b09de4d7 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:931][361]LogWindows: Error: [Callstack] 0x00007ff8b0946490 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:931][361]LogWindows: Error: [Callstack] 0x00007ff8b007a12b UE4Editor-GASShooter.dll!UGSAttributeSetBase::PostGameplayEffectExecute() [I:\Unreal Projects\GASShooter\Source\GASShooter\Private\Characters\Abilities\AttributeSets\GSAttributeSetBase.cpp:131]
[2021.02.09-05.56.53:933][361]LogWindows: Error: [Callstack] 0x00007ff8b09b5a00 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:933][361]LogWindows: Error: [Callstack] 0x00007ff8b0997a52 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:934][361]LogWindows: Error: [Callstack] 0x00007ff8b091eb31 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:935][361]LogWindows: Error: [Callstack] 0x00007ff8b090737d UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:936][361]LogWindows: Error: [Callstack] 0x00007ff8b0907a20 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:937][361]LogWindows: Error: [Callstack] 0x00007ff8b097b150 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:938][361]LogWindows: Error: [Callstack] 0x00007ff8b0907cb9 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:939][361]LogWindows: Error: [Callstack] 0x00007ff8b09311c2 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:943][361]LogWindows: Error: [Callstack] 0x00007ff8b0a3a644 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:943][361]LogWindows: Error: [Callstack] 0x00007ff8d36c26a4 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:944][361]LogWindows: Error: [Callstack] 0x00007ff8d3938207 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:945][361]LogWindows: Error: [Callstack] 0x00007ff8d397d0f1 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:945][361]LogWindows: Error: [Callstack] 0x00007ff8d395238d UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:946][361]LogWindows: Error: [Callstack] 0x00007ff8d3926bfa UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:947][361]LogWindows: Error: [Callstack] 0x00007ff8d3951f84 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:948][361]LogWindows: Error: [Callstack] 0x00007ff8d395238d UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:948][361]LogWindows: Error: [Callstack] 0x00007ff8d3926bfa UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:949][361]LogWindows: Error: [Callstack] 0x00007ff8d3951f84 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:950][361]LogWindows: Error: [Callstack] 0x00007ff8d395238d UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:951][361]LogWindows: Error: [Callstack] 0x00007ff8d3926bfa UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:954][361]LogWindows: Error: [Callstack] 0x00007ff8d3951f84 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:954][361]LogWindows: Error: [Callstack] 0x00007ff8d395238d UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:955][361]LogWindows: Error: [Callstack] 0x00007ff8d3951794 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:955][361]LogWindows: Error: [Callstack] 0x00007ff8d36c26a4 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:955][361]LogWindows: Error: [Callstack] 0x00007ff8d3950ef3 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:956][361]LogWindows: Error: [Callstack] 0x00007ff8b004b46b UE4Editor-GASShooter.dll!TMulticastScriptDelegate::ProcessMulticastDelegate() [I:\UnrealEngine\UE_4.26\Engine\Source\Runtime\Core\Public\UObject\ScriptDelegates.h:488]
[2021.02.09-05.56.53:957][361]LogWindows: Error: [Callstack] 0x00007ff8b0076b7c UE4Editor-GASShooter.dll!UGSAT_ServerWaitForClientTargetData::OnTargetDataReplicatedCallback() [I:\Unreal Projects\GASShooter\Source\GASShooter\Private\Characters\Abilities\AbilityTasks\GSAT_ServerWaitForClientTargetData.cpp:39]
[2021.02.09-05.56.53:958][361]LogWindows: Error: [Callstack] 0x00007ff8b006404e UE4Editor-GASShooter.dll!TBaseUObjectMethodDelegateInstance<0,UGSAT_ServerWaitForClientTargetData,void __cdecl(FGameplayAbilityTargetDataHandle const &,FGameplayTag),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [I:\UnrealEngine\UE_4.26\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:611]
[2021.02.09-05.56.53:958][361]LogWindows: Error: [Callstack] 0x00007ff8b097dc38 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:959][361]LogWindows: Error: [Callstack] 0x00007ff8b09ddd1d UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:960][361]LogWindows: Error: [Callstack] 0x00007ff8b0a1be98 UE4Editor-GameplayAbilities.dll!UnknownFunction []
[2021.02.09-05.56.53:961][361]LogWindows: Error: [Callstack] 0x00007ff8d36c26a4 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:962][361]LogWindows: Error: [Callstack] 0x00007ff8d3950ef3 UE4Editor-CoreUObject.dll!UnknownFunction []
[2021.02.09-05.56.53:966][361]LogWindows: Error: [Callstack] 0x00007ff8cc418c65 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:966][361]LogWindows: Error: [Callstack] 0x00007ff8cc416fac UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:967][361]LogWindows: Error: [Callstack] 0x00007ff8cc3973a6 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:968][361]LogWindows: Error: [Callstack] 0x00007ff8cc39f6d9 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:969][361]LogWindows: Error: [Callstack] 0x00007ff8cc3a32bc UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:969][361]LogWindows: Error: [Callstack] 0x00007ff8cc3a27bc UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:970][361]LogWindows: Error: [Callstack] 0x00007ff8cc3a2e20 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:970][361]LogWindows: Error: [Callstack] 0x00007ff8cc920367 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:971][361]LogWindows: Error: [Callstack] 0x00007ff8cc92200d UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:972][361]LogWindows: Error: [Callstack] 0x00007ff8bd66ac60 UE4Editor-OnlineSubsystemUtils.dll!UnknownFunction []
[2021.02.09-05.56.53:972][361]LogWindows: Error: [Callstack] 0x00007ff8cc95b7a1 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:972][361]LogWindows: Error: [Callstack] 0x00007ff8cbd64260 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:974][361]LogWindows: Error: [Callstack] 0x00007ff8cc731a64 UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:977][361]LogWindows: Error: [Callstack] 0x00007ff8cc506a4f UE4Editor-Engine.dll!UnknownFunction []
[2021.02.09-05.56.53:978][361]LogWindows: Error: [Callstack] 0x00007ff6b7589bda UE4Editor.exe!UnknownFunction []
[2021.02.09-05.56.53:979][361]LogWindows: Error: [Callstack] 0x00007ff6b75a11ac UE4Editor.exe!UnknownFunction []
[2021.02.09-05.56.53:980][361]LogWindows: Error: [Callstack] 0x00007ff6b75a128a UE4Editor.exe!UnknownFunction []
[2021.02.09-05.56.53:981][361]LogWindows: Error: [Callstack] 0x00007ff6b75b52ed UE4Editor.exe!UnknownFunction []
[2021.02.09-05.56.53:982][361]LogWindows: Error: [Callstack] 0x00007ff6b75b801a UE4Editor.exe!UnknownFunction []
[2021.02.09-05.56.53:982][361]LogWindows: Error: [Callstack] 0x00007ff920787c24 KERNEL32.DLL!UnknownFunction []
[2021.02.09-05.56.53:983][361]LogWindows: Error: [Callstack] 0x00007ff921a4d4d1 ntdll.dll!UnknownFunction []
[2021.02.09-05.56.53:983][361]LogWindows: Error:
[2021.02.09-05.56.53:985][361]LogExit: Executing StaticShutdownAfterError
[2021.02.09-05.56.53:989][361]LogWindows: FPlatformMisc::RequestExit(1)
[2021.02.09-05.56.53:989][361]LogCore: Engine exit requested (reason: Win RequestExit)
[2021.02.09-05.56.53:996][361]Log file closed, 02/08/21 22:56:53

Overriding CheckCost() can lead to crashes if GetCurrentSourceObject is called during the cost check and debug is displayed.

When debug information for an ability is displayed (third category when showing AbilitySystem debug), CanActivateAbility is called, which then calls CheckCost.
This means that CheckCost gets called on the CDO, so attempting to get a reference to the source object in CheckCost will cause GetCurrentSourceObject to call GetCurrentAbilitySpec, which will not be valid for the CDO.

image
GI_GameplayAbility line 43 is where I implement override CheckCost in the same way as GASShooter.
image
I overrode via BP and used a GetCurrentSourceObject node.
image

GetCurrentAbilitySpec checks IsInstantiated, which detects that it is being called on the CDO, which leads to an assertion failure.
image
image

I may be able to solve this for my specific case by just caching the source object when the ability is instantiated instead of calling it during CheckCost.
There should probably be some sort of warning comment above UGSGameplayAbility::CheckCost override to warn people to not call GetSourceObject in their cost checking override function though.

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.