Skip to content

Commit fba4f9c

Browse files
authored
Merge pull request #81 from Well-known-Game-Studio/feature/emonds-field
Refactor of Input / Interaction System and Major Updates to Maps
2 parents 5d0155d + bfa75c5 commit fba4f9c

File tree

246 files changed

+219
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+219
-76
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@
2222
[submodule "unreal/Plugins/BlockoutToolsPlugin"]
2323
path = unreal/Plugins/BlockoutToolsPlugin
2424
url = [email protected]:well-known-game-studio/blockouttoolsplugin
25+
[submodule "unreal/Content/UltraDynamicSky"]
26+
path = unreal/Content/UltraDynamicSky
27+
url = [email protected]:well-known-game-studio/ultra-dynamic-sky

unreal/Config/DefaultEditor.ini

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ bBlueprintIsNotBlueprintType= true
99

1010
[/Script/AdvancedPreviewScene.SharedProfiles]
1111

12+
[/Script/UnrealEd.EditorPerformanceProjectSettings]
13+
NonRealtimeScreenPercentageMode=BasedOnDisplayResolution
14+

unreal/Config/DefaultEngine.ini

+4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ r.DynamicGlobalIlluminationMethod=1
2727
r.ReflectionMethod=1
2828
r.Shadow.Virtual.Enable=1
2929
r.CustomDepth=3
30+
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
31+
r.DefaultFeature.AutoExposure=True
32+
r.DefaultFeature.AutoExposure.Method=0
3033

3134
[/Script/Engine.Engine]
3235
+ActiveGameNameRedirects=(OldGameName="TP_ThirdPersonBP",NewGameName="/Script/VoxelRPG")
3336
+ActiveGameNameRedirects=(OldGameName="/Script/TP_ThirdPersonBP",NewGameName="/Script/VoxelRPG")
37+
GameViewportClientClassName=/Script/CommonUI.CommonGameViewportClient
3438

3539
[/Script/Engine.CollisionProfile]
3640
-Profiles=(Name="NoCollision",CollisionEnabled=NoCollision,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="No collision",bCanModify=False)

unreal/Config/DefaultGame.ini

+14
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,17 @@ bShouldAcquireMissingChunksOnLoad=False
2222
bShouldWarnAboutInvalidAssets=True
2323
MetaDataTagsForAssetRegistry=()
2424

25+
[/Script/CommonInput.CommonInputSettings]
26+
InputData=/Game/Wot/UI/CommonUI/WotInputData.WotInputData_C
27+
28+
[CommonInputPlatformSettings_Mac CommonInputPlatformSettings]
29+
DefaultInputType=MouseAndKeyboard
30+
bSupportsMouseAndKeyboard=True
31+
bSupportsTouch=False
32+
bSupportsGamepad=True
33+
DefaultGamepadName=Generic
34+
bCanChangeGamepadType=True
35+
+ControllerData=/Game/Wot/UI/CommonUI/Platform/Input/KeyboardMouse/CommonInput_KeyboardMouse.CommonInput_KeyboardMouse_C
36+
+ControllerData=/Game/Wot/UI/CommonUI/Platform/Input/GamepadPS5/CommonInput_Gamepad_Generic.CommonInput_Gamepad_Generic_C
37+
+ControllerData=/Game/Wot/UI/CommonUI/Platform/Input/GamepadPS4/CommonInput_Gamepad_PS4.CommonInput_Gamepad_PS4_C
38+

unreal/Config/DefaultInput.ini

+6
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,9 @@ DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.Defaul
159159
-ConsoleKeys=Tilde
160160
+ConsoleKeys=Tilde
161161

162+
[/Script/CommonUI.CommonUIInputSettings]
163+
bLinkCursorToGamepadFocus=True
164+
UIActionProcessingPriority=10000
165+
+InputActions=(ActionTag=None,DefaultDisplayName="",KeyMappings=)
166+
AnalogCursorSettings=(PreprocessorPriority=2,bEnableCursorAcceleration=True,CursorAcceleration=1500.000000,CursorMaxSpeed=2200.000000,CursorDeadZone=0.250000,HoverSlowdownFactor=0.400000,ScrollDeadZone=0.200000,ScrollUpdatePeriod=0.100000,ScrollMultiplier=2.500000)
167+

unreal/Content/UltraDynamicSky

Submodule UltraDynamicSky added at d17b6bb
-31 Bytes
Binary file not shown.
79 Bytes
Binary file not shown.
68.7 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4.79 KB
Binary file not shown.
73.8 KB
Binary file not shown.
-255 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
346 Bytes
Binary file not shown.
Binary file not shown.
4.14 KB
Binary file not shown.
-370 Bytes
Binary file not shown.
4.79 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
95.6 KB
Binary file not shown.

