Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ue5 #202

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -40,15 +40,15 @@ 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 |
| -------------- | ------------------------- |
| 1.0.0 | 4.24, 4.25 |
| 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)

Expand Down Expand Up @@ -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).
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ FVector URTSCollisionLibrary::GetGroundLocation(UObject* WorldContextObject, FVe

for (auto& HitResult : HitResults)
{
if (HitResult.Actor != nullptr)
if (HitResult.HasValidHitObjectHandle())
{
ALandscape* Landscape = Cast<ALandscape>(HitResult.Actor.Get());
ALandscape* Landscape = Cast<ALandscape>(HitResult.GetActor());

if (Landscape != nullptr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,13 @@ void ARTSPlayerController::IssueOrderTargetingObjectsToSelectedActors(TArray<FHi
// Try all default orders.
for (auto& HitResult : HitResults)
{
if (HitResult.Actor != nullptr)
if (HitResult.HasValidHitObjectHandle())
{
bool bIsIgnoredClass = false;

for (TSubclassOf<AActor> IgnoredClass : DefaultOrderIgnoreTargetClasses)
{
if (HitResult.Actor->IsA(IgnoredClass))
if (HitResult.GetActor()->IsA(IgnoredClass))
{
bIsIgnoredClass = true;
break;
Expand All @@ -556,7 +556,7 @@ void ARTSPlayerController::IssueOrderTargetingObjectsToSelectedActors(TArray<FHi
{
FRTSOrderData Order;
Order.OrderClass = OrderClass;
Order.TargetActor = HitResult.Actor.Get();
Order.TargetActor = HitResult.GetActor();
Order.TargetLocation = HitResult.Location;

if (IssueOrderToSelectedActors(Order))
Expand Down Expand Up @@ -1312,44 +1312,49 @@ void ARTSPlayerController::FinishSelectActors()
ActorsToSelect = SelectedActors;
}

for (auto& HitResult : HitResults)
for (auto& HitResult : HitResults)
{

if (!HitResult.HasValidHitObjectHandle())
{
if (!IsSelectableActor(HitResult.Actor.Get()))
continue;
}
if (!IsSelectableActor(HitResult.GetActor()))
{
continue;
}

// Check how to apply selection.
if (bToggleSelectionHotkeyPressed)
{
if (SelectedActors.Contains(HitResult.Actor))
if (SelectedActors.Contains(HitResult.GetActor()))
{
// Deselect actor.
ActorsToSelect.Remove(HitResult.Actor.Get());
ActorsToSelect.Remove(HitResult.GetActor());

UE_LOG(LogRTS, Log, TEXT("Deselected actor %s."), *HitResult.Actor->GetName());
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());
}
}
}

SelectActors(ActorsToSelect, ERTSSelectionCameraFocusMode::SELECTIONFOCUS_DoNothing);

Expand Down Expand Up @@ -1909,21 +1914,21 @@ void ARTSPlayerController::PlayerTick(float DeltaTime)
}

// Check if hit any actor.
if (HitResult.Actor == nullptr || Cast<ALandscape>(HitResult.Actor.Get()) != nullptr)
if (!HitResult.HasValidHitObjectHandle() || Cast<ALandscape>(HitResult.GetActor()) != nullptr)
{
continue;
}

// Check if hit selectable actor.
auto SelectableComponent = HitResult.Actor->FindComponentByClass<URTSSelectableComponent>();
auto SelectableComponent = HitResult.GetActor()->FindComponentByClass<URTSSelectableComponent>();

if (!SelectableComponent)
{
continue;
}

// Set hovered actor.
HoveredActor = HitResult.Actor.Get();
HoveredActor = HitResult.GetActor();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 10 additions & 1 deletion Source/RTSProject/RTSProject.uproject
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "4.27",
"EngineAssociation": "5.0",
"Category": "",
"Description": "",
"Modules": [
Expand All @@ -14,6 +14,15 @@
{
"Name": "DaedalicTestAutomationPlugin",
"Enabled": true
},
{
"Name": "Bridge",
"Enabled": true,
"SupportedTargetPlatforms": [
"Win64",
"Mac",
"Linux"
]
}
]
}