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
@@ -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();
}