unreal/Source/VoxelRPG/Private/UI/WotUWHealthBar.cpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ void UWotUWHealthBar::UpdateHealth(float Interpolation)
5252

5353
void UWotUWHealthBar::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
5454
{
55-
Super::NativeTick(MyGeometry, InDeltaTime);
56-
57-
if (!AttachTo.IsValid()) {
58-
return;
59-
}
6055
// Use the duration as the interpolation
6156
TimeRemaining = std::max(TimeRemaining - InDeltaTime, 0.0f);
6257
float Interpolation = 0;
@@ -65,7 +60,5 @@ void UWotUWHealthBar::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
6560
}
6661
// Lerp the Health
6762
UpdateHealth(Interpolation);
68-
// now draw it in the right place (based on location of AttachTo actor)
69-
FVector Location = AttachTo->GetActorLocation() + Offset;
70-
SetPosition(Location);
63+
Super::NativeTick(MyGeometry, InDeltaTime);
7164
}

unreal/Source/VoxelRPG/Private/UI/WotUWPopup.cpp

-30
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
#include "Kismet/GameplayStatics.h"
44
#include "Blueprint/WidgetLayoutLibrary.h"
55

6-
void UWotUWPopup::NativeConstruct()
7-
{
8-
Super::NativeConstruct();
9-
}
10-
11-
void UWotUWPopup::SetAttachTo(AActor* NewAttachTo)
12-
{
13-
AttachTo = NewAttachTo;
14-
UpdatePosition();
15-
}
16-
176
void UWotUWPopup::SetText(const FText& NewText)
187
{
198
TextWidget->SetText(NewText);
@@ -34,22 +23,3 @@ void UWotUWPopup::PlayPopupAnimation()
3423
PlayAnimation(PopupAnim, StartAtTime, NumLoops, PlayMode, PlaybackSpeed);
3524
}
3625
}
37-
38-
void UWotUWPopup::UpdatePosition()
39-
{
40-
if (AttachTo.IsValid()) {
41-
// now draw it in the right place (based on location of AttachTo actor)
42-
FVector Location = AttachTo->GetActorLocation();
43-
// apply the offset if it's set
44-
if (Offset != FVector::ZeroVector) {
45-
Location += Offset;
46-
}
47-
UWotUserWidget::SetPosition(Location);
48-
}
49-
}
50-
51-
void UWotUWPopup::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
52-
{
53-
UpdatePosition();
54-
Super::NativeTick(MyGeometry, InDeltaTime);
55-
}

unreal/Source/VoxelRPG/Private/UI/WotUserWidget.cpp

+18-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
#include "Kismet/GameplayStatics.h"
33
#include "Blueprint/WidgetLayoutLibrary.h"
44

5-
void UWotUserWidget::NativeConstruct()
5+
void UWotUserWidget::SetAttachTo(AActor* NewAttachTo)
66
{
7-
Super::NativeConstruct();
8-
9-
// bind delegates, and set up default appearance
7+
AttachTo = NewAttachTo;
8+
UpdatePosition();
109
}
1110

1211
void UWotUserWidget::SetOffset(const FVector& NewOffset)
@@ -37,3 +36,18 @@ void UWotUserWidget::Remove_TimeElapsed()
3736
{
3837
RemoveFromParent();
3938
}
39+
40+
void UWotUserWidget::UpdatePosition()
41+
{
42+
if (AttachTo.IsValid()) {
43+
// now draw it in the right place (based on location of AttachTo actor)
44+
FVector Location = AttachTo->GetActorLocation() + Offset;
45+
SetPosition(Location);
46+
}
47+
}
48+
49+
void UWotUserWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
50+
{
51+
UpdatePosition();
52+
Super::NativeTick(MyGeometry, InDeltaTime);
53+
}

unreal/Source/VoxelRPG/Private/WotAction.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "WotAction.h"
22
#include "WotActionComponent.h"
3+
#include "GameFramework/Pawn.h"
4+
#include "GameFramework/PawnMovementComponent.h"
35

46
UWotAction::UWotAction()
57
{
@@ -20,6 +22,16 @@ bool UWotAction::CanStart_Implementation(AActor* Instigator)
2022
if (!Comp->ActiveGameplayTags.HasAll(RequiredTags)) {
2123
return false;
2224
}
25+
26+
// check if the instigator is falling
27+
if (!bAllowedWhileFalling) {
28+
// cast the actor to a pawn
29+
APawn* Pawn = Cast<APawn>(Instigator);
30+
if (Pawn && Pawn->GetMovementComponent()->IsFalling()) {
31+
return false;
32+
}
33+
}
34+
2335
return true;
2436
}
2537

unreal/Source/VoxelRPG/Private/WotCharacter.cpp

