Establish UE 5.8 known-good baseline with Batch 1 archaeology docs.

Initialize Git with LFS for binary assets and add standard Unreal Engine .gitignore/.gitattributes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-16 19:40:19 -07:00
co-authored by Cursor
commit ff5640a020
17216 changed files with 62362 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Copyright Trevor Edwards
using UnrealBuildTool;
using System.Collections.Generic;
public class REALMSINRUINTarget : TargetRules
{
public REALMSINRUINTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V7;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_8;
ExtraModuleNames.AddRange( new string[] { "REALMSINRUIN" } );
}
}
@@ -0,0 +1,11 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Abilities/RIRAbilitySystemComponent.h"
URIRAbilitySystemComponent::URIRAbilitySystemComponent()
{
// Initialization or settings if needed
}
@@ -0,0 +1,9 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Abilities/RIRGameplayAbility.h"
URIRGameplayAbility::URIRGameplayAbility()
{
InstancingPolicy = EGameplayAbilityInstancingPolicy::InstancedPerActor;
}
@@ -0,0 +1,36 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Actors/RIREffectActor.h"
#include "GameplayEffect.h"
#include "AbilitySystemComponent.h"
#include "AbilitySystemBlueprintLibrary.h"
// Sets default values
ARIREffectActor::ARIREffectActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SetRootComponent(CreateDefaultSubobject<USceneComponent>("SceneRoot"));
}
// Called when the game starts or when spawned
void ARIREffectActor::BeginPlay()
{
Super::BeginPlay();
}
void ARIREffectActor::ApplyEffectToTarget(AActor* TargetActor, TSubclassOf<UGameplayEffect> GamePlayEffectClass)
{
UAbilitySystemComponent* TargetAbilitySystemComponent = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(TargetActor);
if (TargetAbilitySystemComponent == nullptr) return;
check (GamePlayEffectClass);
FGameplayEffectContextHandle EffectContextHandle = TargetAbilitySystemComponent->MakeEffectContext();
EffectContextHandle.AddSourceObject(this);
const FGameplayEffectSpecHandle EffectSpecHandle = TargetAbilitySystemComponent->MakeOutgoingSpec(GamePlayEffectClass, 1.f, EffectContextHandle);
TargetAbilitySystemComponent->ApplyGameplayEffectSpecToSelf(*EffectSpecHandle.Data.Get());
}
@@ -0,0 +1,73 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Attributes/RIRAttributeSet.h"
#include "Net/UnrealNetwork.h"
#include "GameplayEffectExtension.h"
URIRAttributeSet::URIRAttributeSet()
{
// Initialize values via Attribute Accessors macro
InitHealth(75.f);
InitMaxHealth(100.f);
InitMana(25.f);
InitMaxMana(50.f);
}
// Sets up replication rules for each attribute in the class
void URIRAttributeSet::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// Each of the following macros registers an attribute for replication with:
// - COND_None: No condition for replication (always replicates)
// - REPNOTIFY_Always: Always call the corresponding OnRep_ function on the client when replicated
DOREPLIFETIME_CONDITION_NOTIFY(URIRAttributeSet, Health, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(URIRAttributeSet, MaxHealth, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(URIRAttributeSet, Mana, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(URIRAttributeSet, MaxMana, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(URIRAttributeSet, Stamina, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(URIRAttributeSet, MaxStamina, COND_None, REPNOTIFY_Always);
}
// --------- Replication Notification Functions ---------
// These functions are called automatically when the corresponding attribute is updated on clients
// due to replication. They ensure that GAS-related logic like delegates or UI updates are triggered.
// Health
void URIRAttributeSet::OnRep_Health(const FGameplayAttributeData& OldHealth) const
{
GAMEPLAYATTRIBUTE_REPNOTIFY(URIRAttributeSet, Health, OldHealth);
}
// MaxHealth
void URIRAttributeSet::OnRep_MaxHealth(const FGameplayAttributeData& OldMaxHealth) const
{
GAMEPLAYATTRIBUTE_REPNOTIFY(URIRAttributeSet, MaxHealth, OldMaxHealth);
}
// Mana
void URIRAttributeSet::OnRep_Mana(const FGameplayAttributeData& OldMana) const
{
GAMEPLAYATTRIBUTE_REPNOTIFY(URIRAttributeSet, Mana, OldMana);
}
// MaxMana
void URIRAttributeSet::OnRep_MaxMana(const FGameplayAttributeData& OldMaxMana) const
{
GAMEPLAYATTRIBUTE_REPNOTIFY(URIRAttributeSet, MaxMana, OldMaxMana);
}
// Stamina
void URIRAttributeSet::OnRep_Stamina(const FGameplayAttributeData& OldStamina) const
{
GAMEPLAYATTRIBUTE_REPNOTIFY(URIRAttributeSet, Stamina, OldStamina);
}
// MaxStamina
void URIRAttributeSet::OnRep_MaxStamina(const FGameplayAttributeData& OldMaxStamina) const
{
GAMEPLAYATTRIBUTE_REPNOTIFY(URIRAttributeSet, MaxStamina, OldMaxStamina);
}
@@ -0,0 +1,25 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Characters/RIRBaseCharacter.h"
#include "Player/RIRPlayerState.h"
#include "Abilities/RIRAbilitySystemComponent.h"
#include "Attributes/RIRAttributeSet.h"
#include "AbilitySystemComponent.h"
#include "GameFramework/Controller.h"
ARIRBaseCharacter::ARIRBaseCharacter()
{
// Optional: initialize components, set default properties, etc
}
void ARIRBaseCharacter::BeginPlay()
{
Super::BeginPlay();
// GAS Initialization moved to PossessedBy / OnRep_PlayerState
}
UAbilitySystemComponent* ARIRBaseCharacter::GetAbilitySystemComponent() const
{
ARIRPlayerState* PS = GetPlayerState<ARIRPlayerState>();
return PS ? PS->GetAbilitySystemComponent() : nullptr;
}
@@ -0,0 +1,39 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Characters/RIRBaseEnemyCharacter.h"
#include "Abilities/RIRAbilitySystemComponent.h"
#include "Attributes/RIRAttributeSet.h"
#include "REALMSINRUIN/REALMSINRUIN.h"
ARIRBaseEnemyCharacter::ARIRBaseEnemyCharacter()
{
// Optional: initialize components, set default properties, etc
GetMesh()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
// AbilitySystemComponent
AbilitySystemComponent = CreateDefaultSubobject<URIRAbilitySystemComponent>("AbilitySystemComponent");
AbilitySystemComponent->SetIsReplicated(true);
AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Minimal);
// AttributeSet
AttributeSet = CreateDefaultSubobject<URIRAttributeSet>("AttributeSet");
}
void ARIRBaseEnemyCharacter::BeginPlay()
{
Super::BeginPlay();
AbilitySystemComponent->InitAbilityActorInfo(this,this);
}
void ARIRBaseEnemyCharacter::HighlightActor()
{
GetMesh()->SetRenderCustomDepth(true);
GetMesh()->SetCustomDepthStencilValue(CUSTOM_DEPTH_RED);
}
void ARIRBaseEnemyCharacter::UnHighlightActor()
{
GetMesh()->SetRenderCustomDepth(false);
}
@@ -0,0 +1,6 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Interfaces/TargetInterface.h"
// Add default functionality here for any ITargetInterface functions that are not pure virtual.
@@ -0,0 +1,51 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Player/RIRPlayerCharacter.h"
#include "Player/RIRPlayerState.h"
#include "Abilities/RIRAbilitySystemComponent.h"
#include "Attributes/RIRAttributeSet.h"
#include "AbilitySystemComponent.h"
#include "Player/RIRPlayerController.h"
#include "UI/HUD/RIRHUD.h"
#include "UI/WidgetController/RIRWidgetController.h"
ARIRPlayerCharacter::ARIRPlayerCharacter()
{
// Removed GAS component creation — now handled by PlayerState
}
void ARIRPlayerCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
// Init ability actor info for the server
InitAbilityActorInfo();
}
void ARIRPlayerCharacter::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
// Init ability actor info for the client
InitAbilityActorInfo();
}
void ARIRPlayerCharacter::InitAbilityActorInfo()
{
ARIRPlayerState* GASPlayerState = GetPlayerState<ARIRPlayerState>();
check(GASPlayerState);
GASPlayerState->GetAbilitySystemComponent()->InitAbilityActorInfo(GASPlayerState, this);
AbilitySystemComponent = GASPlayerState->GetAbilitySystemComponent();
AttributeSet = GASPlayerState->GetAttributeSet();
if (ARIRPlayerController* RIRPlayerController = Cast<ARIRPlayerController>(GetController()))
{
if (ARIRHUD* RIRHUD = Cast<ARIRHUD>(RIRPlayerController->GetHUD()))
{
RIRHUD->InitOverlay(RIRPlayerController, GetPlayerState<ARIRPlayerState>(), AbilitySystemComponent, AttributeSet);
}
}
}
@@ -0,0 +1,164 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Player/RIRPlayerController.h"
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "GameFramework/Pawn.h"
#include "GameFramework/PlayerController.h"
#include "Interfaces/TargetInterface.h"
ARIRPlayerController::ARIRPlayerController()
{
bReplicates = true;
}
void ARIRPlayerController::PlayerTick(float DeltaTime)
{
Super::PlayerTick(DeltaTime);
CursorTrace();
}
void ARIRPlayerController::BindCallbacksToDependencies()
{
}
void ARIRPlayerController::CursorTrace()
{
// TODO: Modify this to be controller-compatible
// Additionally, create separate function to handle Gauntlet-style directional target line
// Cleanup unnecessary comments as needed
FHitResult CursorHit;
// Perform a visibility trace from the mouse cursor position
GetHitResultUnderCursor(ECC_Visibility, false, CursorHit);
// Exit early if the trace didn't hit anything
if (!CursorHit.bBlockingHit)
{
LastActor = ThisActor;
ThisActor = nullptr;
return;
}
// Cache the actor under the cursor
AActor* HitActor = CursorHit.GetActor();
// Store the previous targeted actor
LastActor = ThisActor;
// Validate that the hit actor exists and implements ITargetInterface
if (HitActor && HitActor->GetClass()->ImplementsInterface(UTargetInterface::StaticClass()))
{
// Wrap in TScriptInterface safely
ThisActor = TScriptInterface<ITargetInterface>(HitActor);
}
else
{
ThisActor = nullptr;
}
/**
* Line trace from cursor. There are several scenarios:
* A. LastActor is null && ThisActor is null
* - Do nothing
* B. LastActor is null && ThisActor is valid
* - Highlight ThisActor
* C. LastActor is valid && ThisActor is null
* - UnHighlight LastActor
* D. Both actors are valid, but LastActor != ThisActor
* - UnHighlight LastActor and Highlight ThisActor
* E. Both actors are valid, and are the same actor
* - Do nothing
*/
if (!LastActor) // LastActor is null
{
if (ThisActor)
{
// Case B: highlight newly found actor
ThisActor->HighlightActor();
}
// Case A: both are null do nothing
}
else // LastActor is valid
{
if (!ThisActor)
{
// Case C: Unhighlight the old actor, nothing to highlight now
LastActor->UnHighlightActor();
}
else if (LastActor != ThisActor)
{
// Case D: new target is different update both visuals
LastActor->UnHighlightActor();
ThisActor->HighlightActor();
}
// Case E: same actor do nothing
}
}
void ARIRPlayerController::BeginPlay()
{
Super::BeginPlay();
check(PlayerMappingContext);
// Set up Enhanced Input system for this player
UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
if (Subsystem)
{
Subsystem->AddMappingContext(PlayerMappingContext, 0); // Add the player input mapping context with priority 0 (highest)
}
// Configure the mouse cursor to be visible and use the default style
bShowMouseCursor = true;
DefaultMouseCursor = EMouseCursor::Default;
// Set input mode to allow both game and UI interaction
FInputModeGameAndUI InputModeData;
InputModeData.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock); // Don't lock mouse to viewport
InputModeData.SetHideCursorDuringCapture(false); // Don't hide the cursor when capturing input
SetInputMode(InputModeData); // Apply input mode settings to this controller
}
void ARIRPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
// Cast InputComponent to EnhancedInputComponent to access enhanced input features
UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(InputComponent);
// Bind the MoveAction input to the HandleMoveInput function when the action is triggered
EnhancedInputComponent->BindAction(MovementInput, ETriggerEvent::Triggered, this, &ARIRPlayerController::HandleMovementInput);
}
void ARIRPlayerController::HandleMovementInput(const FInputActionValue& InputActionValue)
{
if (!GetPawn())
{
return;
}
FVector2D InputVector = InputActionValue.Get<FVector2D>();
if (InputVector.IsNearlyZero())
{
return;
}
// Get the control rotation
FRotator ControlRot = GetControlRotation();
FRotator YawRot(0.f, ControlRot.Yaw, 0.f);
// Get forward and right vectors
const FVector ForwardVector = FRotationMatrix(YawRot).GetUnitAxis(EAxis::X);
const FVector RightVector = FRotationMatrix(YawRot).GetUnitAxis(EAxis::Y);
if (APawn* ControlledPlayer = GetPawn<APawn>())
{
// Apply movement input
GetPawn()->AddMovementInput(ForwardVector, InputVector.Y);
GetPawn()->AddMovementInput(RightVector, InputVector.X);
}
}
@@ -0,0 +1,24 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Player/RIRPlayerState.h"
#include "Abilities/RIRAbilitySystemComponent.h"
#include "Attributes/RIRAttributeSet.h"
ARIRPlayerState::ARIRPlayerState()
{
// AbilitySystemComponent
AbilitySystemComponent = CreateDefaultSubobject<URIRAbilitySystemComponent>("AbilitySystemComponent");
AbilitySystemComponent->SetIsReplicated(true);
AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
// AttributeSet
AttributeSet = CreateDefaultSubobject<URIRAttributeSet>("AttributeSet");
NetUpdateFrequency = 100.f;
}
UAbilitySystemComponent* ARIRPlayerState::GetAbilitySystemComponent() const
{
return AbilitySystemComponent;
}
@@ -0,0 +1,43 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "UI/HUD/RIRHUD.h"
#include "UI/Widgets/RIRUserWidget.h"
#include "UI/WidgetController/OverlayWidgetController.h"
UOverlayWidgetController* ARIRHUD::GetOverlayWidgetController(const FWidgetControllerParams& WCParams)
{
if (OverlayWidgetController == nullptr)
{
OverlayWidgetController = NewObject<UOverlayWidgetController>(this, OverlayWidgetControllerClass);
OverlayWidgetController->SetWidgetControllerParams(WCParams);
OverlayWidgetController->BindCallbacksToDependencies();
return OverlayWidgetController;
}
return OverlayWidgetController;
}
void ARIRHUD::InitOverlay(APlayerController* PC, APlayerState* PS, UAbilitySystemComponent* ASC, UAttributeSet* AS)
{
// Ensure that both the widget and its controller class are properly assigned in the editor or constructor
checkf(OverlayWidgetClass, TEXT("Overlay Widget Class uninitialized, please fill out WBP_PlayerHUD"));
checkf(OverlayWidgetControllerClass, TEXT("Overlay Widget Controller Class uninitialized, please fill out WBP_PlayerHUD"));
// Create the UMG overlay widget from the specified class
UUserWidget* Widget = CreateWidget<UUserWidget>(GetWorld(), OverlayWidgetClass);
OverlayWidget = Cast<URIRUserWidget>(Widget);
// Package the controller parameters (used to bind player data to the UI)
const FWidgetControllerParams WidgetControllerParams(PC, PS, ASC, AS);
UOverlayWidgetController* WidgetController = GetOverlayWidgetController(WidgetControllerParams);
// Assign the controller to the widget so it can bind and respond to gameplay data
OverlayWidget->SetWidgetController(WidgetController);
// Broadcast Initial Attribute values
WidgetController->BroadcastInitialInitialValues();
// Add the widget to the viewport to make it visible to the player
Widget->AddToViewport();
}
@@ -0,0 +1,69 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "UI/WidgetController/OverlayWidgetController.h"
#include "Attributes/RIRAttributeSet.h"
void UOverlayWidgetController::BroadcastInitialInitialValues()
{
const URIRAttributeSet* RIRAttributeSet = CastChecked<URIRAttributeSet>(AttributeSet);
OnHealthChanged.Broadcast(RIRAttributeSet->GetHealth());
OnMaxHealthChanged.Broadcast(RIRAttributeSet->GetMaxHealth());
OnManaChanged.Broadcast(RIRAttributeSet->GetMana());
OnMaxManaChanged.Broadcast(RIRAttributeSet->GetMaxMana());
OnStaminaChanged.Broadcast(RIRAttributeSet->GetStamina());
OnMaxStaminaChanged.Broadcast(RIRAttributeSet->GetMaxStamina());
}
void UOverlayWidgetController::BindCallbacksToDependencies()
{
const URIRAttributeSet* RIRAttributeSet = CastChecked<URIRAttributeSet>(AttributeSet);
// Register a delegate to be notified when the Health attribute changes.
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(RIRAttributeSet->GetHealthAttribute()).AddUObject(this, &UOverlayWidgetController::HealthChanged);
// Register a delegate for MaxHealth changes.
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(RIRAttributeSet->GetMaxHealthAttribute()).AddUObject(this, &UOverlayWidgetController::MaxHealthChanged);
// Register a delegate for Mana changes.
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(RIRAttributeSet->GetManaAttribute()).AddUObject(this, &UOverlayWidgetController::ManaChanged);
// Register a delegate for MaxMana changes.
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(RIRAttributeSet->GetMaxManaAttribute()).AddUObject(this, &UOverlayWidgetController::MaxManaChanged);
// Register a delegate for Stamina changes.
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(RIRAttributeSet->GetStaminaAttribute()).AddUObject(this, &UOverlayWidgetController::StaminaChanged);
// Register a delegate for MaxStamina changes.
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(RIRAttributeSet->GetMaxStaminaAttribute()).AddUObject(this, &UOverlayWidgetController::MaxStaminaChanged);
}
void UOverlayWidgetController::HealthChanged(const FOnAttributeChangeData& Data) const
{
// Broadcasts the new Health value to the UI layer.
OnHealthChanged.Broadcast(Data.NewValue);
}
void UOverlayWidgetController::MaxHealthChanged(const FOnAttributeChangeData& Data) const
{
// Broadcasts the new MaxHealth value to the UI layer.
OnMaxHealthChanged.Broadcast(Data.NewValue);
}
void UOverlayWidgetController::ManaChanged(const FOnAttributeChangeData& Data) const
{
// Broadcasts the new Mana value to the UI layer.
OnManaChanged.Broadcast(Data.NewValue);
}
void UOverlayWidgetController::MaxManaChanged(const FOnAttributeChangeData& Data) const
{
// Broadcasts the new MaxMana value to the UI layer.
OnMaxManaChanged.Broadcast(Data.NewValue);
}
void UOverlayWidgetController::StaminaChanged(const FOnAttributeChangeData& Data) const
{
// Broadcasts the new Stamina value to the UI layer.
OnStaminaChanged.Broadcast(Data.NewValue);
}
void UOverlayWidgetController::MaxStaminaChanged(const FOnAttributeChangeData& Data) const
{
// Broadcasts the new MaxStamina value to the UI layer.
OnMaxStaminaChanged.Broadcast(Data.NewValue);
}
@@ -0,0 +1,22 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "UI/WidgetController/RIRWidgetController.h"
void URIRWidgetController::SetWidgetControllerParams(const FWidgetControllerParams& WCParams)
{
PlayerController = WCParams.PlayerController;
PlayerState = WCParams.PlayerState;
AbilitySystemComponent = WCParams.AbilitySystemComponent;
AttributeSet = WCParams.AttributeSet;
}
void URIRWidgetController::BroadcastInitialInitialValues()
{
}
void URIRWidgetController::BindCallbacksToDependencies()
{
}
@@ -0,0 +1,10 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "UI/Widgets/RIRUserWidget.h"
void URIRUserWidget::SetWidgetController(UObject* InWidgetController)
{
WidgetController = InWidgetController;
WidgetControllerSet();
}
@@ -0,0 +1,16 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemComponent.h"
#include "RIRAbilitySystemComponent.generated.h"
UCLASS()
class REALMSINRUIN_API URIRAbilitySystemComponent : public UAbilitySystemComponent
{
GENERATED_BODY()
public:
URIRAbilitySystemComponent();
};
@@ -0,0 +1,25 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "Abilities/GameplayAbility.h"
#include "RIRGameplayAbility.generated.h"
/**
* Base class for all Gameplay Abilities in RIR Project
*/
UCLASS()
class REALMSINRUIN_API URIRGameplayAbility : public UGameplayAbility
{
GENERATED_BODY()
public:
URIRGameplayAbility();
protected:
// Protected interface for derived classes
};
@@ -0,0 +1,33 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "RIREffectActor.generated.h"
class UGameplayEffect;
UCLASS()
class REALMSINRUIN_API ARIREffectActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ARIREffectActor();
protected:
// Called when the game starts or the actor is spawned into the world
virtual void BeginPlay() override;
UFUNCTION(BlueprintCallable)
void ApplyEffectToTarget(AActor* TargetActor, TSubclassOf<UGameplayEffect> GamePlayEffectClass);
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Applied Effects")
TSubclassOf<UGameplayEffect> InstantGameplayEffectClass;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Applied Effects")
TSubclassOf<UGameplayEffect> DurationGameplayEffectClass;
};
@@ -0,0 +1,81 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "AttributeSet.h"
#include "AbilitySystemComponent.h"
#include "RIRAttributeSet.generated.h"
// Macro to simplify creating Attribute Accessors
#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
/**
* Custom Attribute Set for RIR Project
*/
UCLASS()
class REALMSINRUIN_API URIRAttributeSet : public UAttributeSet
{
GENERATED_BODY()
public:
URIRAttributeSet();
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
// Health
UPROPERTY(BlueprintReadOnly, Category="GAS|Attributes|Primary", ReplicatedUsing = OnRep_Health)
FGameplayAttributeData Health;
ATTRIBUTE_ACCESSORS(URIRAttributeSet, Health);
UFUNCTION()
void OnRep_Health(const FGameplayAttributeData& OldHealth) const;
// MaxHealth
UPROPERTY(BlueprintReadOnly, Category="GAS|Attributes|Primary", ReplicatedUsing = OnRep_MaxHealth)
FGameplayAttributeData MaxHealth;
ATTRIBUTE_ACCESSORS(URIRAttributeSet, MaxHealth);
UFUNCTION()
void OnRep_MaxHealth(const FGameplayAttributeData& OldMaxHealth) const;
// Mana
UPROPERTY(BlueprintReadOnly, Category="GAS|Attributes|Primary", ReplicatedUsing = OnRep_Mana)
FGameplayAttributeData Mana;
ATTRIBUTE_ACCESSORS(URIRAttributeSet, Mana);
UFUNCTION()
void OnRep_Mana(const FGameplayAttributeData& OldMana) const;
// MaxMana
UPROPERTY(BlueprintReadOnly, Category="GAS|Attributes|Primary", ReplicatedUsing = OnRep_MaxMana)
FGameplayAttributeData MaxMana;
ATTRIBUTE_ACCESSORS(URIRAttributeSet, MaxMana);
UFUNCTION()
void OnRep_MaxMana(const FGameplayAttributeData& OldMaxMana) const;
// Stamina
UPROPERTY(BlueprintReadOnly, Category="GAS|Attributes|Primary", ReplicatedUsing = OnRep_Stamina)
FGameplayAttributeData Stamina;
ATTRIBUTE_ACCESSORS(URIRAttributeSet, Stamina);
UFUNCTION()
void OnRep_Stamina(const FGameplayAttributeData& OldStamina) const;
// MaxStamina
UPROPERTY(BlueprintReadOnly, Category="GAS|Attributes|Primary", ReplicatedUsing = OnRep_MaxStamina)
FGameplayAttributeData MaxStamina;
ATTRIBUTE_ACCESSORS(URIRAttributeSet, MaxStamina);
UFUNCTION()
void OnRep_MaxStamina(const FGameplayAttributeData& OldMaxStamina) const;
protected:
};
@@ -0,0 +1,48 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemInterface.h"
#include "GameFramework/Character.h"
#include "RIRBaseCharacter.generated.h"
// Forward declarations
class URIRAbilitySystemComponent; // Custom AbilitySystemComponent
class URIRAttributeSet; // Custom AttributeSet
class UAbilitySystemComponent;
class UAttributeSet;
class UGameplayEffect;
class UGameplayAbility;
// Base Character class using GAS for RIR Project
UCLASS(ABSTRACT)
class REALMSINRUIN_API ARIRBaseCharacter : public ACharacter, public IAbilitySystemInterface
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ARIRBaseCharacter();
// Implementation of IAbilitySystemInterface
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
// Custom getter for the attribute set
UAttributeSet* GetAttributeSet() const { return AttributeSet; }
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Abilities")
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Abilities")
TObjectPtr<UAttributeSet> AttributeSet;
};
@@ -0,0 +1,26 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "Characters/RIRBaseCharacter.h"
#include "Interfaces/TargetInterface.h"
#include "RIRBaseEnemyCharacter.generated.h"
/**
*
*/
UCLASS()
class REALMSINRUIN_API ARIRBaseEnemyCharacter : public ARIRBaseCharacter, public ITargetInterface
{
GENERATED_BODY()
public:
ARIRBaseEnemyCharacter();
virtual void HighlightActor() override;
virtual void UnHighlightActor() override;
protected:
virtual void BeginPlay() override;
};
@@ -0,0 +1,27 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "TargetInterface.generated.h"
// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UTargetInterface : public UInterface
{
GENERATED_BODY()
};
/**
*
*/
class REALMSINRUIN_API ITargetInterface
{
GENERATED_BODY()
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
virtual void HighlightActor() = 0;
virtual void UnHighlightActor() = 0;
};
@@ -0,0 +1,29 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "Characters/RIRBaseCharacter.h"
#include "RIRPlayerCharacter.generated.h"
/**
*
*/
UCLASS()
class REALMSINRUIN_API ARIRPlayerCharacter : public ARIRBaseCharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ARIRPlayerCharacter();
// Called when the character is possessed by a controller (server-side only)
virtual void PossessedBy(AController* NewController) override;
// Called on the client when PlayerState is replicated
virtual void OnRep_PlayerState() override;
private:
void InitAbilityActorInfo();
};
@@ -0,0 +1,46 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "RIRPlayerController.generated.h"
class UInputAction;
class UInputMappingContext;
class ITargetInterface;
struct FInputActionValue;
UCLASS()
class REALMSINRUIN_API ARIRPlayerController : public APlayerController
{
GENERATED_BODY()
public:
ARIRPlayerController();
virtual void PlayerTick(float DeltaTime) override;
virtual void BindCallbacksToDependencies();
protected:
virtual void BeginPlay() override;
// Input bindings
virtual void SetupInputComponent() override;
// Handles movement input
void HandleMovementInput(const FInputActionValue& InputActionValue);
private:
// Input Mapping Context (to be assigned via editor)
UPROPERTY(EditAnywhere, Category = "Input")
TObjectPtr<UInputMappingContext> PlayerMappingContext;
// Input Action asset for movement (to be assigned via editor)
UPROPERTY(EditAnywhere, Category = "Input")
TObjectPtr<UInputAction> MovementInput;
// Called every frame or on-demand to perform a trace under the mouse cursor
void CursorTrace();
TScriptInterface<ITargetInterface> LastActor;
TScriptInterface<ITargetInterface> ThisActor;
};
@@ -0,0 +1,39 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerState.h"
#include "AbilitySystemInterface.h"
#include "RIRPlayerState.generated.h"
class UAbilitySystemComponent;
class UAttributeSet;
class UGameplayEffect;
class UGameplayAbility;
UCLASS()
class REALMSINRUIN_API ARIRPlayerState : public APlayerState, public IAbilitySystemInterface
{
GENERATED_BODY()
public:
ARIRPlayerState();
// Implementation of IAbilitySystemInterface
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
// Custom getter for the attribute set
UAttributeSet* GetAttributeSet() const { return AttributeSet; }
// Default attribute effect to apply on spawn
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Attributes")
TSubclassOf<UGameplayEffect> DefaultAttributesGameplayEffect;
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Abilities")
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Attributes")
TObjectPtr<UAttributeSet> AttributeSet;
};
@@ -0,0 +1,51 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "AbilitySystemComponent.h"
#include "AttributeSet.h"
#include "RIRHUD.generated.h"
class UOverlayWidgetController;
class URIRUserWidget;
struct FWidgetControllerParams;
/**
*
*/
UCLASS()
class REALMSINRUIN_API ARIRHUD : public AHUD
{
GENERATED_BODY()
public:
// Reference to the instantiated overlay widget displayed on the player's screen
UPROPERTY()
TObjectPtr<URIRUserWidget> OverlayWidget;
// Returns (or creates) the Overlay Widget Controller with the specified parameters
UOverlayWidgetController* GetOverlayWidgetController(const FWidgetControllerParams& WCParams);
// Initializes the overlay HUD with controller and gameplay-related data
void InitOverlay(APlayerController* PC, APlayerState* PS, UAbilitySystemComponent* ASC, UAttributeSet* AS);
protected:
private:
// The widget class used to instantiate the overlay (should be assigned in the editor or constructor)
UPROPERTY(EditAnywhere)
TSubclassOf<URIRUserWidget> OverlayWidgetClass;
// The instantiated controller responsible for providing data and logic to the overlay widget
UPROPERTY()
TObjectPtr<UOverlayWidgetController> OverlayWidgetController;
// The controller class to instantiate (should also be set in the editor or constructor)
UPROPERTY(EditAnywhere)
TSubclassOf<UOverlayWidgetController> OverlayWidgetControllerClass;
};
@@ -0,0 +1,56 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "UI/WidgetController/RIRWidgetController.h"
#include "OverlayWidgetController.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHealthChangedSignature, float, NewHealth);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMaxHealthChangedSignature, float, NewMaxHealth);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnManaChangedSignature, float, NewMana);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMaxManaChangedSignature, float, NewMaxMana);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnStaminaChangedSignature, float, NewStamina);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMaxStaminaChangedSignature, float, NewMaxStamina);
// Forward declaration of FOnAttributeChangeData
struct FOnAttributeChangeData;
/**
*
*/
UCLASS(BlueprintType, Blueprintable)
class REALMSINRUIN_API UOverlayWidgetController : public URIRWidgetController
{
GENERATED_BODY()
public:
virtual void BroadcastInitialInitialValues() override;
virtual void BindCallbacksToDependencies() override;
UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
FOnHealthChangedSignature OnHealthChanged;
UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
FOnMaxHealthChangedSignature OnMaxHealthChanged;
UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
FOnManaChangedSignature OnManaChanged;
UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
FOnMaxManaChangedSignature OnMaxManaChanged;
UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
FOnManaChangedSignature OnStaminaChanged;
UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
FOnMaxManaChangedSignature OnMaxStaminaChanged;
protected:
void HealthChanged(const FOnAttributeChangeData& Data) const;
void MaxHealthChanged(const FOnAttributeChangeData& Data) const;
void ManaChanged(const FOnAttributeChangeData& Data) const;
void MaxManaChanged(const FOnAttributeChangeData& Data) const;
void StaminaChanged(const FOnAttributeChangeData& Data) const;
void MaxStaminaChanged(const FOnAttributeChangeData& Data) const;
};
@@ -0,0 +1,62 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "RIRWidgetController.generated.h"
class UAttributeSet;
class UAbilitySystemComponent;
USTRUCT(BlueprintType)
struct FWidgetControllerParams
{
GENERATED_BODY()
FWidgetControllerParams() {}
FWidgetControllerParams(APlayerController* PC, APlayerState* PS, UAbilitySystemComponent* ASC, UAttributeSet* AS) : PlayerController(PC), PlayerState(PS), AbilitySystemComponent(ASC), AttributeSet(AS) {}
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<APlayerController> PlayerController = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<APlayerState> PlayerState = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UAttributeSet> AttributeSet = nullptr;
};
/**
*
*/
UCLASS()
class REALMSINRUIN_API URIRWidgetController : public UObject
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="WidgetController")
void SetWidgetControllerParams(const FWidgetControllerParams& WCParams);
virtual void BroadcastInitialInitialValues();
virtual void BindCallbacksToDependencies();
protected:
UPROPERTY(BlueprintReadOnly, Category="WidgetController")
TObjectPtr<APlayerController> PlayerController;
UPROPERTY(BlueprintReadOnly, Category="WidgetController")
TObjectPtr<APlayerState> PlayerState;
UPROPERTY(BlueprintReadOnly, Category="WidgetController")
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
UPROPERTY(BlueprintReadOnly, Category="WidgetController")
TObjectPtr<UAttributeSet> AttributeSet;
};
@@ -0,0 +1,27 @@
// Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "RIRUserWidget.generated.h"
/**
*
*/
UCLASS()
class REALMSINRUIN_API URIRUserWidget : public UUserWidget
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
void SetWidgetController(UObject* InWidgetController);
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UObject> WidgetController;
protected:
UFUNCTION(BlueprintImplementableEvent)
void WidgetControllerSet();
};
+33
View File
@@ -0,0 +1,33 @@
// Copyright Trevor Edwards
using UnrealBuildTool;
public class REALMSINRUIN : ModuleRules
{
public REALMSINRUIN(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[]
{
"Core",
"CoreUObject",
"Engine",
"InputCore",
"EnhancedInput",
"GameplayAbilities",
"GameplayTags",
"GameplayTasks"
});
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
+6
View File
@@ -0,0 +1,6 @@
// Copyright Trevor Edwards
#include "REALMSINRUIN.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, REALMSINRUIN, "REALMSINRUIN" );
+8
View File
@@ -0,0 +1,8 @@
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#define CUSTOM_DEPTH_RED 250
+16
View File
@@ -0,0 +1,16 @@
// Copyright Trevor Edwards
using UnrealBuildTool;
using System.Collections.Generic;
public class REALMSINRUINEditorTarget : TargetRules
{
public REALMSINRUINEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V7;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_8;
ExtraModuleNames.AddRange( new string[] { "REALMSINRUIN" } );
}
}