Skip to content

Commit

Permalink
version 1.6.12
Browse files Browse the repository at this point in the history
  • Loading branch information
shun126 committed Oct 27, 2024
1 parent 81b3c73 commit 4824b3c
Show file tree
Hide file tree
Showing 19 changed files with 329 additions and 283 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Change Log - Procedural 3D Dungeon Generator Plug-in

## Unreleased-1.6.* (41)
## Unreleased-1.6.* (42)
### Changes
### 変更点

## 20241027-1.6.12 (41)
### Changes
* Deprecated DungeonAisleMeshSetDatabase and DungeonRoomMeshSetDatabase, and introduced DungeonMeshDatabase.
* Fixed an issue where rooms could exceed the maximum size.
* Resolved an issue where sublevels were not unloading properly.
* Fixed activation of main level partitioning during multiplayer
* Fixed several bugs
### 変更点
* DungeonAisleMeshSetDatabaseとDungeonRoomMeshSetDatabaseを非推奨にしてDungeonMeshDatabaseを新設しました
* 部屋が最大サイズよりも大きくなる問題を修正
* サブレベルが解放されない問題を修正
* マルチプレイヤー時のメインレベルのパーティエーションの有効化を修正
* いくつかの不具合を修正

## 20241017-1.6.11 (40)
Expand Down
6 changes: 3 additions & 3 deletions DungeonGenerator.uplugin
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"FileVersion": 3,
"Version": 40,
"VersionName": "1.6.11",
"Version": 41,
"VersionName": "1.6.12",
"FriendlyName": "Procedural Dungeon Generator",
"Description": "Procedural dungeon generator plugin. Easy generation of levels, mini-maps and missions.",
"Description": "Procedural 3d dungeon generator plugin. Easy generation of levels, mini-maps and missions.",
"Category": "Procedural",
"CreatedBy": "Narcis Software",
"CreatedByURL": "https://github.com/shun126/UE5-DungeonGeneratorDemo",
Expand Down
21 changes: 18 additions & 3 deletions Source/DungeonGenerator/Private/Core/Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ namespace dungeon
// 部屋のパーツ(役割)をリセットする
// TODO:MinimumSpanningTreeで統合できそう
room->SetParts(Room::Parts::Unidentified);
room->SetReservationNumber(0);
room->ResetReservationNumber();

// Room::GetGroundCenterリストを作成
// cppcheck-suppress [useStlAlgorithm]
Expand Down Expand Up @@ -1080,13 +1080,28 @@ namespace dungeon
if (room->GetParts() == Room::Parts::Goal && mGenerateParameter.IsGenerateGoalRoomReserved())
continue;

uint32_t width = room->GetWidth();
uint32_t depth = room->GetDepth();
// 部屋の最大サイズにあわせる
uint32_t width = room->GetWidth();
if (width > mGenerateParameter.GetMaxRoomWidth())
{
width = mGenerateParameter.GetMaxRoomWidth();
room->SetWidth(width);
}

uint32_t depth = room->GetDepth();
if (depth > mGenerateParameter.GetMaxRoomDepth())
{
depth = mGenerateParameter.GetMaxRoomDepth();
room->SetDepth(depth);
}

uint32_t height = room->GetHeight();
if (height > mGenerateParameter.GetMaxRoomHeight())
{
height = mGenerateParameter.GetMaxRoomHeight();
room->SetHeight(height);
}

// ドアに対して部屋が小さい場合は広げる
const uint32_t minimumArea = dungeon::math::Square<uint32_t>(room->GetGateCount());
const uint32_t requiredArea = std::max(2u, minimumArea);
Expand Down
1 change: 1 addition & 0 deletions Source/DungeonGenerator/Private/Core/RoomGeneration/Room.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ namespace dungeon
bool IsValidReservationNumber() const noexcept;
uint32_t GetReservationNumber() const noexcept;
void SetReservationNumber(const uint32_t reservationNumber) noexcept;
void ResetReservationNumber() noexcept;


private:
Expand Down
5 changes: 5 additions & 0 deletions Source/DungeonGenerator/Private/Core/RoomGeneration/Room.inl
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,9 @@ namespace dungeon
{
mReservationNumber = reservationNumber;
}

inline void Room::ResetReservationNumber() noexcept
{
SetReservationNumber(0);
}
}
69 changes: 33 additions & 36 deletions Source/DungeonGenerator/Private/DungeonGenerateActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ void ADungeonGenerateActor::PostInitializeComponents()
// Calling the parent class
Super::PostInitializeComponents();

