From a91d31fcdc584d09bfd3be66085df356733ba99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20Pr=C3=BChs?= Date: Sat, 19 Jun 2021 23:09:19 +0200 Subject: [PATCH 1/4] Upgrade project file to Unreal Engine 5. --- Source/RTSProject/RTSProject.uproject | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/RTSProject/RTSProject.uproject b/Source/RTSProject/RTSProject.uproject index 3b62e2b..987e58b 100644 --- a/Source/RTSProject/RTSProject.uproject +++ b/Source/RTSProject/RTSProject.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "4.26", + "EngineAssociation": "5.0EA", "Category": "", "Description": "", "Modules": [ @@ -14,6 +14,15 @@ { "Name": "DaedalicTestAutomationPlugin", "Enabled": true + }, + { + "Name": "Bridge", + "Enabled": true, + "SupportedTargetPlatforms": [ + "Win64", + "Mac", + "Linux" + ] } ] } \ No newline at end of file From 512145640365726140789739a7d36087825caa43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20Pr=C3=BChs?= Date: Sat, 19 Jun 2021 23:10:07 +0200 Subject: [PATCH 2/4] Upgrade FHitResult references to Unreal Engine 5. --- .../Private/Libraries/RTSCollisionLibrary.cpp | 4 +- .../Private/RTSPawnAIController.cpp | 12 +++--- .../Private/RTSPlayerController.cpp | 37 +++++++++++-------- .../Private/Vision/RTSVisionVolume.cpp | 2 +- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp index 58a1a62..1e203bd 100644 --- a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp +++ b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp @@ -145,9 +145,9 @@ FVector URTSCollisionLibrary::GetGroundLocation(UObject* WorldContextObject, FVe for (auto& HitResult : HitResults) { - if (HitResult.Actor != nullptr) + if (HitResult.HasValidHitObjectHandle()) { - ALandscape* Landscape = Cast(HitResult.Actor.Get()); + ALandscape* Landscape = Cast(HitResult.GetActor()); if (Landscape != nullptr) { diff --git a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPawnAIController.cpp b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPawnAIController.cpp index 14ba626..d3b348f 100644 --- a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPawnAIController.cpp +++ b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPawnAIController.cpp @@ -53,19 +53,19 @@ void ARTSPawnAIController::FindTargetInAcquisitionRadius() // Find target to acquire. for (auto& HitResult : HitResults) { - if (HitResult.Actor == nullptr) + if (!HitResult.HasValidHitObjectHandle()) { continue; } - if (HitResult.Actor == GetPawn()) + if (HitResult.GetActor() == GetPawn()) { continue; } // Check owner. auto MyActor = GetPawn(); - auto TargetActor = HitResult.Actor.Get(); + auto TargetActor = HitResult.GetActor(); if (MyActor && TargetActor) { @@ -78,15 +78,15 @@ void ARTSPawnAIController::FindTargetInAcquisitionRadius() } // Check if found attackable actor. - if (!URTSGameplayTagLibrary::HasGameplayTag(HitResult.Actor.Get(), URTSGameplayTagLibrary::Status_Permanent_CanBeAttacked())) + if (!URTSGameplayTagLibrary::HasGameplayTag(HitResult.GetActor(), URTSGameplayTagLibrary::Status_Permanent_CanBeAttacked())) { continue; } // Acquire target. - Blackboard->SetValueAsObject(TEXT("TargetActor"), HitResult.Actor.Get()); + Blackboard->SetValueAsObject(TEXT("TargetActor"), HitResult.GetActor()); - UE_LOG(LogRTS, Log, TEXT("%s automatically acquired target %s."), *GetPawn()->GetName(), *HitResult.Actor->GetName()); + UE_LOG(LogRTS, Log, TEXT("%s automatically acquired target %s."), *GetPawn()->GetName(), *HitResult.GetActor()->GetName()); return; } } diff --git a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp index a48c311..e78caca 100644 --- a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp +++ b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp @@ -532,13 +532,13 @@ void ARTSPlayerController::IssueOrderTargetingObjectsToSelectedActors(TArray IgnoredClass : DefaultOrderIgnoreTargetClasses) { - if (HitResult.Actor->IsA(IgnoredClass)) + if (HitResult.GetActor()->IsA(IgnoredClass)) { bIsIgnoredClass = true; break; @@ -554,7 +554,7 @@ void ARTSPlayerController::IssueOrderTargetingObjectsToSelectedActors(TArrayGetName()); + UE_LOG(LogRTS, Log, TEXT("Deselected actor %s."), *HitResult.GetActor()->GetName()); } - else if (!ActorsToSelect.Contains(HitResult.Actor)) + else if (!ActorsToSelect.Contains(HitResult.GetActor())) { // Select actor. - ActorsToSelect.Add(HitResult.Actor.Get()); + ActorsToSelect.Add(HitResult.GetActor()); - UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.Actor->GetName()); + UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.GetActor()->GetName()); } } else { - if (ActorsToSelect.Contains(HitResult.Actor)) + if (ActorsToSelect.Contains(HitResult.GetActor())) { continue; } // Select actor. - ActorsToSelect.Add(HitResult.Actor.Get()); + ActorsToSelect.Add(HitResult.GetActor()); - UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.Actor->GetName()); + UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.GetActor()->GetName()); } } @@ -1902,13 +1907,13 @@ void ARTSPlayerController::PlayerTick(float DeltaTime) } // Check if hit any actor. - if (HitResult.Actor == nullptr || Cast(HitResult.Actor.Get()) != nullptr) + if (!HitResult.HasValidHitObjectHandle() || Cast(HitResult.GetActor()) != nullptr) { continue; } // Check if hit selectable actor. - auto SelectableComponent = HitResult.Actor->FindComponentByClass(); + auto SelectableComponent = HitResult.GetActor()->FindComponentByClass(); if (!SelectableComponent) { @@ -1916,7 +1921,7 @@ void ARTSPlayerController::PlayerTick(float DeltaTime) } // Set hovered actor. - HoveredActor = HitResult.Actor.Get(); + HoveredActor = HitResult.GetActor(); } } diff --git a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp index 4339673..3abd73f 100644 --- a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp +++ b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp @@ -117,7 +117,7 @@ float ARTSVisionVolume::CalculateWorldHeightAtLocation(const FVector2D& WorldLoc for (auto& HitResult : HitResults) { - if (HitResult.Actor != nullptr) + if (HitResult.HasValidHitObjectHandle()) { return HitResult.Location.Z; } From 9ad85de59e264a1611f77ba5e01683032aaf693e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20Pr=C3=BChs?= Date: Sat, 19 Jun 2021 23:13:32 +0200 Subject: [PATCH 3/4] Upgrade README to Unreal Engine 5. --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 768c005..a7ed0a2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ [![license](https://img.shields.io/github/license/npruehs/ue4-rts.svg?maxAge=2592000)](https://github.com/npruehs/ue4-rts/blob/develop/LICENSE) -# Real-Time Strategy Plugin for Unreal Engine 4 +# Real-Time Strategy Plugin for Unreal Engine 5 -Open source Real-Time Strategy Plugin for Unreal Engine 4 developed by the original creators of [Hostile Worlds](http://www.indiedb.com/games/hostile-worlds/) for Unreal Engine 3. +Open source Real-Time Strategy Plugin for Unreal Engine 5 developed by the original creators of [Hostile Worlds](http://www.indiedb.com/games/hostile-worlds/) for Unreal Engine 3. -We really love the spirit of Unreal 4 moving to open-source, and we'd love to give something back. +We really love the spirit of Unreal 5 moving to open-source, and we'd love to give something back. Note that we're still in heavy development. Some things are already in place, such as @@ -40,10 +40,9 @@ For a quick look, just open `Source/RTSProject/RTSProject.uproject`, load `Maps ### Prerequisites -Real-Time Strategy Plugin for Unreal Engine 4 currently supports the following Unreal Engine Versions: +Real-Time Strategy Plugin for Unreal Engine 5 currently supports the following Unreal Engine Versions: -* 4.24 -* 4.25 +* 5.0EA ### Adding The Plugin (Blueprint Project) @@ -95,9 +94,9 @@ https://github.com/npruehs/ue4-rts/releases ## Contributing -You want to contribute to Real-Time Strategy Plugin for Unreal Engine 4? Great! Take a look at [Contributing](CONTRIBUTING.md) to get started right away! +You want to contribute to Real-Time Strategy Plugin for Unreal Engine 5? Great! Take a look at [Contributing](CONTRIBUTING.md) to get started right away! ## License -Real-Time Strategy Plugin for Unreal Engine 4 is released under the [MIT License](https://github.com/npruehs/ue4-rts/blob/develop/LICENSE). +Real-Time Strategy Plugin for Unreal Engine 5 is released under the [MIT License](https://github.com/npruehs/ue4-rts/blob/develop/LICENSE). From 9ba83ace302fb3fb06490ed4e8cfc1dd00876281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Sch=C3=B6nherr?= Date: Thu, 7 Apr 2022 20:14:17 +0200 Subject: [PATCH 4/4] Bring the latest features to the UE5 branch. Use UE5.0 instead of 5.0EA. There had been some updates to the develop branch since the last feature/ue5 commit. This commit just brings that branch up to date. And since UE5 has left Early Access, it also updates the .uproject to use the new 5.0 version. --- README.md | 14 +++---- .../Private/Libraries/RTSCollisionLibrary.cpp | 4 +- .../Private/RTSPlayerController.cpp | 37 +++++++++++-------- .../Private/Vision/RTSVisionVolume.cpp | 2 +- Source/RTSProject/RTSProject.uproject | 2 +- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 9bde06a..f395757 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ [![license](https://img.shields.io/github/license/npruehs/ue4-rts.svg?maxAge=2592000)](https://github.com/npruehs/ue4-rts/blob/develop/LICENSE) -# Real-Time Strategy Plugin for Unreal Engine 4 +# Real-Time Strategy Plugin for Unreal Engine 5 -Open source Real-Time Strategy Plugin for Unreal Engine 4 developed by the original creators of [Hostile Worlds](http://www.indiedb.com/games/hostile-worlds/) for Unreal Engine 3. +Open source Real-Time Strategy Plugin for Unreal Engine 5 developed by the original creators of [Hostile Worlds](http://www.indiedb.com/games/hostile-worlds/) for Unreal Engine 3. -We really love the spirit of Unreal 4 moving to open-source, and we'd love to give something back. +We really love the spirit of Unreal 5 moving to open-source, and we'd love to give something back. Note that we're still in heavy development. Some things are already in place, such as @@ -40,7 +40,7 @@ For a quick look, just open `Source/RTSProject/RTSProject.uproject`, load `Maps ### Prerequisites -Real-Time Strategy Plugin for Unreal Engine 4 provides plugin content which is usually not backwards-compatible: Content saved with a newer engine version cannot be opened again with an older engine version. Thus, every time a feature or bugfix requires a plugin content update, the plugin does not support older engine versions anymore. The following table summarizes plugin compatibility with engine versions: +Real-Time Strategy Plugin for Unreal Engine 5 provides plugin content which is usually not backwards-compatible: Content saved with a newer engine version cannot be opened again with an older engine version. Thus, every time a feature or bugfix requires a plugin content update, the plugin does not support older engine versions anymore. The following table summarizes plugin compatibility with engine versions: | Plugin Version | Supported Engine Versions | | -------------- | ------------------------- | @@ -48,7 +48,7 @@ Real-Time Strategy Plugin for Unreal Engine 4 provides plugin content which is u | 1.1.0 | 4.25 | | 1.2.0 | 4.25 | | Git (master) | 4.27 | -| Git (feature/ue5) | 5.0EA | +| Git (feature/ue5) | 5.0 | ### Adding The Plugin (Blueprint Project) @@ -100,9 +100,9 @@ https://github.com/npruehs/ue4-rts/releases ## Contributing -You want to contribute to Real-Time Strategy Plugin for Unreal Engine 4? Great! Take a look at [Contributing](CONTRIBUTING.md) to get started right away! +You want to contribute to Real-Time Strategy Plugin for Unreal Engine 5? Great! Take a look at [Contributing](CONTRIBUTING.md) to get started right away! ## License -Real-Time Strategy Plugin for Unreal Engine 4 is released under the [MIT License](https://github.com/npruehs/ue4-rts/blob/develop/LICENSE). +Real-Time Strategy Plugin for Unreal Engine 5 is released under the [MIT License](https://github.com/npruehs/ue4-rts/blob/develop/LICENSE). diff --git a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp index 2d4ee23..460dfad 100644 --- a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp +++ b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Libraries/RTSCollisionLibrary.cpp @@ -155,9 +155,9 @@ FVector URTSCollisionLibrary::GetGroundLocation(UObject* WorldContextObject, FVe for (auto& HitResult : HitResults) { - if (HitResult.Actor != nullptr) + if (HitResult.HasValidHitObjectHandle()) { - ALandscape* Landscape = Cast(HitResult.Actor.Get()); + ALandscape* Landscape = Cast(HitResult.GetActor()); if (Landscape != nullptr) { diff --git a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp index 55faacd..7211ab5 100644 --- a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp +++ b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/RTSPlayerController.cpp @@ -534,13 +534,13 @@ void ARTSPlayerController::IssueOrderTargetingObjectsToSelectedActors(TArray IgnoredClass : DefaultOrderIgnoreTargetClasses) { - if (HitResult.Actor->IsA(IgnoredClass)) + if (HitResult.GetActor()->IsA(IgnoredClass)) { bIsIgnoredClass = true; break; @@ -556,7 +556,7 @@ void ARTSPlayerController::IssueOrderTargetingObjectsToSelectedActors(TArrayGetName()); + UE_LOG(LogRTS, Log, TEXT("Deselected actor %s."), *HitResult.GetActor()->GetName()); } - else if (!ActorsToSelect.Contains(HitResult.Actor)) + else if (!ActorsToSelect.Contains(HitResult.GetActor())) { // Select actor. - ActorsToSelect.Add(HitResult.Actor.Get()); + ActorsToSelect.Add(HitResult.GetActor()); - UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.Actor->GetName()); + UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.GetActor()->GetName()); } } else { - if (ActorsToSelect.Contains(HitResult.Actor)) + if (ActorsToSelect.Contains(HitResult.GetActor())) { continue; } // Select actor. - ActorsToSelect.Add(HitResult.Actor.Get()); + ActorsToSelect.Add(HitResult.GetActor()); - UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.Actor->GetName()); + UE_LOG(LogRTS, Log, TEXT("Selected actor %s."), *HitResult.GetActor()->GetName()); } } @@ -1909,13 +1914,13 @@ void ARTSPlayerController::PlayerTick(float DeltaTime) } // Check if hit any actor. - if (HitResult.Actor == nullptr || Cast(HitResult.Actor.Get()) != nullptr) + if (HitResult.GetActor() == nullptr || Cast(HitResult.GetActor()) != nullptr) { continue; } // Check if hit selectable actor. - auto SelectableComponent = HitResult.Actor->FindComponentByClass(); + auto SelectableComponent = HitResult.GetActor()->FindComponentByClass(); if (!SelectableComponent) { @@ -1923,7 +1928,7 @@ void ARTSPlayerController::PlayerTick(float DeltaTime) } // Set hovered actor. - HoveredActor = HitResult.Actor.Get(); + HoveredActor = HitResult.GetActor(); } } diff --git a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp index 4339673..3abd73f 100644 --- a/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp +++ b/Source/RTSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionVolume.cpp @@ -117,7 +117,7 @@ float ARTSVisionVolume::CalculateWorldHeightAtLocation(const FVector2D& WorldLoc for (auto& HitResult : HitResults) { - if (HitResult.Actor != nullptr) + if (HitResult.HasValidHitObjectHandle()) { return HitResult.Location.Z; } diff --git a/Source/RTSProject/RTSProject.uproject b/Source/RTSProject/RTSProject.uproject index f27278a..46dbafb 100644 --- a/Source/RTSProject/RTSProject.uproject +++ b/Source/RTSProject/RTSProject.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "4.27", + "EngineAssociation": "5.0", "Category": "", "Description": "", "Modules": [