Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
v0.6.5a (#38)
Browse files Browse the repository at this point in the history
* Change WriteAchievement to IngestStats + Set Abilities to receive an audio data structure + Set some metasounds sources to shared sources in game content

* Adjust ambience sound

* Remove MetaSounds requirements from modular plugins + Disable CPU read access in static mesh
  • Loading branch information
lucoiso authored Nov 15, 2022
1 parent f4f5bdc commit f36989e
Show file tree
Hide file tree
Showing 31 changed files with 77 additions and 82 deletions.
3 changes: 2 additions & 1 deletion Config/DefaultGame.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ProjectDebugTitleInfo=NSLOCTEXT("[/Script/EngineSettings]", "BE87C6DA4FF84CEDD63
ProjectDisplayedTitle=NSLOCTEXT("[/Script/EngineSettings]", "63DFDD624C6C2FDA67C19598742EFFE9", "Project Elementus:")
SupportContact[email protected]
CopyrightNotice=
ProjectVersion=0.6.4a
ProjectVersion=0.6.5a
CompanyName=Lucas Vilas-Boas
CompanyDistinguishedName=Lucoiso
Description=Project Elementus is a third person template that can be used to start projects that will use some new features that came with Unreal Engine 5 as well as powerful existing features like the Gameplay Ability System and others.
Expand Down Expand Up @@ -135,4 +135,5 @@ AbilityBindingMode=InputID
+AllowedConfigFiles=ProjectElementus/Config/Tags/GameplayData.ini
+AllowedConfigFiles=ProjectElementus/Config/Tags/GameplayEffects.ini
+AllowedConfigFiles=ProjectElementus/Config/Tags/GameplayStates.ini
+AllowedConfigFiles=ProjectElementus/Config/DefaultMetaSound.ini

6 changes: 1 addition & 5 deletions Config/DefaultMetaSound.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[/Script/MetasoundEngine.MetaSoundSettings]
bAutoUpdateEnabled=True
bAutoUpdateLogWarningOnDroppedConnection=True
+DirectoriesToRegister=(Path="/Game/Main/Sounds/Lyra/Ambience")
+DirectoriesToRegister=(Path="/Game/Main/Sounds/Lyra/Footsteps")
+DirectoriesToRegister=(Path="/Game/Main/Sounds/Lyra/Shared")
+DirectoriesToRegister=(Path="/DefaultAbilities/Sounds")
+DirectoriesToRegister=(Path="/Swinging/Sounds")
+DirectoriesToRegister=(Path="/Telekinesis/Sounds")
+DirectoriesToRegister=(Path="/Game/Main/Sounds/Lyra/Shared/MetaSounds")

4 changes: 2 additions & 2 deletions Content/Main/Blueprints/Widgets/EOS/WB_EOS_Testing.uasset
Git LFS file not shown
4 changes: 2 additions & 2 deletions Content/Main/Maps/Main/MP_Main_Persistent.umap
Git LFS file not shown
4 changes: 2 additions & 2 deletions Content/Main/Maps/Main/Sub-Levels/MP_Main_Blueprints.umap
Git LFS file not shown
2 changes: 1 addition & 1 deletion Content/Main/Maps/Main/Sub-Levels/MP_Main_Meshes.umap
Git LFS file not shown
4 changes: 2 additions & 2 deletions Content/Main/Maps/Main/Sub-Levels/MP_Main_RenderFX.umap
Git LFS file not shown
4 changes: 2 additions & 2 deletions Content/Main/Meshes/LevelPrototyping/SM_ChamferCube.uasset
Git LFS file not shown
3 changes: 0 additions & 3 deletions Content/Main/Sounds/Lyra/Ambience/MS_Ambience.uasset

This file was deleted.

4 changes: 2 additions & 2 deletions Content/Main/Sounds/Lyra/Footsteps/MS_Footsteps.uasset
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ void UPEHookAbility::WaitConfirmInput_Callback_Implementation()
{
// If the confirm input is pressed, will add a impulse to ability owner
// and to the target/grabbed actor, if simulates physics

if (ACharacter* const Player = Cast<ACharacter>(GetAvatarActorFromActorInfo()))
{
PlayAbilitySoundAttached(Player->GetMesh());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
"Name": "GameplayAbilities",
"Enabled": true
},
{
"Name": "Metasound",
"Enabled": true
},
{
"Name": "ModularFeatures_ExtraActions",
"Enabled": true,
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
"Name": "GameplayAbilities",
"Enabled": true
},
{
"Name": "Metasound",
"Enabled": true
},
{
"Name": "ModularFeatures_ExtraActions",
"Enabled": true,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
"Name": "GameplayAbilities",
"Enabled": true
},
{
"Name": "Metasound",
"Enabled": true
},
{
"Name": "ModularFeatures_ExtraActions",
"Enabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void UPEDoubleJumpAbility::ActivateAbility(const FGameplayAbilitySpecHandle Hand
Params.Location = VFXLocation;
ActivateGameplayCues(FGameplayTag::RequestGameplayTag("GameplayCue.Default.DoubleJump"), Params, ActorInfo->AbilitySystemComponent.Get());

PlayAbilitySoundAtLocation(ActorInfo->AvatarActor.Get(), VFXLocation, 0.3f);
PlayAbilitySoundAtLocation(ActorInfo->AvatarActor.Get(), VFXLocation);

Player->LaunchCharacter(FVector(0.f, 0.f, AbilityMaxRange), false, true);
}
Expand Down
12 changes: 6 additions & 6 deletions Source/ProjectElementus/Private/GAS/System/PEGameplayAbility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ void UPEGameplayAbility::RemoveCooldownEffect(UAbilitySystemComponent* SourceAbi
}
}

void UPEGameplayAbility::PlayAbilitySoundAttached(USceneComponent* InComponent, const FName SocketToAttach, const FVector& InLocation, const float InVolumeMultiplier)
void UPEGameplayAbility::PlayAbilitySoundAttached(USceneComponent* InComponent, const FName SocketToAttach, const FVector& InLocation)
{
if (!IsValid(AbilitySoundFX))
if (!IsValid(AbilitySoundData.AbilitySoundFX))
{
ABILITY_VLOG(this, Error, TEXT("Tried to play ability %s sound with a null sound object."), *GetName());
return;
Expand All @@ -496,18 +496,18 @@ void UPEGameplayAbility::PlayAbilitySoundAttached(USceneComponent* InComponent,
return;
}

UGameplayStatics::SpawnSoundAttached(AbilitySoundFX, InComponent, SocketToAttach, InLocation, EAttachLocation::KeepRelativeOffset, false, InVolumeMultiplier);
UGameplayStatics::SpawnSoundAttached(AbilitySoundData.AbilitySoundFX, InComponent, SocketToAttach, InLocation, EAttachLocation::KeepRelativeOffset, false, AbilitySoundData.VolumeMultiplier, AbilitySoundData.PitchMultiplier, AbilitySoundData.StartTime);
}

void UPEGameplayAbility::PlayAbilitySoundAtLocation(const UObject* WorldContext, const FVector& InLocation, const float InVolumeMultiplier)
void UPEGameplayAbility::PlayAbilitySoundAtLocation(const UObject* WorldContext, const FVector& InLocation)
{
if (!IsValid(AbilitySoundFX))
if (!IsValid(AbilitySoundData.AbilitySoundFX))
{
ABILITY_VLOG(this, Error, TEXT("Tried to play ability %s sound with a null sound object."), *GetName());
return;
}

UGameplayStatics::SpawnSoundAtLocation(WorldContext, AbilitySoundFX, InLocation, FRotator::ZeroRotator, InVolumeMultiplier);
UGameplayStatics::SpawnSoundAtLocation(WorldContext, AbilitySoundData.AbilitySoundFX, InLocation, FRotator::ZeroRotator, AbilitySoundData.VolumeMultiplier, AbilitySoundData.PitchMultiplier, AbilitySoundData.StartTime);
}

void UPEGameplayAbility::ActivateWaitMontageTask(const FName MontageSection, const float Rate, const bool bRandomSection, const bool bStopsWhenAbilityEnds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "Management/Functions/PEEOSLibrary.h"
#include "EOSVoiceChatUser.h"
#include "Interfaces/OnlineAchievementsInterface.h"
#include "Interfaces/OnlineStatsInterface.h"
#include "Interfaces/OnlineIdentityInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
#include "Interfaces/OnlineSessionInterface.h"
Expand Down Expand Up @@ -144,43 +144,38 @@ void UPEEOSLibrary::UpdateEOSPresence(const int32 LocalUserNum, const FString& P
}
}

void UPEEOSLibrary::WriteEOSAchievement(const int32 LocalUserNum, const EAchievementMod Modifier, const FName StatName, const float Percentage)
void UPEEOSLibrary::IngestEOSStats(const int32 LocalUserNum, const TMap<FName, int32> StatsMap)
{
if (const IOnlineSubsystem* const OnlineSubsystem = FOnlineSubsystemEOS::Get(EOS_SUBSYSTEM))
{
if (const IOnlineIdentityPtr IdentityInterface = OnlineSubsystem->GetIdentityInterface())
{
if (const IOnlineAchievementsPtr AchievementsInterface = OnlineSubsystem->GetAchievementsInterface())
if (const IOnlineStatsPtr StatsInterface = OnlineSubsystem->GetStatsInterface())
{
UE_LOG(LogTemp, Log, TEXT("%s - Local User Num: %d; Modifier: %d; Stat Name: %s; Percentage: %f"), *FString(__func__), LocalUserNum, Modifier, *StatName.ToString(), Percentage);
const FUniqueNetIdRef UserNetIdRef = IdentityInterface->GetUniquePlayerId(LocalUserNum).ToSharedRef();

FOnlineStatsUserUpdatedStats UpdatedStats = FOnlineStatsUserUpdatedStats(UserNetIdRef);

const FOnlineAchievementsWritePtr NewAchievement = MakeShareable(new FOnlineAchievementsWrite());

switch (Modifier)
for (const auto& [StatName, StatValue] : StatsMap)
{
case EAchievementMod::Set: NewAchievement->SetFloatStat(StatName, Percentage);
break;

case EAchievementMod::Add: NewAchievement->IncrementFloatStat(StatName, Percentage);
break;

case EAchievementMod::Subtract: NewAchievement->DecrementFloatStat(StatName, Percentage);
break;

default: break;
if (StatName.IsNone())
{
continue;
}

UE_LOG(LogTemp, Log, TEXT("%s - Local User Num: %d; Stat Name: %s; Value: %d"), *FString(__func__), LocalUserNum, *StatName.ToString(), StatValue);

const FOnlineStatUpdate StatUpdate(StatValue, FOnlineStatUpdate::EOnlineStatModificationType::Unknown);
UpdatedStats.Stats.Add(StatName.ToString(), StatUpdate);
}

FOnlineAchievementsWriteRef WriteObject = NewAchievement.ToSharedRef();

const FUniqueNetIdPtr UserNetId = IdentityInterface->GetUniquePlayerId(LocalUserNum);

const FOnAchievementsWrittenDelegate AchievementsWriteDelegate = FOnAchievementsWrittenDelegate::CreateLambda([](const FUniqueNetId& UserID, const bool bResult)
const FOnlineStatsUpdateStatsComplete UpdateStatsDelegate = FOnlineStatsUpdateStatsComplete::CreateLambda([UserNetIdRef](const FOnlineError& ResultState)
{
UE_LOG(LogTemp, Log, TEXT("WriteEOSAchievement - User ID: %s; Result: %d"), *UserID.ToString(), bResult);
UE_LOG(LogTemp, Log, TEXT("IngestEOSStat - User ID: %s; Result: %s"), *UserNetIdRef->ToString(), *ResultState.ToLogString());
});

AchievementsInterface->WriteAchievements(*UserNetId, WriteObject, AchievementsWriteDelegate);
StatsInterface->UpdateStats(UserNetIdRef, { UpdatedStats }, UpdateStatsDelegate);
}
}
}
}
}
27 changes: 24 additions & 3 deletions Source/ProjectElementus/Public/GAS/System/PEGameplayAbility.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ class AGameplayAbilityTargetActor_Trace;
class AGameplayAbilityTargetActor;
class APEProjectileActor;
struct FPETargetActorSpawnParams;

USTRUCT(BlueprintType, Category = "Project Elementus | Structures")
struct FPEAudioData
{
GENERATED_USTRUCT_BODY()

FPEAudioData() = default;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Project Elementus | Properties")
TObjectPtr<USoundBase> AbilitySoundFX;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Project Elementus | Properties")
float VolumeMultiplier = 1.f;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Project Elementus | Properties")
float PitchMultiplier = 1.f;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Project Elementus | Properties")
float StartTime = 0.f;
};

/**
*
*/
Expand Down Expand Up @@ -54,7 +75,7 @@ class PROJECTELEMENTUS_API UPEGameplayAbility : public UGameplayAbility
FGameplayTagContainer SetByCallerCooldownTags;

UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Project Elementus | Properties")
TObjectPtr<USoundBase> AbilitySoundFX;
FPEAudioData AbilitySoundData;

/* Mix with bEndAbilityAfterActiveTime to end ability with a pre-determined time */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Project Elementus | Properties")
Expand Down Expand Up @@ -262,10 +283,10 @@ class PROJECTELEMENTUS_API UPEGameplayAbility : public UGameplayAbility
void RemoveCooldownEffect(UAbilitySystemComponent* SourceAbilitySystem) const;

UFUNCTION(BlueprintCallable, Category = "Project Elementus | Functions")
void PlayAbilitySoundAttached(USceneComponent* InComponent, const FName SocketToAttach = NAME_None, const FVector& InLocation = FVector::ZeroVector, const float InVolumeMultiplier = 1.f);
void PlayAbilitySoundAttached(USceneComponent* InComponent, const FName SocketToAttach = NAME_None, const FVector& InLocation = FVector::ZeroVector);

UFUNCTION(BlueprintCallable, Category = "Project Elementus | Functions")
void PlayAbilitySoundAtLocation(const UObject* WorldContext, const FVector& InLocation = FVector::ZeroVector, const float InVolumeMultiplier = 1.f);
void PlayAbilitySoundAtLocation(const UObject* WorldContext, const FVector& InLocation = FVector::ZeroVector);

/* Shared Timer Handle that is actually used with bEndAbilityAfterActiveTime */
FTimerHandle CancelationTimerHandle;
Expand Down
14 changes: 3 additions & 11 deletions Source/ProjectElementus/Public/Management/Functions/PEEOSLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ struct FSessionSettingsHandler
FOnlineSessionSettings Settings;
};

UENUM(BlueprintType, Category = "Project Elementus | Enumerations")
enum class EAchievementMod : uint8
{
Set,
Add,
Subtract
};

UCLASS(Category = "Project Elementus | Classes")
class PROJECTELEMENTUS_API UPEEOSLibrary final : public UBlueprintFunctionLibrary
{
Expand Down Expand Up @@ -89,7 +81,7 @@ class PROJECTELEMENTUS_API UPEEOSLibrary final : public UBlueprintFunctionLibrar
UFUNCTION(BlueprintCallable, Category = "Project Elementus | Functions", meta = (DisplayName = "Update EOS Presence"))
static void UpdateEOSPresence(const int32 LocalUserNum, const FString& PresenceText, const bool bOnline);

/* Modify the status of a achievement */
UFUNCTION(BlueprintCallable, Category = "Project Elementus | Functions", meta = (DisplayName = "Write EOS Achievement"))
static void WriteEOSAchievement(const int32 LocalUserNum, const EAchievementMod Modifier, const FName StatName, const float Percentage = 1.f);
/* Modify an EOS stat */
UFUNCTION(BlueprintCallable, Category = "Project Elementus | Functions", meta = (DisplayName = "Ingest EOS Stats"))
static void IngestEOSStats(const int32 LocalUserNum, const TMap<FName, int32> StatsMap);
};

0 comments on commit f36989e

Please sign in to comment.