if (GetNetMode() != NM_Standalone)
//if (GetNetMode() != NM_Standalone)
if (GetLocalRole() == ROLE_Authority)
{
SetReplicates(true);
SetAutonomousProxy(true);
Expand All @@ -82,14 +83,6 @@ void ADungeonGenerateActor::BeginPlay()
#endif
}

void ADungeonGenerateActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
DestroyImplementation();

// Calling the parent class
Super::EndPlay(EndPlayReason);
}

void ADungeonGenerateActor::Tick(float DeltaSeconds)
{
// Calling the parent class
Expand Down Expand Up @@ -230,8 +223,6 @@ void ADungeonGenerateActor::SetInstancedMeshCullDistance(const double cullDistan
/********** 生成と破棄 **********/
void ADungeonGenerateActor::PreGenerateImplementation()
{
DestroyImplementation();

if (!IsValid(DungeonGenerateParameter))
{
DUNGEON_GENERATOR_ERROR(TEXT("DungeonGenerateParameter is not set"));
Expand All @@ -248,6 +239,8 @@ void ADungeonGenerateActor::PreGenerateImplementation()
DUNGEON_GENERATOR_ERROR(TEXT("The actor's scale is not applied in the generated dungeon."));
}

Dispose(true);

if (DungeonMeshGenerationMethod != EDungeonMeshGenerationMethod::StaticMesh)
{
// StaticMeshを先に登録
Expand Down Expand Up @@ -305,35 +298,35 @@ void ADungeonGenerateActor::PreGenerateImplementation()
);
}

if (Create(DungeonGenerateParameter, HasAuthority()))
{
if (DungeonMeshGenerationMethod != EDungeonMeshGenerationMethod::StaticMesh)
CommitAddInstance();

/*
List of PlayerStart, not including PlayerStartPIE.
PlayerStartの一覧。PlayerStartPIEは含まない。
*/
TArray<APlayerStart*> playerStart;
CollectPlayerStartExceptPlayerStartPIE(playerStart);
MovePlayerStart(playerStart);

// スタート部屋とゴール部屋の位置を記録
StartRoomLocation = GetStartLocation();
GoalRoomLocation = GetGoalLocation();

// 成功を通知
OnGenerationSuccess.Broadcast();
}
else
if (Create(DungeonGenerateParameter, HasAuthority()) == false)
{
DUNGEON_GENERATOR_ERROR(TEXT("Failed to generate dungeon. Seed(%d)"), DungeonGenerateParameter->GetRandomSeed());
DestroyImplementation();

// 失敗を通知
OnGenerationFailure.Broadcast();

Dispose(false);
return;
}

if (DungeonMeshGenerationMethod != EDungeonMeshGenerationMethod::StaticMesh)
CommitAddInstance();

/*
List of PlayerStart, not including PlayerStartPIE.
PlayerStartの一覧。PlayerStartPIEは含まない。
*/
TArray<APlayerStart*> playerStart;
CollectPlayerStartExceptPlayerStartPIE(playerStart);
MovePlayerStart(playerStart);

// スタート部屋とゴール部屋の位置を記録
StartRoomLocation = GetStartLocation();
GoalRoomLocation = GetGoalLocation();

// 成功を通知
OnGenerationSuccess.Broadcast();

#if WITH_EDITOR
// Record dungeon-generated random numbers
GeneratedRandomSeed = DungeonGenerateParameter->GetGeneratedRandomSeed();
Expand Down Expand Up @@ -365,10 +358,14 @@ void ADungeonGenerateActor::PreGenerateImplementation()
#endif
}

void ADungeonGenerateActor::DestroyImplementation()
void ADungeonGenerateActor::Dispose(const bool flushStreamLevels)
{
ClearInstancedMeshComponents();
if (IsCreated())
{
ClearInstancedMeshComponents();
}

Super::Dispose(flushStreamLevels);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -399,7 +396,7 @@ void ADungeonGenerateActor::GenerateDungeonWithParameter(UDungeonGenerateParamet

void ADungeonGenerateActor::DestroyDungeon()
{
DestroyImplementation();
Dispose(false);
}

int32 ADungeonGenerateActor::FindFloorHeight(const float z) const
Expand Down
Loading

0 comments on commit 4824b3c

Please sign in to comment.