+35-11
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void AWotCharacter::PrimaryAttack()
141141
EquippedWeapon->PrimaryAttackStart();
142142
} else {
143143
UE_LOG(LogTemp, Log, TEXT("No weapon equipped starting action 'PrimaryAttack'"));
144-
ActionComp->StartActionByName(this, "PrimaryAttack");
144+
ActionStart("PrimaryAttack");
145145
}
146146
}
147147

@@ -417,11 +417,32 @@ void AWotCharacter::ShowPopupWidgetAttachedTo(const FText& Text, float Duration,
417417
}
418418
}
419419

420-
void AWotCharacter::ShowActionTextWidget(FString Text, float Duration)
420+
void AWotCharacter::ShowInteractionWidget(const FText& Text, float Duration, bool Animated)
421421
{
422-
if (ActionTextWidgetClass) {
423-
UUserWidget* ActionTextWidget = CreateWidget<UUserWidget>(GetWorld(), ActionTextWidgetClass);
424-
ActionTextWidget->AddToViewport();
422+
if (InteractionWidgetClass) {
423+
UWotUWPopup* InteractionWidget = CreateWidget<UWotUWPopup>(GetWorld(), InteractionWidgetClass);
424+
InteractionWidget->SetDuration(Duration);
425+
InteractionWidget->SetText(Text);
426+
InteractionWidget->SetAttachTo(this);
427+
if (Animated) {
428+
InteractionWidget->PlayPopupAnimation();
429+
}
430+
InteractionWidget->AddToViewport();
431+
}
432+
}
433+
434+
void AWotCharacter::ShowInteractionWidgetAttachedTo(const FText& Text, float Duration, AActor* Actor, const FVector& Offset, bool Animated)
435+
{
436+
if (InteractionWidgetClass) {
437+
UWotUWPopup* InteractionWidget = CreateWidget<UWotUWPopup>(GetWorld(), InteractionWidgetClass);
438+
InteractionWidget->SetDuration(Duration);
439+
InteractionWidget->SetText(Text);
440+
InteractionWidget->SetOffset(Offset);
441+
InteractionWidget->SetAttachTo(Actor);
442+
if (Animated) {
443+
InteractionWidget->PlayPopupAnimation();
444+
}
445+
InteractionWidget->AddToViewport();
425446
}
426447
}
427448

@@ -456,13 +477,16 @@ void AWotCharacter::InteractionCheck_TimeElapsed()
456477
// we only got an actor, so use the actor
457478
IWotInteractableInterface::Execute_GetInteractionText(ClosestInteractable, this, HitResult, InteractionText);
458479
}
480+
// if the text is empty, don't show the widget
481+
if (InteractionText.IsEmpty()) {
482+
return;
483+
}
459484
// show the action text widget
460-
// ShowActionTextWidget(InteractionText.ToString(), InteractionCheckPeriod);
461-
ShowPopupWidgetAttachedTo(FText::FromString(InteractionText.ToString()),
462-
InteractionCheckPeriod*1.1f,
463-
ClosestInteractable,
464-
Offset,
465-
false);
485+
ShowInteractionWidgetAttachedTo(FText::FromString(InteractionText.ToString()),
486+
InteractionCheckPeriod*1.1f,
487+
ClosestInteractable,
488+
Offset,
489+
false);
466490
// Use the highlight interface if it can be used
467491
if (ClosestInteractionComp) {
468492
if (ClosestInteractionComp->Implements<UWotGameplayInterface>()) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "WotGameInstance.h"
2+
3+
void UWotGameInstance::SaveTimeOfDay_Implementation()
4+
{
5+
// Let the subclasses implement this
6+
}
7+
8+
void UWotGameInstance::LoadTimeOfDay_Implementation()
9+
{
10+
// Let the subclasses implement this
11+
}
12+
13+
bool UWotGameInstance::IsDaytime_Implementation()
14+
{
15+
// Let the subclasses implement this
16+
return false;
17+
}

unreal/Source/VoxelRPG/Private/WotGameModeBase.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,41 @@ void AWotGameModeBase::StartPlay()
2323
// Continuous timer to spawn more bots. Actual amount of bots and whether it
2424
// is allowed to spawn determined by logic later in the chain...
2525
GetWorldTimerManager().SetTimer(TimerHandle_SpawnBots, this, &AWotGameModeBase::SpawnBotTimerElapsed, SpawnTimerInterval, true, SpawnTimerInitialDelay);
26+
27+
LoadTime();
28+
}
29+
30+
void AWotGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
31+
{
32+
Super::EndPlay(EndPlayReason);
33+
34+
switch (EndPlayReason) {
35+
case EEndPlayReason::LevelTransition:
36+
SaveTime();
37+
break;
38+
case EEndPlayReason::Destroyed:
39+
case EEndPlayReason::EndPlayInEditor:
40+
case EEndPlayReason::RemovedFromWorld:
41+
case EEndPlayReason::Quit:
42+
default:
43+
break;
44+
}
45+
}
46+
47+
void AWotGameModeBase::SaveTime_Implementation()
48+
{
49+
UWotGameInstance* GameInstance = Cast<UWotGameInstance>(GetGameInstance());
50+
if (GameInstance) {
51+
GameInstance->SaveTimeOfDay();
52+
}
53+
}
54+
55+
void AWotGameModeBase::LoadTime_Implementation()
56+
{
57+
UWotGameInstance* GameInstance = Cast<UWotGameInstance>(GetGameInstance());
58+
if (GameInstance) {
59+
GameInstance->LoadTimeOfDay();
60+
}
2661
}
2762

