Skip to content

Commit

Permalink
version1.6.10
Browse files Browse the repository at this point in the history
  • Loading branch information
shun126 committed Oct 4, 2024
1 parent 5aee011 commit f72d936
Show file tree
Hide file tree
Showing 27 changed files with 83 additions and 92 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Change Log - Procedural 3D Dungeon Generator Plug-in

## Unreleased-1.6.* (38)
## Unreleased-1.6.* (40)
### Changes
### 変更点

## 20241005-1.6.10 (39)
### Changes
* Fixed several bugs
### 変更点
* いくつかの不具合を修正

## 20240927-1.6.9 (38)
### Changes
* Fixed a bug when sublevels were not specified
Expand Down
4 changes: 2 additions & 2 deletions DungeonGenerator.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 38,
"VersionName": "1.6.9",
"Version": 39,
"VersionName": "1.6.10",
"FriendlyName": "Procedural Dungeon Generator",
"Description": "Procedural dungeon generator plugin. Easy generation of levels, mini-maps and missions.",
"Category": "Procedural",
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ Or, [Unreal Engine marketplace](https://www.unrealengine.com/marketplace/slug/36
# 👾 Demo
[DungeonGenerator Demo](https://github.com/shun126/UE5-DungeonGeneratorDemo) is a BluePrint sample project for first-person exploration.

![DungeonGeneratorDemo Screenshot](https://github.com/shun126/UE5-DungeonGeneratorDemo/raw/main/Document/Screenshot.gif)

This is an easy to use. Simply drop the DungeonGenerateActor into your level, set the grid scale and number of rooms and start generating out your structures. Please read the [Wiki](https://github.com/shun126/UE5-DungeonGeneratorDemo/wiki) for more information.

# 👀 See also
Expand Down
4 changes: 2 additions & 2 deletions Source/DungeonGenerator/Private/Core/GenerateParameter.inl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace dungeon

inline bool GenerateParameter::UseMissionGraph() const noexcept
{
return mUseMissionGraph == true && mAisleComplexity <= 0;
return GetAisleComplexity() <= 0;
}

inline void GenerateParameter::SetMissionGraph(const bool use) noexcept
Expand All @@ -200,7 +200,7 @@ namespace dungeon

inline bool GenerateParameter::IsAisleComplexity() const noexcept
{
return mUseMissionGraph == false && mAisleComplexity > 0;
return GetAisleComplexity() > 0;
}

inline bool GenerateParameter::IsGenerateSlopeInRoom() const noexcept
Expand Down
11 changes: 9 additions & 2 deletions Source/DungeonGenerator/Private/Core/Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,14 @@ namespace dungeon
const auto limit = std::sin(math::ToRadian(11.25));
direction.Z = std::max(-limit, std::min(direction.Z, limit));
}
const bool normalizeResult = direction.Normalize();
check(normalizeResult);
if (direction.Normalize() == false)
{
const double ratio = mGenerateParameter.GetRandom()->Get<double>();
const double radian = ratio * math::Pi2();
direction.X = std::cos(radian);
direction.Y = std::sin(radian);
direction.Z = 0;
}

// 押し出す
FVector newRoomOffset;
Expand Down Expand Up @@ -934,6 +940,7 @@ namespace dungeon
);
#endif

// HACK: MinimumSpanningTreeクラスにまとめた方が良いかも
for (const std::shared_ptr<Room>& room : mRooms)
{
if (room->GetParts() == Room::Parts::Unidentified /* && room->GetGateCount() > 1 */)
Expand Down
6 changes: 2 additions & 4 deletions Source/DungeonGenerator/Private/DungeonActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ All Rights Reserved.
#include <numeric>
#include <unordered_map>

#include "Core/Math/Math.h"

#if WITH_EDITOR
// UnrealEd
#include <EditorActorFolders.h>
Expand Down Expand Up @@ -369,7 +367,7 @@ bool ADungeonActor::Create(const UDungeonGenerateParameter* parameter, const boo
generateParameter.SetMinRoomHeight(mParameter->RoomHeight.Min);
generateParameter.SetMaxRoomHeight(mParameter->RoomHeight.Max);
generateParameter.SetMergeRooms(mParameter->MergeRooms);
generateParameter.SetMissionGraph(mParameter->EnableMissionGraph());
generateParameter.SetMissionGraph(mParameter->IsUseMissionGraph());
generateParameter.SetAisleComplexity(mParameter->GetAisleComplexity());
generateParameter.SetGenerateSlopeInRoom(mParameter->GenerateSlopeInRoom);
if (mParameter->MergeRooms)
Expand Down Expand Up @@ -1275,7 +1273,7 @@ void ADungeonActor::MovePlayerStart(const TArray<APlayerStart*>& startPoints)
rootComponent->CalcBoundingCylinder(cylinderRadius, cylinderHalfHeight);

// If there are multiple APlayerStart, shift APlayerStart from the center of the room
FVector location = GetActorLocation() + GetStartLocation();
FVector location = GetStartLocation();
location.X += placementRadius * std::cos(placementAngle * static_cast<double>(index));
location.Y += placementRadius * std::sin(placementAngle * static_cast<double>(index));

Expand Down
6 changes: 1 addition & 5 deletions Source/DungeonGenerator/Private/DungeonGenerateActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ ADungeonGenerateActor::ADungeonGenerateActor(const FObjectInitializer& initializ
{
// Tick Enable
PrimaryActorTick.bCanEverTick = PrimaryActorTick.bStartWithTickEnabled = true;

// Create default parameters
DungeonGenerateParameter = NewObject<UDungeonGenerateParameter>(this, TEXT("DungeonGenerateParameter"));
check(DungeonGenerateParameter);
}

void ADungeonGenerateActor::OnPreDungeonGeneration()
Expand Down Expand Up @@ -316,7 +312,7 @@ void ADungeonGenerateActor::PreInitializeComponents()
// Calling the parent class
Super::PreInitializeComponents();

if (AutoGenerateAtStart)
if (AutoGenerateAtStart == true)
{
PreGenerateImplementation();
}
Expand Down
4 changes: 2 additions & 2 deletions Source/DungeonGenerator/Public/DungeonActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ namespace dungeon
}

/**
ダンジョン内の植生アクター
ダンジョン生成アクター
*/
UCLASS()
UCLASS(Abstract)
class DUNGEONGENERATOR_API ADungeonActor : public AActor
{
GENERATED_BODY()
Expand Down
2 changes: 1 addition & 1 deletion Source/DungeonGenerator/Public/DungeonBlueprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ADungeonRoomSensorBase;
BluePrint function library
ダンジョン生成ブループリント関数
*/
UCLASS(Blueprintable)
UCLASS()
class UDungeonBlueprint : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
Expand Down
6 changes: 3 additions & 3 deletions Source/DungeonGenerator/Public/DungeonGenerateActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum class EDungeonMeshGenerationMethod : uint8
Dungeon generation actor
ダンジョン生成アクター
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API ADungeonGenerateActor : public ADungeonActor
{
GENERATED_BODY()
Expand Down Expand Up @@ -165,8 +165,8 @@ class DUNGEONGENERATOR_API ADungeonGenerateActor : public ADungeonActor
#endif

/**
PlayerStart is automatically moved to the start room at the start
開始時にPlayerStartを自動的にスタート部屋に移動します
Generates a dungeon at the start of the level
レベル開始時にダンジョンを生成します
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator")
bool AutoGenerateAtStart = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UBoxComponent;
Helper class that loads the level when the player enters the OverlapVolume
プレイヤーが OverlapVolume に入るときにレベルをロードするヘルパークラス
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API ADungeonLevelStreamingActor : public AActor
{
GENERATED_BODY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ OnPartiationInactivate is called when the DungeonPartiation moves away.
所属しているDungeonPartiationがプレイヤー周辺に近づいたらOnPartiationActivateが呼ばれます。
離れたらOnPartiationInactivateが呼ばれます。
*/
UCLASS(Blueprintable, BlueprintType, meta = (BlueprintSpawnableComponent))
UCLASS(meta = (BlueprintSpawnableComponent))
class DUNGEONGENERATOR_API UDungeonComponentActivatorComponent : public UActorComponent
{
GENERATED_BODY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All Rights Reserved.
Database of dungeon aisle mesh sets
ダンジョン通路のメッシュセットのデータベース
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API UDungeonAisleMeshSetDatabase : public UDungeonMeshSetDatabase
{
GENERATED_BODY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum class EFrequencyOfGeneration : uint8
Dungeon generation parameter
ダンジョン生成パラメータ
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject
{
GENERATED_BODY()
Expand All @@ -61,7 +61,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject
bool IsMergeRooms() const noexcept;
bool IsMovePlayerStartToStartingPoint() const noexcept;

bool EnableMissionGraph() const noexcept;
bool IsUseMissionGraph() const noexcept;
uint8 GetAisleComplexity() const noexcept;
bool IsAisleComplexity() const noexcept;

Expand Down Expand Up @@ -255,9 +255,9 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject
bool Flat = false;

/**
Move PlayerStart to the starting point.
PlayerStart is automatically moved to the start room at the start
有効にするとPlayerStartをスタート部屋に移動します
開始時にPlayerStartを自動的にスタート部屋に移動します
*/
UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite)
bool MovePlayerStartToStartingPoint = true;
Expand All @@ -283,7 +283,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject
uint8 AisleComplexity = 5;

/**
Generate ramps in the room.
Generate slopes in the room.
May be enabled by future forcing.
部屋の中にスロープを生成する
Expand Down Expand Up @@ -458,9 +458,9 @@ inline bool UDungeonGenerateParameter::IsMovePlayerStartToStartingPoint() const
return MovePlayerStartToStartingPoint;
}

inline bool UDungeonGenerateParameter::EnableMissionGraph() const noexcept
inline bool UDungeonGenerateParameter::IsUseMissionGraph() const noexcept
{
return UseMissionGraph;
return GetAisleComplexity() <= 0;
}

inline uint8 UDungeonGenerateParameter::GetAisleComplexity() const noexcept
Expand All @@ -470,7 +470,7 @@ inline uint8 UDungeonGenerateParameter::GetAisleComplexity() const noexcept

inline bool UDungeonGenerateParameter::IsAisleComplexity() const noexcept
{
return UseMissionGraph == false && AisleComplexity > 0;
return GetAisleComplexity() > 0;
}

inline EFrequencyOfGeneration UDungeonGenerateParameter::GetFrequencyOfTorchlightGeneration() const noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace dungeon
Database of dungeon mesh sets
ダンジョンのメッシュセットのデータベース
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API UDungeonMeshSetDatabase : public UObject
{
GENERATED_BODY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All Rights Reserved.
Database of dungeon room mesh sets
ダンジョン部屋のメッシュセットのデータベース
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API UDungeonRoomMeshSetDatabase : public UDungeonMeshSetDatabase
{
GENERATED_BODY()
Expand Down
2 changes: 1 addition & 1 deletion Source/DungeonGenerator/Public/SubActor/DungeonActorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ All Rights Reserved.
Verifiable Actor Class
検証可能なアクタークラス
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API ADungeonActorBase : public AActor
{
GENERATED_BODY()
Expand Down
2 changes: 1 addition & 1 deletion Source/DungeonGenerator/Public/SubActor/DungeonDoorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Please be very careful with server-client synchronization.
DungeonDoorBaseはレプリケーションする前提のアクターです。
サーバーとクライアントの同期に十分注意して下さい。
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API ADungeonDoorBase : public ADungeonActorBase
{
GENERATED_BODY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Please be very careful with server-client synchronization.
DungeonRoomSensorBaseはレプリケーションされない前提のアクターです。
サーバーとクライアントの同期に十分注意して下さい。
*/
UCLASS(Blueprintable, BlueprintType)
UCLASS()
class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonActorBase
{
GENERATED_BODY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ FDungeonAisleMeshSetDatabaseTypeActions::FDungeonAisleMeshSetDatabaseTypeActions
{
}

FColor FDungeonAisleMeshSetDatabaseTypeActions::GetTypeColor() const
{
return FColor::Cyan;
}

void FDungeonAisleMeshSetDatabaseTypeActions::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
{
FSimpleAssetEditor::CreateEditor(EToolkitMode::Standalone, EditWithinLevelEditor, InObjects);
}

FText FDungeonAisleMeshSetDatabaseTypeActions::GetName() const
{
return FText::FromName(TEXT("Mesh set database (Aisle)"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ UDungeonGenerateParameterTypeActions::UDungeonGenerateParameterTypeActions(EAsse
{
}

FColor UDungeonGenerateParameterTypeActions::GetTypeColor() const
{
return FColor::Emerald;
}

void UDungeonGenerateParameterTypeActions::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
{
FSimpleAssetEditor::CreateEditor(EToolkitMode::Standalone, EditWithinLevelEditor, InObjects);
}

FText UDungeonGenerateParameterTypeActions::GetName() const
{
return FText::FromName(TEXT("Generate parameter"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ FDungeonRoomMeshSetDatabaseTypeActions::FDungeonRoomMeshSetDatabaseTypeActions(E
{
}

FColor FDungeonRoomMeshSetDatabaseTypeActions::GetTypeColor() const
{
return FColor::Cyan;
}

void FDungeonRoomMeshSetDatabaseTypeActions::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
{
FSimpleAssetEditor::CreateEditor(EToolkitMode::Standalone, EditWithinLevelEditor, InObjects);
}

FText FDungeonRoomMeshSetDatabaseTypeActions::GetName() const
{
return FText::FromName(TEXT("Mesh set database (Room)"));
Expand Down
31 changes: 31 additions & 0 deletions Source/DungeonGeneratorEditor/Public/DungeonAssetTypeActionsBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
@author Shun Moriya
@copyright 2024- Shun Moriya
All Rights Reserved.
*/

#pragma once
#include <CoreMinimal.h>
#include <AssetTypeActions_Base.h>

class FDungeonAssetTypeActionsBase : public FAssetTypeActions_Base
{
public:
// Constructor
explicit FDungeonAssetTypeActionsBase() = default;

// Destructor
virtual ~FDungeonAssetTypeActionsBase() override = default;

// FAssetTypeActions_Base overrides
virtual FColor GetTypeColor() const override
{
static constexpr FColor Color(156, 156, 56);
return Color;
}

virtual void OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor) override
{
FSimpleAssetEditor::CreateEditor(EToolkitMode::Standalone, EditWithinLevelEditor, InObjects);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class FDungeonGeneratorStyle final

private:
static TSharedPtr< class FSlateStyleSet > StyleInstance;
};
};
Loading

0 comments on commit f72d936

Please sign in to comment.