2863
AActor* AWotGameModeBase::FindPlayerStart_Implementation(AController* Player, const FString& IncomingName)

unreal/Source/VoxelRPG/Public/UI/WotUWHealthBar.h

-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ class VOXELRPG_API UWotUWHealthBar : public UWotUserWidget
1313
GENERATED_BODY()
1414

1515
public:
16-
void SetAttachTo(AActor* InAttachTo) { AttachTo = InAttachTo; }
17-
1816
UFUNCTION(BlueprintCallable)
1917
void SetHealth(float NewHealthStart, float NewHealthEnd, float HealthMax);
2018

@@ -33,8 +31,6 @@ class VOXELRPG_API UWotUWHealthBar : public UWotUserWidget
3331

3432
void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
3533

36-
TWeakObjectPtr<AActor> AttachTo;
37-
3834
UPROPERTY( meta = ( BindWidget ) )
3935
UWotProgressBar* HealthBar;
4036

unreal/Source/VoxelRPG/Public/UI/WotUWPopup.h

-13
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ class VOXELRPG_API UWotUWPopup : public UWotUserWidget
1212
GENERATED_BODY()
1313

1414
public:
15-
UFUNCTION(BlueprintCallable)
16-
void SetAttachTo(AActor* InAttachTo);
17-
1815
UFUNCTION(BlueprintCallable)
1916
void SetText(const FText& NexText);
2017

@@ -25,16 +22,6 @@ class VOXELRPG_API UWotUWPopup : public UWotUserWidget
2522
void PlayPopupAnimation();
2623

2724
protected:
28-
// Doing setup in the C++ constructor is not as
29-
// useful as using NativeConstruct.
30-
void NativeConstruct() override;
31-
32-
void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
33-
34-
void UpdatePosition();
35-
36-
TWeakObjectPtr<AActor> AttachTo;
37-
3825
UPROPERTY( Transient, meta = ( BindWidgetAnimOptional ) )
3926
UWidgetAnimation* PopupAnim;
4027

unreal/Source/VoxelRPG/Public/UI/WotUserWidget.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class VOXELRPG_API UWotUserWidget : public UUserWidget
1313
GENERATED_BODY()
1414

1515
public:
16+
UFUNCTION(BlueprintCallable)
17+
void SetAttachTo(AActor* InAttachTo);
1618

1719
UFUNCTION(BlueprintCallable)
1820
virtual void SetDuration(float NewDuration);
@@ -21,19 +23,21 @@ class VOXELRPG_API UWotUserWidget : public UUserWidget
2123
virtual void SetOffset(const FVector& NewOffset);
2224

2325
protected:
24-
// Doing setup in the C++ constructor is not as
25-
// useful as using NativeConstruct.
26-
virtual void NativeConstruct() override;
27-
2826
UFUNCTION(BlueprintCallable)
2927
virtual void SetPosition(const FVector& NewPosition);
3028

29+
virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
30+
31+
void UpdatePosition();
32+
3133
UPROPERTY( EditAnywhere, BlueprintReadWrite )
3234
float Duration{0.0f};
3335

3436
UPROPERTY( EditAnywhere, BlueprintReadWrite )
3537
FVector Offset = FVector(0, 0, 0.0f);
3638

39+
TWeakObjectPtr<AActor> AttachTo;
40+
3741
UPROPERTY()
3842
FTimerHandle TimerHandle_Remove;
3943
UFUNCTION()

unreal/Source/VoxelRPG/Public/WotAction.h

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class VOXELRPG_API UWotAction : public UObject
2020
UFUNCTION(BlueprintCallable, Category = "Action")
2121
UWotActionComponent* GetOwningComponent() const;
2222

23+
UPROPERTY(EditDefaultsOnly, Category = "Tags")
24+
bool bAllowedWhileFalling = false;
25+
2326
UPROPERTY(EditDefaultsOnly, Category = "Tags")
2427
FGameplayTagContainer GrantsTags;
2528

0 commit comments

Comments
 (0)