diff --git a/.gitignore b/.gitignore index fe0f5a9..6747e12 100644 --- a/.gitignore +++ b/.gitignore @@ -78,4 +78,3 @@ DerivedDataCache/* # Doxygen MAIN_PAGE.md -Document/doxygen diff --git a/CHANGELOG.md b/CHANGELOG.md index d515565..1a642fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log - Procedural 3D Dungeon Generator Plug-in +## 20251225-1.8.0 (63) +### Changes +* Added the ability to specify the direction in which dungeon rooms unfold. +* Added options for starting positions. +* Added a notification system for communicating breaking changes. +* Fixed several bugs +### 変更点 +* ダンジョンの部屋の展開方向の指定を追加 +* スタート位置の選択肢を追加 +* 破壊的な変更を連絡するための通知システムを追加 +* いくつかの不具合を修正 + ## 20251118-1.7.10 (62) ### Changes * Unreal Engine 5.7 support @@ -10,6 +22,16 @@ * 植物の分布方法を修正 * いくつかの不具合を修正 +## 20251122-1.7.9 (62) +### Changes +* Unreal Engine 5.7 support +* Revised plant distribution methods +* Fixed several bugs +### 変更点 +* Unreal Engine 5.7対応 +* 植物の分布方法を修正 +* いくつかの不具合を修正 + ## 20251004-1.7.8 (61) ### Changes * Added the ability to assist actors spawning into the aisle grid diff --git a/Document/.gitignore b/Document/.gitignore index 45946d4..05f0003 100644 --- a/Document/.gitignore +++ b/Document/.gitignore @@ -1 +1,5 @@ +# Built data for doxygen +doxygen + +# Ignore files .bak diff --git a/Document/FDungeonDoorActorParts.en.md b/Document/FDungeonDoorActorParts.en.md new file mode 100644 index 0000000..50466c2 --- /dev/null +++ b/Document/FDungeonDoorActorParts.en.md @@ -0,0 +1,15 @@ +# FDungeonDoorActorParts Guide + +FDungeonDoorActorParts is a **container for door Blueprint classes** used when spawning doors in generated rooms or corridors. It keeps your door variations organized. + +## Typical use +- Register one or more door Blueprint classes that include meshes, animations, and collision. +- The generator spawns the class you specify for each door position. + +## Key UPROPERTY fields +- **ActorClass (`UClass*`, EditAnywhere/BlueprintReadWrite)** + The Blueprint (or other Actor class) used as the door. If left empty, no door is spawned at that slot. + +## Editing tips +- Keep doors self-contained: include frame, open/close logic, and sounds in the Blueprint so swapping classes is painless. +- Test that the pivot and collision line up with the dungeon grid to avoid gaps or overlaps. diff --git a/Document/FDungeonDoorActorParts.ja.md b/Document/FDungeonDoorActorParts.ja.md new file mode 100644 index 0000000..bbbb544 --- /dev/null +++ b/Document/FDungeonDoorActorParts.ja.md @@ -0,0 +1,16 @@ +# FDungeonDoorActorParts 説明書 + +FDungeonDoorActorParts は、**部屋や通路の入口にスポーンさせるドア用アクターを登録するための入れ物**です。位置・向きのオフセット情報(FDungeonPartsTransform)に加えて、ドアとして扱うアクタークラスを指定します。 + +## 主な使い方 +- 既存の Blueprint ドア(`DungeonDoorBase` を継承)を `ActorClass` に設定すると、生成時にそのドアが配置されます。 +- メッシュやアニメーションを変えた複数のドアを作成し、メッシュセットやフロアごとに差し替えることで、同じダンジョンでも雰囲気を変えられます。 + +## UPROPERTY の意味 +- **ActorClass (`UClass*`, EditAnywhere/BlueprintReadOnly, AllowedClasses=`DungeonDoorBase`)** + 生成時にスポーンするドアアクターを指定します。`DungeonDoorBase` を継承した Blueprint や C++ クラスのみ選択可能です。未設定のままだとドアは置かれません。 + +## 編集のヒント +- 開閉方向や位置合わせはベースクラスの Transform で調整できます。壁厚に合わせて奥行きを微調整すると自然に見えます。 +- ドアの機能(鍵付き・破壊可能など)はドアクラス側で作り込んでください。ここでは「どのドアを置くか」だけを選びます。 + diff --git a/Document/FDungeonMeshParts.en.md b/Document/FDungeonMeshParts.en.md new file mode 100644 index 0000000..3a551c9 --- /dev/null +++ b/Document/FDungeonMeshParts.en.md @@ -0,0 +1,15 @@ +# FDungeonMeshParts Guide + +FDungeonMeshParts is a **container that records which single static mesh to place and how to offset/rotate it** for pillars, walls, ceilings, and similar pieces. The placement is driven by the base transform data (FDungeonPartsTransform), while the look comes from the `StaticMesh` you assign. + +## Typical use +- Express requests like “place this pillar 30 cm to the right and rotate it 90°” with a `StaticMesh` plus its offset/rotation. +- When you list multiple FDungeonMeshParts inside a mesh set ([UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.en.md)), generation can pick one based on random choice or selection rules. + +## Key UPROPERTY fields +- **StaticMesh (`UStaticMesh*`, EditAnywhere/BlueprintReadWrite)** + Specifies the static mesh that will be spawned. Leave it empty and nothing appears, so always assign a mesh. Because the mesh pivot becomes the placement origin, adjust the pivot in the asset if you want easier alignment. + +## Editing and placement tips +- Use the base Transform offset/rotation to fine-tune the position. Matching the grid size values (GridSize/VerticalGridSize in [UDungeonGenerateParameter](./UDungeonGenerateParameter.en.md)) keeps everything snapped. +- Register several meshes for the same role so the database selection rules can add variety during generation. diff --git a/Document/FDungeonMeshParts.ja.md b/Document/FDungeonMeshParts.ja.md new file mode 100644 index 0000000..f5a308d --- /dev/null +++ b/Document/FDungeonMeshParts.ja.md @@ -0,0 +1,16 @@ +# FDungeonMeshParts 説明書 + +FDungeonMeshParts は、**柱や壁など 1 枚のスタティックメッシュを「どこに・どの向きで」置くかを記録する入れ物**です。配置位置はベースクラスのオフセット情報(FDungeonPartsTransform)で決まり、見た目は `StaticMesh` の差し替えで変わります。レベルデザイナーやアーティストが自前のメッシュを登録し、テーマに合わせて柱・壁・天井などのパーツを切り替える用途を想定しています。 + +## 主な使い方 +- 「この柱メッシュを 30cm 右に、90 度回して置いてほしい」といった要望を、`StaticMesh` とオフセットで表現します。 +- メッシュセット([UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.ja.md))に複数の FDungeonMeshParts を並べると、生成時にランダムやルールに応じて選択されます。 + +## UPROPERTY の意味 +- **StaticMesh (`UStaticMesh*`, EditAnywhere/BlueprintReadWrite)** + 生成時にスポーンするスタティックメッシュを指定します。未設定だと何も置かれないので、必ず設定してください。メッシュの原点が配置基準になるため、メッシュ側でピボット調整を済ませておくと位置決めが楽になります。 + +## 編集と配置のヒント +- オフセットや回転はベースクラスの Transform で調整できます。グリッドサイズ([UDungeonGenerateParameter](./UDungeonGenerateParameter.ja.md) の GridSize/VerticalGridSize)に合わせた値にするとスナップが揃います。 +- 同じ役割のメッシュを複数登録しておくと、DB 側の選択ルールでバリエーションを出せます。 + diff --git a/Document/FDungeonRandomActorParts.en.md b/Document/FDungeonRandomActorParts.en.md new file mode 100644 index 0000000..97de980 --- /dev/null +++ b/Document/FDungeonRandomActorParts.en.md @@ -0,0 +1,15 @@ +# FDungeonRandomActorParts Guide + +FDungeonRandomActorParts collects **one or more actor assets and picks one at random** when the dungeon is generated. Use it for props like torches, crates, or decorative pieces that should vary. + +## Typical use +- Register several Actor/Blueprint assets, then let the system choose one for each placement slot. +- Place the part inside a mesh or actor set so different props can appear across rooms and corridors. + +## Key UPROPERTY fields +- **Actors (`TArray`, EditAnywhere/BlueprintReadWrite)** + The list of actor classes to choose from. Empty entries are skipped. All items in the list are treated with equal probability. + +## Editing tips +- Keep the list short and focused (e.g., 3–5 options) so randomness remains controlled and easy to test. +- If an actor needs specific offsets or rotation, handle it inside the actor Blueprint itself so the placement stays consistent. diff --git a/Document/FDungeonRandomActorParts.ja.md b/Document/FDungeonRandomActorParts.ja.md new file mode 100644 index 0000000..4379cca --- /dev/null +++ b/Document/FDungeonRandomActorParts.ja.md @@ -0,0 +1,16 @@ +# FDungeonRandomActorParts 説明書 + +FDungeonRandomActorParts は、**同じスポーン地点に複数のアクター候補を登録し、確率で出し分けるための入れ物**です。向きやオフセットを持つ FDungeonActorPartsWithDirection を継承しつつ、`Frequency` で出現頻度を調整できます。 + +## 主な使い方 +- 祠・宝箱・環境オブジェクトなど、同じ場所に「たまに置きたい」装飾を確率付きで登録します。 +- ダンジョン生成パラメータ側の「ランダムアクター」配列に追加すると、生成時に抽選されます。 + +## UPROPERTY の意味 +- **Frequency (`float`, EditAnywhere/BlueprintReadWrite, 0.0〜1.0)** + 配置確率。1.0 なら毎回必ず配置、0.5 なら 50% の確率で出現します。複数のパーツを並べる場合、それぞれ個別に判定されるため「二つとも出る」こともあります。確率を下げればレア感を演出できます。 + +## 編集のヒント +- 同じ役割のアクターを複数登録しておくと、Frequency を調整するだけで「ごくまれにレアオブジェクトが混ざる」などの演出が簡単になります。 +- 回転や位置合わせはベースクラスの Transform 設定を利用してください。メッシュの向きに合わせて方向指定しておくと自然に並びます。 + diff --git a/Document/README.md b/Document/README.md new file mode 100644 index 0000000..7b58634 --- /dev/null +++ b/Document/README.md @@ -0,0 +1,23 @@ +# Dungeon Generator Documentation Links + +Use the links below to open each reference guide. English and Japanese (ja) versions are grouped together for quick access. + +## English +- [UDungeonGenerateParameter](UDungeonGenerateParameter.en.md) +- [FDungeonMeshParts](FDungeonMeshParts.en.md) +- [FDungeonRandomActorParts](FDungeonRandomActorParts.en.md) +- [FDungeonDoorActorParts](FDungeonDoorActorParts.en.md) +- [UDungeonMeshSetDatabase](UDungeonMeshSetDatabase.en.md) +- [UDungeonInteriorDatabase](UDungeonInteriorDatabase.en.md) +- [UDungeonSubLevelDatabase](UDungeonSubLevelDatabase.en.md) +- [UDungeonRoomSensorDatabase](UDungeonRoomSensorDatabase.en.md) + +## 日本語 +- [UDungeonGenerateParameter](UDungeonGenerateParameter.ja.md) +- [FDungeonMeshParts](FDungeonMeshParts.ja.md) +- [FDungeonRandomActorParts](FDungeonRandomActorParts.ja.md) +- [FDungeonDoorActorParts](FDungeonDoorActorParts.ja.md) +- [UDungeonMeshSetDatabase](UDungeonMeshSetDatabase.ja.md) +- [UDungeonInteriorDatabase](UDungeonInteriorDatabase.ja.md) +- [UDungeonSubLevelDatabase](UDungeonSubLevelDatabase.ja.md) +- [UDungeonRoomSensorDatabase](UDungeonRoomSensorDatabase.ja.md) diff --git a/Document/UDungeonGenerateParameter.en.md b/Document/UDungeonGenerateParameter.en.md new file mode 100644 index 0000000..896b78e --- /dev/null +++ b/Document/UDungeonGenerateParameter.en.md @@ -0,0 +1,76 @@ +# UDungeonGenerateParameter Guide + +UDungeonGenerateParameter collects the settings for dungeon generation. This guide explains **the intent, default behavior, and edit conditions** for the Blueprint-exposed UPROPERTY fields in a way that non-engineers can tune the generator for their desired look and feel. Focus on how each option affects the player experience instead of code locations. + +## Basics (reproducibility and debugging) +- **RandomSeed (`int32`)**: Seed for generation. Fix it to reproduce a layout; use 0 to randomize every run. `EditAnywhere`, `ClampMin=0`. +- **GeneratedRandomSeed (`int32`)**: The seed actually used in the last generation. Read-only reference when you want to recreate a found layout. +- **GeneratedDungeonCRC32 (`int32`)**: CRC32 of the last generated dungeon. Useful for version-to-version comparisons (read-only). + +## Room size and spacing (exploration feel and visibility) +- **RoomWidth (`FInt32Interval`)**: Min/max room width. Smaller for corridor-like areas, larger for combat arenas. UI clamps to 1 or more. +- **RoomDepth (`FInt32Interval`)**: Min/max room depth. Raise it to create more elongated rooms. UI clamps to 1 or more. +- **RoomHeight (`FInt32Interval`)**: Min/max room height. Increase for vertical combat or sightlines. UI clamps to 1 or more. +- **RoomMargin (`uint8`)**: Horizontal gap between rooms. Wider margins reduce claustrophobic corridors; narrow margins increase density. Editable only when `MergeRooms` is off; min 1. +- **VerticalRoomMargin (`uint8`)**: Vertical gap between rooms. Helps avoid overlap in multi-layer layouts. Editable only when `MergeRooms` and `Flat` are off; min 0. + +## Room/floor candidates and layout policy (overall map shape) +- **NumberOfCandidateRooms (`uint8`)**: Initial number of room candidates. More candidates mean longer generation but greater variety. Range 3–100. +- **MergeRooms (`bool`)**: Whether to merge adjacent rooms. Useful for large halls, but disables Margin and ExpansionPolicy edits when on. +- **ExpansionPolicy (`EDungeonExpansionPolicy`)**: Directional growth policy (horizontal, vertical, any). Enable vertical growth for multi-level mazes. Editable only when `MergeRooms` and `Flat` are off. +- **NumberOfCandidateFloors (`uint8`)**: Number of candidate floors to attempt. Raise to encourage multi-layer structures. Range 0–5; editable only when `Flat` is off. +- **Flat (`bool`)**: Force a single-floor layout. Handy for top-down prototypes; suppresses floor-related and vertical margin options. + +## Player start and missions (core gameplay flow) +- **MovePlayerStartToStartingPoint (`bool`)**: Automatically moves PlayerStart to the chosen start room after generation for quick playtests. +- **StartLocationPolicy (`EDungeonStartLocationPolicy`)**: How the start room is picked (southernmost, highest, central, multi-start, etc.). Shapes the opening flow. `UseCentralPoint` and `UseMultiStart` require `UseMissionGraph` to be disabled. When using `UseMultiStart`, the generator creates as many start rooms as there are `PlayerStart` actors. +- **UseMissionGraph (`bool`)**: Enables key/mission generation. Leave off for free exploration; turn on for key hunts and controlled routes. Tends to be stable when `MergeRooms` is off and `AisleComplexity` is 0 (per comments). +- **AisleComplexity (`uint8`)**: Corridor complexity. Increase for maze-like feel. Editable only when both `MergeRooms` and `UseMissionGraph` are off; range 0–10. When `UseMissionGraph` is on, the getter forces this to 0. + +## In-room structures (personality of each space) +- **GenerateSlopeInRoom (`bool`)**: Add slopes inside rooms for vertical accents and sight breaks (may become always-on in future). +- **GenerateStructuralColumn (`bool`)**: Add structural columns for cover and silhouette variety (may become always-on in future). + +## Grid size (snap and movement baseline) +- **GridSize (`float`)**: Horizontal voxel size. Align to your mesh dimensions for clean snapping. `ClampMin=1`. +- **VerticalGridSize (`float`)**: Vertical voxel size. Match your jump height or stair slope for consistent feel. `ClampMin=1`. + +## Mesh parts (art style and density) +- **DungeonRoomMeshPartsDatabase (`[UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.en.md)*`)**: Mesh parts DB for rooms. Swap to change the art theme. +- **DungeonAisleMeshPartsDatabase (`[UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.en.md)*`)**: Mesh parts DB for corridors. Use a separate set if you want distinct corridor style. +- **PillarPartsSelectionMethod (`EDungeonPartsSelectionMethod`)**: How pillar parts are picked (random, depth-based, etc.). Adjust to bias pillar variety. +- **PillarParts (`TArray<[FDungeonMeshParts](./FDungeonMeshParts.en.md)>`)**: Pillar mesh list. Swap to change silhouettes or cover options. + +### Mesh parts and databases in context +- **[FDungeonMeshParts](./FDungeonMeshParts.en.md)**: Holds a single static mesh plus transform offset (inherits `FDungeonPartsTransform`). Simple for art teams to request exact placement/orientation for pillars or similar pieces. +- **[UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.en.md)**: Groups floor/wall/ceiling mesh sets with selectable policies (depth-based, random, etc.). Swap here to change the art theme per room or corridor. +- **[FDungeonRandomActorParts](./FDungeonRandomActorParts.en.md)**: Registers actors (e.g., a torch Blueprint) with spawn probabilities via `Frequency` (0.0–1.0). Great for occasional rare decorations. +- **[FDungeonDoorActorParts](./FDungeonDoorActorParts.en.md)**: Door actor parts referencing `DungeonDoorBase`-derived Blueprint classes plus offsets. Use to mix keyed doors or visual variants. +- **TorchPartsSelectionMethod (`EDungeonPartsSelectionMethod`)**: How torch parts are chosen. Tune to control wall decoration and visibility rhythm. +- **FrequencyOfTorchlightGeneration (`EFrequencyOfGeneration`)**: Torch spawn frequency. Lower for darker mood, higher for bright dungeons. Default `Rarely`. +- **TorchParts (`TArray<[FDungeonRandomActorParts](./FDungeonRandomActorParts.en.md)>`)**: Torch/lamplight actor list. Change flame color or shape to alter atmosphere. +- **DoorPartsSelectionMethod (`EDungeonPartsSelectionMethod`)**: Door parts selection method. Useful for highlighting important rooms. +- **DoorParts (`TArray<[FDungeonDoorActorParts](./FDungeonDoorActorParts.en.md)>`)**: Door variants to mix keyed doors or different looks. + +## Product-only databases (`PRODUCT_ONLY`) (final polish) +- **DungeonInteriorDatabase** ([UDungeonInteriorDatabase](./UDungeonInteriorDatabase.en.md)): Interior placement DB. Swap to change furniture/decoration themes. +- **DungeonSubLevelDatabase** ([UDungeonSubLevelDatabase](./UDungeonSubLevelDatabase.en.md)): Start/goal and special sublevel DB. Use to inject event-specific levels. + +## Room sensors (triggers and presentation) +- **DungeonRoomSensorClass (`UClass*`)**: Direct sensor class reference. Marked `DeprecatedProperty`; prefer the database for new setups. +- **DungeonRoomSensorDatabase ([UDungeonRoomSensorDatabase](./UDungeonRoomSensorDatabase.en.md))**: Database controlling room sensors and their effects (BGM, buffs, spawns, etc.). + +### How to use the product-only databases +- [**UDungeonInteriorDatabase**](./UDungeonInteriorDatabase.en.md): Manages interior presets by tags and regenerates voxel placement data on Build. Swap themes quickly to test different moods. +- [**UDungeonSubLevelDatabase**](./UDungeonSubLevelDatabase.en.md): Registers sublevels for start/goal rooms or special events. Must match this parameter’s GridSize. Supports direct start/goal assignments plus capped random injections for secret rooms or scripted boss arenas. +- [**UDungeonRoomSensorDatabase**](./UDungeonRoomSensorDatabase.en.md): Draws from `DungeonRoomSensorBase`-derived classes with conditions by depth or identifiers. Includes an event to spawn extra corridor actors after generation, letting you centralize BGM changes, traps, or other room-entry effects. + +## Extra info (troubleshooting) +- **PluginVersion (`uint8`)**: Plugin version, read-only. Useful for support and cross-environment checks. + +### Edit-condition reminders +- Enabling `MergeRooms` disables editing of `RoomMargin`, `VerticalRoomMargin`, and `ExpansionPolicy`. +- Enabling `Flat` disables floor-related options (`NumberOfCandidateFloors`) and vertical margins. +- When `UseMissionGraph` is enabled, `GetAisleComplexity` returns 0, effectively ignoring the complexity setting. + +Use this guide when adjusting dungeon generation parameters in Blueprint to understand how each option shapes the resulting layout and play experience. diff --git a/Document/UDungeonGenerateParameter.ja.md b/Document/UDungeonGenerateParameter.ja.md new file mode 100644 index 0000000..57bd436 --- /dev/null +++ b/Document/UDungeonGenerateParameter.ja.md @@ -0,0 +1,76 @@ +# UDungeonGenerateParameter 説明書 + +UDungeonGenerateParameter は、ダンジョン生成に関する設定をまとめた UObject です。以下では、Blueprint から調整できる UPROPERTY 変数を中心に、**プラグイン利用者が実際に値を変える際に役立つ意図・初期値・編集条件**をまとめます。作りたいダンジョンの形やプレイフィールに合わせて、設定の意味と連動を押さえつつ調整してください。コードの行番号ではなく操作上の意味を優先し、非エンジニアでも読みやすい形でまとめています。 + +## 基本情報(再現性とデバッグの起点) +- **RandomSeed (`int32`)**: 生成に利用する乱数シード。テストの再現性が必要なときは固定値にし、0 なら毎回ランダム。`EditAnywhere` で `ClampMin=0`。 +- **GeneratedRandomSeed (`int32`)**: 直近の生成で実際に使われたシード。プレイテストで「この形を再現したい」ときの控えとして参照する欄(編集不可)。 +- **GeneratedDungeonCRC32 (`int32`)**: 直近で生成されたダンジョンの CRC32。バージョン違いでの差分チェックに利用可能(表示のみ)。 + +## 部屋サイズと間隔(探索感・視界の作り込み) +- **RoomWidth (`FInt32Interval`)**: 部屋の幅の最小/最大。狭くすると通路感、広くすると戦闘しやすい広場を作りやすい。UI で 1 以上に制限。 +- **RoomDepth (`FInt32Interval`)**: 部屋の奥行きの最小/最大。縦長の部屋を増やしたい場合に上げる。UI で 1 以上に制限。 +- **RoomHeight (`FInt32Interval`)**: 部屋の高さの最小/最大。立体戦を重視するなら上げる。UI で 1 以上に制限。 +- **RoomMargin (`uint8`)**: 部屋間の水平方向の余白。細い通路や圧迫感を出したくないなら広めに、密度を上げたいなら狭めに設定。`MergeRooms` 無効時のみ編集可、最小 1。 +- **VerticalRoomMargin (`uint8`)**: 部屋間の垂直方向の余白。多層ダンジョンで上下の重なりを抑える際に利用。`MergeRooms` と `Flat` が無効のときのみ編集可、最小 0。 + +## 部屋・階層の候補数と配置方針(マップ形状の大枠) +- **NumberOfCandidateRooms (`uint8`)**: 生成の初期候補となる部屋数。値を増やすと部屋同士の試行が増え、生成時間は伸びるがバリエーションも増える。3〜100。 +- **MergeRooms (`bool`)**: 隣接部屋を結合するか。広い部屋が欲しいときに有効だが、結合をオンにすると Margin や ExpansionPolicy が編集不可になる点に注意。 +- **ExpansionPolicy (`EDungeonExpansionPolicy`)**: 部屋を横方向・縦方向・任意方向に広げる方針。立体迷路にしたいなら縦方向を含む設定にする。`MergeRooms` と `Flat` が無効時のみ編集可。 +- **NumberOfCandidateFloors (`uint8`)**: 生成参考用の階層候補数。多層化の試行回数を決めるため、立体構造を増やしたい場合に上げる。0〜5 かつ `Flat` 無効時のみ編集可。 +- **Flat (`bool`)**: 平面的(単層)ダンジョンを生成するか。縦方向を不要にしたいサンプルやトップダウン視点に便利。オンにすると階層関連や垂直マージンが抑制される。 + +## プレイヤー開始位置とミッション(ゲーム体験の骨格) +- **MovePlayerStartToStartingPoint (`bool`)**: ゲーム開始時に PlayerStart をスタート部屋へ自動移動。ハンドプレース不要で、生成後すぐ試遊したいときに便利。 +- **StartLocationPolicy (`EDungeonStartLocationPolicy`)**: 開始部屋の選定方針(南端・最高点・中央付近・マルチスタートなど)。序盤の導線を決める重要な設定で、縦構造を活かした始まり方を演出できる。`UseCentralPoint` と `UseMultiStart` は `UseMissionGraph` が無効な場合のみ利用可能。`UseMultiStart` の場合は `PlayerStart` の数だけスタート部屋が生成される。 +- **UseMissionGraph (`bool`)**: 鍵付きミッション生成を有効化。シンプルな探索を望むときはオフ、鍵探しやルート制御をしたいときはオン。`MergeRooms` 無効かつ `AisleComplexity` が 0 のときに安定しやすい(コメントより)。 +- **AisleComplexity (`uint8`)**: 通路の複雑さ。迷路感を増やしたいなら上げる。`MergeRooms` と `UseMissionGraph` が無効時のみ編集可、0〜10。`UseMissionGraph` が有効な場合は自動的に 0 として扱われる(Getter 実装より)。 + +## 部屋内構造の有無(レイアウトの個性付け) +- **GenerateSlopeInRoom (`bool`)**: 部屋内にスロープを生成するか。上下移動のアクセントや視界の抜けを作りたいときに有効(将来強制有効化の可能性あり)。 +- **GenerateStructuralColumn (`bool`)**: 部屋内に構造柱を生成するか。遮蔽やシルエットの多様化を狙うときにオン(将来強制有効化の可能性あり)。 + +## グリッドサイズ(パーツ・移動の基準) +- **GridSize (`float`)**: 水平方向のボクセルサイズ。メッシュスナップや移動量の基準になるので、利用するメッシュ寸法に合わせて設定。`ClampMin=1`。 +- **VerticalGridSize (`float`)**: 垂直方向のボクセルサイズ。ジャンプ力や階段勾配に合う値に合わせるとプレイ感が整う。`ClampMin=1`。 + +## メッシュパーツ設定(美術テイストと密度) +- **DungeonRoomMeshPartsDatabase** ([UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.ja.md)): 部屋用メッシュパーツ DB。アートテーマをまとめて切り替えたい場合はここでセット。 +- **DungeonAisleMeshPartsDatabase** ([UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.ja.md)): 通路用メッシュパーツ DB。部屋とテイストを変えたい場合に別セットを指定。 +- **PillarPartsSelectionMethod** (`EDungeonPartsSelectionMethod`): 柱パーツの選択方法(ランダム等)。柱の出現に偏りを持たせたいときに調整。 +- **PillarParts** (TArray<[FDungeonMeshParts](./FDungeonMeshParts.ja.md)>): 利用する柱メッシュ群。シルエットのバリエーションやゲームプレイ上の遮蔽を変えたいときに差し替える。 + +### メッシュパーツやデータベースの詳細 +- **[FDungeonMeshParts](./FDungeonMeshParts.ja.md)**: 単一のスタティックメッシュを登録する入れ物。メッシュとオフセット(`FDungeonPartsTransform` 継承)をセットするだけなので、アートチームが「この柱メッシュをこの位置・向きで置いてほしい」といった要望を反映しやすい。 +- **[UDungeonMeshSetDatabase](./UDungeonMeshSetDatabase.ja.md)**: 床・壁・天井などのメッシュセットをまとめて管理するデータベース。選択方法(深さベース/ランダム等)を指定でき、グリッド上での部屋や通路ごとに自動抽選される。アートテーマを一括で切り替えたいときはここを差し替える。 +- **[FDungeonRandomActorParts](./FDungeonRandomActorParts.ja.md)**: メッシュではなくアクター(例: 燭台の Blueprint)を確率付きで登録するパーツ。`Frequency` を 0.0〜1.0 で設定して出現率を調整できるため、「たまにレアな装飾が出る」演出に向く。 +- **[FDungeonDoorActorParts](./FDungeonDoorActorParts.ja.md)**: ドア用のアクターパーツ。`DungeonDoorBase` を継承した Blueprint クラスを指定し、位置オフセットも付けられる。鍵付きドアや見た目違いを複数用意する場合に活用。 +- **TorchPartsSelectionMethod (`EDungeonPartsSelectionMethod`)**: 燭台パーツの選択方法。壁沿いの装飾や視認性をコントロールしたい場合に調整。 +- **FrequencyOfTorchlightGeneration (`EFrequencyOfGeneration`)**: 燭台生成頻度。暗さを活かしたいなら低く、明るいダンジョンにしたいなら高く。初期値は `Rarely`。 +- **TorchParts (`TArray<[FDungeonRandomActorParts](./FDungeonRandomActorParts.ja.md)>`)**: 燭台(柱灯)のメッシュ/アクターパーツ群。炎の色や形で雰囲気を変えるときに編集。 +- **DoorPartsSelectionMethod (`EDungeonPartsSelectionMethod`)**: ドアパーツの選択方法。重要ルームへのドアを特徴付けたい場合に有効。 +- **DoorParts** (TArray<[FDungeonDoorActorParts](./FDungeonDoorActorParts.ja.md)>): ドアのパーツ群。鍵付きドアや見た目違いを混ぜたいときに差し替え。 + +## プロダクト限定データベース(`PRODUCT_ONLY`)(演出・レベル構成の仕上げ) +- **DungeonInteriorDatabase** ([UDungeonInteriorDatabase](./UDungeonInteriorDatabase.ja.md)): インテリア配置用 DB。家具・装飾のテーマをまとめて差し替える際に使用。 +- **DungeonSubLevelDatabase** ([UDungeonSubLevelDatabase](./UDungeonSubLevelDatabase.ja.md)): スタート/ゴールやサブレベル指定用 DB。特定シーケンスやイベント用レベルを混ぜ込むときに指定。 + +## ルームセンサー関連(トリガーと演出) +- **DungeonRoomSensorClass (`UClass*`)**: ルームセンサーのクラス指定。`DeprecatedProperty` のため、基本は Database を使い、互換目的でのみ参照。 +- **DungeonRoomSensorDatabase** ([UDungeonRoomSensorDatabase](./UDungeonRoomSensorDatabase.ja.md))**: ルームセンサーの配置・演出を管理する DB。BGM やバフ、スポーン制御など部屋ごとの演出を統一的に設定可能。 + +### プロダクト限定データベースの使いどころ +- [**UDungeonInteriorDatabase**](./UDungeonInteriorDatabase.ja.md): 家具や植生などの「内装プリセット」をタグで管理し、Build ボタンでボクセル配置データを再生成するアセット。テーマ単位で一括切り替えできるので、シーン別の雰囲気を短時間で試せる。 +- [**UDungeonSubLevelDatabase**](./UDungeonSubLevelDatabase.ja.md): スタート/ゴール部屋や特定イベント用のサブレベルを登録するアセット。GridSize が DungeonGenerateParameter と一致している必要がある。Start/Goal 用ルームを直指定するほか、抽選上限付きでランダムサブレベルを混ぜ込めるため、「たまに出る隠し部屋」や「固定演出のボス部屋」を実現しやすい。 +- **[UDungeonRoomSensorDatabase](./UDungeonRoomSensorDatabase.ja.md)**: 部屋侵入センサー(`DungeonRoomSensorBase` 継承)を条件付きで抽選・配置するアセット。深さや識別子に応じてセンサー種類を変えられ、生成完了時イベントで通路に追加アクターをスポーンする仕組みも含む。全体の演出・BGM 切替・トラップ配置をまとめてコントロールする用途に最適。 + +## 付加情報(トラブルシュート) +- **PluginVersion (`uint8`)**: プラグインバージョン。サポート問い合わせ時や異なる環境間での再現確認に利用。`BlueprintReadOnly` で表示のみ。 + +### 編集条件の注意点 +- `MergeRooms` を有効にすると `RoomMargin` や `VerticalRoomMargin`、`ExpansionPolicy` が編集不可。 +- `Flat` を有効にすると階層関連(`NumberOfCandidateFloors`)や垂直マージンが編集不可。 +- `UseMissionGraph` を有効にした場合、`GetAisleComplexity` が 0 を返すため複雑度設定は実質無効化されます。 + +このドキュメントを参照することで、Blueprint からダンジョン生成パラメータを調整する際の意図と制約を把握できます。 diff --git a/Document/UDungeonInteriorDatabase.en.md b/Document/UDungeonInteriorDatabase.en.md new file mode 100644 index 0000000..5beefed --- /dev/null +++ b/Document/UDungeonInteriorDatabase.en.md @@ -0,0 +1,15 @@ +# UDungeonInteriorDatabase Guide + +UDungeonInteriorDatabase is a **product-only database for interior themes**. It lets you assign meshes and actors that define the overall look of a dungeon’s rooms. + +## Typical use +- Prepare themed interior sets (walls, floors, ceilings, props) and list them here. +- Reference this database in generation settings to apply the chosen interior set to rooms. + +## Key UPROPERTY fields +- **InteriorData (`FDungeonInteriorData`, EditAnywhere/BlueprintReadOnly)** + The collection of interior assets and rules. Customize the meshes/actors and how they should be used. + +## Editing tips +- Keep each interior set cohesive—use consistent materials and lighting-friendly meshes. +- If you need multiple moods, create several database assets and swap them per level or mission. diff --git a/Document/UDungeonInteriorDatabase.ja.md b/Document/UDungeonInteriorDatabase.ja.md new file mode 100644 index 0000000..5c08158 --- /dev/null +++ b/Document/UDungeonInteriorDatabase.ja.md @@ -0,0 +1,19 @@ +# UDungeonInteriorDatabase 説明書 + +UDungeonInteriorDatabase は、**部屋の内装パーツや植生パーツをタグで整理し、条件に合うものを自動抽選するデータベース**です。部屋のテーマに合わせて家具・装飾・植生を切り替えたいときに利用します。 + +## 主な使い方 +- 部屋やゾーンに付けるタグ(例: `Library`, `Boss`, `Ruins` など)に対応した内装パーツを Parts に登録します。 +- 植物や草などの植生パーツは VegetationParts にまとめておき、必要に応じて同じタグで管理します。 +- 生成パイプラインで部屋に付与される `interiorTags` に基づき、Select が該当パーツを返します。プレハブ化したい場合は Build を実行しておくと安全です。 + +## UPROPERTY の意味 +- **Parts (`TArray`, EditAnywhere/BlueprintReadOnly)** + 内装パーツの一覧。各パーツに「適用するタグ」を仕込んでおくと、Select で一致したものが選ばれます。家具セットやデカールなど、部屋の雰囲気を決める要素を登録してください。 +- **VegetationParts (`TArray`, EditAnywhere/BlueprintReadOnly)** + 植生パーツの一覧。フォリッジや蔦など、環境系の装飾をまとめます。内装パーツとは別管理なので、非植生系だけを差し替えたい場合にも便利です。 + +## 編集のヒント +- Tags を活用して「この種類の部屋には必ずこの家具を置く」「ボス部屋では植生を減らす」といった制御ができます。 +- パラメータを変更したら Build ボタンを押してデータを再生成してください(エディタ上で実行可能)。 + diff --git a/Document/UDungeonMeshSetDatabase.en.md b/Document/UDungeonMeshSetDatabase.en.md new file mode 100644 index 0000000..e1dcc28 --- /dev/null +++ b/Document/UDungeonMeshSetDatabase.en.md @@ -0,0 +1,18 @@ +# UDungeonMeshSetDatabase Guide + +UDungeonMeshSetDatabase **manages collections of mesh sets (themes) and chooses which set to use during generation**. Group FDungeonMeshParts into themed sets—like stone for 1F and rusty metal for B1F—and let the database select them based on depth or randomness. + +## Typical use +- Build several mesh themes in Parts (e.g., stone floors/walls/ceilings for early levels, metal variants for deeper floors). +- Use SelectionMethod to decide how a set is chosen: by depth weighting, or simple randomness. +- Assign this asset to the “Room/Corridor Mesh Parts DB” fields in [UDungeonGenerateParameter](./UDungeonGenerateParameter.en.md) so generation references it. + +## Key UPROPERTY fields +- **SelectionMethod (`EDungeonMeshSetSelectionMethod`, EditAnywhere/BlueprintReadOnly)** + How to choose a mesh set. Options include depth-aware weighting or pure random. If unsure, start with “DepthFromStart” to swap themes the farther you go. +- **Parts (`TArray`, EditAnywhere/BlueprintReadOnly)** + The list of actual mesh sets. Each FDungeonMeshSet contains [FDungeonMeshParts](./FDungeonMeshParts.en.md) for floor, wall, ceiling, and other slots; once a set is chosen, those parts supply the meshes. + +## Editing tips +- The meaning of order can change with the SelectionMethod. Use “DepthFromStart” for progression-based themes, or a random option if you just want variety. +- Add multiple sets and multiple parts within each set to keep rooms visually varied even inside the same theme. diff --git a/Document/UDungeonMeshSetDatabase.ja.md b/Document/UDungeonMeshSetDatabase.ja.md new file mode 100644 index 0000000..fe4f78e --- /dev/null +++ b/Document/UDungeonMeshSetDatabase.ja.md @@ -0,0 +1,19 @@ +# UDungeonMeshSetDatabase 説明書 + +UDungeonMeshSetDatabase は、床・壁・天井などの**メッシュセットをまとめて管理し、生成時にどのセットを使うかを抽選するデータベース**です。セットごとに FDungeonMeshParts を束ねた「テーマ」を作り、ダンジョンの深さや識別子に応じて出し分けできます。 + +## 主な使い方 +- テーマや階層ごとに異なるメッシュ構成(例: 1F は石造り、B1F は錆びた金属)を Parts に登録します。 +- SelectionMethod で、どのルールでセットを選ぶかを決めます。深さに応じて変える、完全ランダムにする、といった切り替えが可能です。 +- [UDungeonGenerateParameter](./UDungeonGenerateParameter.ja.md) の「部屋用/通路用メッシュパーツ DB」にこのアセットを指定すると、生成時に参照されます。 + +## UPROPERTY の意味 +- **SelectionMethod (`EDungeonMeshSetSelectionMethod`, EditAnywhere/BlueprintReadOnly)** + メッシュセットの選び方。深さに応じた重み付けや単純ランダムなど、用意された方式から選びます。迷ったらデフォルトの「DepthFromStart」でスタート地点からの距離に応じてテーマを変えるのがおすすめです。 +- **Parts (`TArray`, EditAnywhere/BlueprintReadOnly)** + 実際のメッシュセットを並べる配列です。各 FDungeonMeshSet に床・壁・天井などの [FDungeonMeshParts](./FDungeonMeshParts.ja.md) を含めておくと、抽選されたセット内でさらに部位ごとのパーツが使われます。 + +## 編集のヒント +- セットの並び順は SelectionMethod によって解釈が変わる場合があります。深さで使い分けたいときは「DepthFromStart」で、バリエーションだけ欲しいときはランダム系を選ぶとシンプルです。 +- Parts を複数登録し、各セットの中にも複数のパーツを入れておくと、同じテーマでも細かな違いを出せます。 + diff --git a/Document/UDungeonRoomSensorDatabase.en.md b/Document/UDungeonRoomSensorDatabase.en.md new file mode 100644 index 0000000..d10cda2 --- /dev/null +++ b/Document/UDungeonRoomSensorDatabase.en.md @@ -0,0 +1,15 @@ +# UDungeonRoomSensorDatabase Guide + +UDungeonRoomSensorDatabase is a **product-only database that pairs rooms with sensor logic** to trigger events, scoring, or analytics. + +## Typical use +- Define which sensor setups should be applied to generated rooms (e.g., encounter triggers, loot tracking, or player presence sensors). +- Assign this database so the generator attaches the correct sensor Blueprints when building rooms. + +## Key UPROPERTY fields +- **RoomSensorData (`FDungeonRoomSensorData`, EditAnywhere/BlueprintReadOnly)** + Settings for which sensors to use and how they activate within rooms. + +## Editing tips +- Keep sensor Blueprints modular so they can be reused across room types. +- Validate that sensors fire at the right time by running quick test generations before release. diff --git a/Document/UDungeonRoomSensorDatabase.ja.md b/Document/UDungeonRoomSensorDatabase.ja.md new file mode 100644 index 0000000..c071a4c --- /dev/null +++ b/Document/UDungeonRoomSensorDatabase.ja.md @@ -0,0 +1,21 @@ +# UDungeonRoomSensorDatabase 説明書 + +UDungeonRoomSensorDatabase は、**部屋への侵入を検知するセンサー(UDungeonRoomSensor 派生クラス)をまとめ、条件に応じて抽選・配置するデータベース**です。トラップの発動やイベントトリガーを部屋単位で切り替えたいときに利用します。 + +## 主な使い方 +- 配置したいセンサー(`DungeonRoomSensorBase` を継承した Blueprint/C++ クラス)を `DungeonRoomSensorClass` に登録します。 +- SelectionMethod で「どのセンサーをどの部屋に使うか」を決めます。深さで変える、ランダムで混ぜるなどの方式があります。 +- ダンジョン生成が終わると OnEndGeneration が呼ばれ、`SpawnActorInAisle` に登録したアクターを通路に自動スポーンさせることもできます(センサー設置後の演出用)。 + +## UPROPERTY の意味 +- **SelectionMethod (`EDungeonMeshSetSelectionMethod`, EditAnywhere)** + センサー選択ルール。スタートからの距離などを基準に、登録済みセンサーのどれを使うかを決めます。特定階層だけ強めのセンサーにする、といった使い分けに便利です。 +- **DungeonRoomSensorClass (`TArray`, EditAnywhere, AllowedClasses=`DungeonRoomSensorBase`)** + 使用可能なセンサークラスの一覧。ここに登録したものの中から SelectionMethod に従って抽選されます。未登録だとセンサーは置かれません。 +- **SpawnActorInAisle (`TArray`, EditAnywhere, AllowedClasses=`Engine.Blueprint`)** + 通路にスポーンさせる追加アクターのリスト。生成完了後の演出(センサーの警報灯やフォグなど)を自動で配置したい場合に利用します。空なら何もスポーンしません。 + +## 編集のヒント +- センサーごとに難易度や挙動が異なる場合、SelectionMethod を「DepthFromStart」にして深い階層ほど強いセンサーを登録すると、探索進行に合わせて緊張感を上げられます。 +- SpawnActorInAisle で指定する Blueprint は、配置先の通路サイズに合わせてメッシュやエフェクトのスケールを調整しておくと破綻しにくくなります。 + diff --git a/Document/UDungeonSubLevelDatabase.en.md b/Document/UDungeonSubLevelDatabase.en.md new file mode 100644 index 0000000..be197a1 --- /dev/null +++ b/Document/UDungeonSubLevelDatabase.en.md @@ -0,0 +1,15 @@ +# UDungeonSubLevelDatabase Guide + +UDungeonSubLevelDatabase is a **product-only database for special sublevel rooms** such as boss arenas or mission-specific areas. + +## Typical use +- Register sublevels or map assets that should replace normal rooms under certain conditions. +- Link this database in generation settings so the system can swap in these special rooms when required. + +## Key UPROPERTY fields +- **SubLevelData (`FDungeonSubLevelData`, EditAnywhere/BlueprintReadOnly)** + Configuration for sublevel assets, including what to spawn and when. + +## Editing tips +- Keep sublevels self-contained with their own lighting and navigation data. +- Test transition points so doors, corridors, and player spawn points align cleanly with the main dungeon. diff --git a/Document/UDungeonSubLevelDatabase.ja.md b/Document/UDungeonSubLevelDatabase.ja.md new file mode 100644 index 0000000..199ecfe --- /dev/null +++ b/Document/UDungeonSubLevelDatabase.ja.md @@ -0,0 +1,27 @@ +# UDungeonSubLevelDatabase 説明書 + +UDungeonSubLevelDatabase は、**特定の部屋を別レベルに差し替える「サブレベル」を管理し、スタート・ゴール・ランダム枠に配置するためのデータベース**です。大部屋やボス部屋などを事前に作り込んだレベルアセットで置き換えたいときに使います。 + +## 主な使い方 +- 事前に用意したサブレベル(LevelPath を持つ FDungeonRoomRegister)を登録しておき、スタートやゴール用、優先配置用、ランダム抽選用に振り分けます。 +- GridSize/VerticalGridSize は参照用の表示フィールドです。実際の値はサブレベル内の `DungeonSubLevelScriptActor` で設定し、Build を実行して同期させます。 +- ランダム枠の抽選回数を `DungeonRoomLocatorMaxDrawCount` で制御し、出現率を調整します。 + +## UPROPERTY の意味 +- **GridSize / VerticalGridSize (`float`, VisibleAnywhere/BlueprintReadOnly)** + サブレベルが想定するグリッド寸法の表示欄です。SubLevelScriptActor の `GridSize` と合わせることで、メッシュやコリジョンが本体のダンジョンとズレないようにします。 +- **StartRoom (`FDungeonRoomRegister`, EditAnywhere)** + スタート部屋として強制配置するサブレベル。LevelPath が空なら自動生成の部屋が使われます。チュートリアルや安全地帯を決めたいときに指定します。 +- **GoalRoom (`FDungeonRoomRegister`, EditAnywhere)** + ゴール部屋として強制配置するサブレベル。出口やボス部屋を明示したい場合に設定します。こちらも LevelPath 未設定なら自動生成にフォールバックします。 +- **DungeonRoomRegister (`TArray`, EditAnywhere, DisplayName="Preferred Sublevel")** + 置きたいサブレベルの優先リスト。登録した順や抽選ルールに従って配置されます。必ず置きたい特別部屋を並べるのに適しています。 +- **DungeonRoomLocator (`TArray`, EditAnywhere, DisplayName="Random Sublevel")** + ランダムに抽選して配置するサブレベル群。各要素には識別子や重み付けを設定できます。多すぎる場合は `DungeonRoomLocatorMaxDrawCount` で抽選回数を制限してください。 +- **DungeonRoomLocatorMaxDrawCount (`int32`, EditAnywhere, ClampMin=0, DisplayName="Random Sublevel Draw Count")** + ランダム枠から抽選する最大回数。0 ならすべてのランダム候補を抽選します。値を絞れば「たまに出る特別部屋」を演出しやすくなります。 + +## 編集のヒント +- サブレベルのサイズや入口位置が本体のグリッドに合っているか、Build 後にプレビューで確認してください。 +- Start/Goal を空にすると自動生成の部屋に置き換わるため、まずは空のままテストしてから必要なサブレベルを順次差し込むとデバッグしやすいです。 + diff --git a/DungeonGenerator.uplugin b/DungeonGenerator.uplugin index e7743f7..3b653de 100644 --- a/DungeonGenerator.uplugin +++ b/DungeonGenerator.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, - "Version": 62, - "VersionName": "1.7.9", + "Version": 63, + "VersionName": "1.8.0", "FriendlyName": "Dungeon Generator", "Description": "Procedural 3d dungeon generator plugin. Easy generation of levels, mini-maps and missions.", "Category": "Procedural Systems", diff --git a/README.md b/README.md index df8a04a..4ceaa6c 100644 --- a/README.md +++ b/README.md @@ -98,3 +98,4 @@ Please visit our website for full feature list: [https://happy-game-dev.undo.jp/ * Shun Moriya ([X.com](https://x.com/monjiro1972)) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/M4M413XDXB) + diff --git a/Source/DungeonGenerator/Private/Core/Debug/BuildInformation.h b/Source/DungeonGenerator/Private/Core/Debug/BuildInformation.h index 83c9441..4d5e4e2 100644 --- a/Source/DungeonGenerator/Private/Core/Debug/BuildInformation.h +++ b/Source/DungeonGenerator/Private/Core/Debug/BuildInformation.h @@ -1,8 +1,8 @@ /* This is automatically generated file. DO NOT EDIT THIS FILE. -@author Shun Moriya -@copyright 2023- Shun Moriya +\author Shun Moriya +\copyright 2023- Shun Moriya All Rights Reserved. */ #pragma once @@ -16,7 +16,7 @@ All Rights Reserved. #define JENKINS_JOB_TAG "UNDEFINED JOB TAG" #define JENKINS_GIT_BRANCH "UNDEFINED BRANCH" #define JENKINS_GIT_COMMIT "UNDEFINED COMMIT" -#define JENKINS_UUID "3da61b40-1fba-7757-b07f-110de2a901e3" +#define JENKINS_UUID "1b3ed840-e1e3-f8c9-804a-8fc4985dc211" #define JENKINS_LICENSE "GPL v3" #define JENKINS_FOR_DEVELOP 1 #define JENKINS_FOR_RELEASE 0 diff --git a/Source/DungeonGenerator/Private/Core/Debug/Config.h b/Source/DungeonGenerator/Private/Core/Debug/Config.h index 871defa..8955fb4 100644 --- a/Source/DungeonGenerator/Private/Core/Debug/Config.h +++ b/Source/DungeonGenerator/Private/Core/Debug/Config.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "BuildInformation.h" diff --git a/Source/DungeonGenerator/Private/Core/Debug/Debug.cpp b/Source/DungeonGenerator/Private/Core/Debug/Debug.cpp index b7eeae8..d647702 100644 --- a/Source/DungeonGenerator/Private/Core/Debug/Debug.cpp +++ b/Source/DungeonGenerator/Private/Core/Debug/Debug.cpp @@ -1,13 +1,13 @@ /** -Debug function source files - -To prevent conflicts with other Windows macros, -do not include this file from the header. - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * Debug function source files + * + * To prevent conflicts with other Windows macros, + * do not include this file from the header. + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Debug.h" #include @@ -28,10 +28,10 @@ namespace dungeon #if UE_BUILD_DEBUG + UE_BUILD_DEVELOPMENT + UE_BUILD_TEST + UE_BUILD_SHIPPING == 0 #if defined(_WINDOWS) && (defined(_DEBUG) || defined(DEBUG)) /** - Output to VisualStudio output window - Assumed to be included only from source files, - so static functions are fine. - */ + * Output to VisualStudio output window + * Assumed to be included only from source files, + * so static functions are fine. + */ extern void OutputDebugStringWithArgument(const char* pszFormat, ...) { va_list argp; diff --git a/Source/DungeonGenerator/Private/Core/Debug/Debug.h b/Source/DungeonGenerator/Private/Core/Debug/Debug.h index dfed2b2..2b937c4 100644 --- a/Source/DungeonGenerator/Private/Core/Debug/Debug.h +++ b/Source/DungeonGenerator/Private/Core/Debug/Debug.h @@ -1,14 +1,13 @@ /** -@brief Debug function header files - -To prevent conflicts with other Windows macros, -do not include this file from the header. - -@file Debug.h -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * Debug function header files + * + * To prevent conflicts with other Windows macros, + * do not include this file from the header. + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -56,11 +55,11 @@ namespace dungeon { static constexpr auto BaseDirectoryName = TEXT("DungeonGenerator"); - /*! - Output to VisualStudio output window - Assumed to be included only from source files, so static functions are fine. - */ - extern void OutputDebugStringWithArgument(const char* pszFormat, ...); +/** + * Output to VisualStudio output window + * Assumed to be included only from source files, so static functions are fine. + */ +extern void OutputDebugStringWithArgument(const char* pszFormat, ...); extern const FString& GetBaseDirectoryName(); @@ -110,8 +109,8 @@ namespace dungeon #pragma pack() /** - @brief Windows Bitmap canvas class - */ + * @brief Windows Bitmap canvas class + */ class Canvas final { public: diff --git a/Source/DungeonGenerator/Private/Core/GenerateParameter.h b/Source/DungeonGenerator/Private/Core/GenerateParameter.h index 0e1813b..fc89cdb 100644 --- a/Source/DungeonGenerator/Private/Core/GenerateParameter.h +++ b/Source/DungeonGenerator/Private/Core/GenerateParameter.h @@ -1,12 +1,13 @@ /** -ダンジョン生成パラメータに関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ダンジョン生成パラメータに関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once +#include "PathGeneration/StartLocationPolicy.h" #include #include @@ -15,80 +16,124 @@ namespace dungeon class Random; /** - デフォルトダンジョン生成パラメータクラス - */ + * Dungeon expansion policy + * + * ダンジョンの拡張ポリシー + * DungeonExpansionPolicyと同じ意味にして下さい + */ + enum class ExpansionPolicy : uint8_t + { + Flat, // 平面方向にのみ広がる + ExpandHorizontally, // 水平方向に広がる + ExpandVertically, // 垂直方向に広がる + ExpandAnyDirection, // 制限なく広がる + }; + + /** + * デフォルトダンジョン生成パラメータクラス + */ struct GenerateParameter final { public: /** - コンストラクタ - */ + * コンストラクタ + */ GenerateParameter(); /** - デストラクタ - */ + * デストラクタ + */ ~GenerateParameter() = default; /** - ダンジョンの階層の候補 - 部屋の初期生成数であり、最終的に生成される階層の数ではありません。 - */ + * ダンジョンの拡張ポリシーを取得します + */ + ExpansionPolicy GetExpansionPolicy() const noexcept; + + /** + * ダンジョンの拡張ポリシーを設定します + */ + void SetExpansionPolicy(const ExpansionPolicy policy) noexcept; + + /** + * スタート位置のポリシーを取得します + */ + StartLocationPolicy GetStartLocationPolicy() const noexcept; + + /** + * スタート位置のポリシーを設定します + */ + void SetStartLocationPolicy(const StartLocationPolicy startLocationPolicy) noexcept; + + /** + * スタート部屋の数を取得します + */ + uint8_t GetStartRoomCount() const noexcept; + + /** + * スタート部屋の数を設定します + */ + void SetStartRoomCount(const uint8_t count) noexcept; + + /** + * ダンジョンの階層の候補 + * 部屋の初期生成数であり、最終的に生成される階層の数ではありません。 + */ uint8_t GetNumberOfCandidateFloors() const noexcept; void SetNumberOfCandidateFloors(const uint8_t count) noexcept; /** - 生成する部屋の数の候補 - 部屋の初期生成数であり、最終的に生成される部屋の数ではありません。 - */ + * 生成する部屋の数の候補 + * 部屋の初期生成数であり、最終的に生成される部屋の数ではありません。 + */ uint8_t GetNumberOfCandidateRooms() const noexcept; void SetNumberOfCandidateRooms(const uint8_t count) noexcept; /** - 部屋の最小の幅 - */ + * 部屋の最小の幅 + */ uint32_t GetMinRoomWidth() const noexcept; void SetMinRoomWidth(const uint32_t width) noexcept; /** - 部屋の最大の幅 - */ + * 部屋の最大の幅 + */ uint32_t GetMaxRoomWidth() const noexcept; void SetMaxRoomWidth(const uint32_t width) noexcept; /** - 部屋の最小の奥行き - */ + * 部屋の最小の奥行き + */ uint32_t GetMinRoomDepth() const noexcept; void SetMinRoomDepth(const uint32_t depth) noexcept; /** - 部屋の最大の奥行き - */ + * 部屋の最大の奥行き + */ uint32_t GetMaxRoomDepth() const noexcept; void SetMaxRoomDepth(const uint32_t depth) noexcept; /** - 部屋の最小の高さ - */ + * 部屋の最小の高さ + */ uint32_t GetMinRoomHeight() const noexcept; void SetMinRoomHeight(const uint32_t height) noexcept; /** - 部屋の最大の高さ - */ + * 部屋の最大の高さ + */ uint32_t GetMaxRoomHeight() const noexcept; void SetMaxRoomHeight(const uint32_t height) noexcept; /** - 部屋と部屋の水平方向の余白 - */ + * 部屋と部屋の水平方向の余白 + */ uint32_t GetHorizontalRoomMargin() const noexcept; void SetHorizontalRoomMargin(const uint32_t margin) noexcept; /** - 部屋と部屋の垂直方向の余白 - */ + * 部屋と部屋の垂直方向の余白 + */ uint32_t GetVerticalRoomMargin() const noexcept; void SetVerticalRoomMargin(const uint32_t margin) noexcept; @@ -99,46 +144,46 @@ namespace dungeon void SetMergeRooms(const bool mergeRooms) noexcept; /** - 乱数発生 - */ + * 乱数発生 + */ std::shared_ptr GetRandom() noexcept; /** - 乱数発生 - */ + * 乱数発生 + */ std::shared_ptr GetRandom() const noexcept; /** - ダンジョンの幅 - */ + * ダンジョンの幅 + */ uint32_t GetWidth() const noexcept; /** - ダンジョンの幅 - */ + * ダンジョンの幅 + */ void SetWidth(const uint32_t width) noexcept; /** - ダンジョンの奥行き - */ + * ダンジョンの奥行き + */ uint32_t GetDepth() const noexcept; /** - ダンジョンの奥行き - */ + * ダンジョンの奥行き + */ void SetDepth(const uint32_t depth) noexcept; /** - ダンジョンの高さ - */ + * ダンジョンの高さ + */ uint32_t GetHeight() const noexcept; /** - ダンジョンの高さ - */ + * ダンジョンの高さ + */ void SetHeight(const uint32_t height) noexcept; bool IsGenerateStartRoomReserved() const noexcept; @@ -189,48 +234,52 @@ namespace dungeon private: /** - ダンジョンの幅 - */ + * ダンジョンの幅 + */ uint32_t mWidth = 0; /** - ダンジョンの奥行き - */ + * ダンジョンの奥行き + */ uint32_t mDepth = 0; /** - ダンジョンの高さ - */ + * ダンジョンの高さ + */ uint32_t mHeight = 0; + ExpansionPolicy mDungeonExpansionPolicy = ExpansionPolicy::ExpandHorizontally; + StartLocationPolicy mStartLocationPolicy = StartLocationPolicy::UseSouthernMost; + uint8_t mStartRoomCount = 1; + /** - 生成する階層の数の候補 - 最終的に生成される階層の数ではありません。 - */ + * 生成する階層の数の候補 + * 最終的に生成される階層の数ではありません。 + */ uint8_t mNumberOfCandidateFloors = 0; /** - 生成する部屋の数の候補 - 部屋の初期生成数であり、最終的に生成される部屋の数ではありません。 - */ + * 生成する部屋の数の候補 + * 部屋の初期生成数であり、最終的に生成される部屋の数ではありません。 + */ uint8_t mNumberOfCandidateRooms = 1; /** - Horizontal room-to-room coupling - - 有効にすると部屋と部屋を結合します - */ + * Horizontal room-to-room coupling + * + * 有効にすると部屋と部屋を結合します + */ bool mMergeRooms = false; /** - MissionGraphを有効化 - */ + * MissionGraphを有効化 + */ bool mUseMissionGraph = true; /** - 通路の複雑さ(追加する通路の数) - Aisle complexity (0 being the minimum aisle) - */ + * 通路の複雑さ(追加する通路の数) + * Aisle complexity (0 being the minimum aisle) + */ uint8_t mAisleComplexity = 0; /** @@ -244,58 +293,58 @@ namespace dungeon bool mGenerateStructuralColumn = true; /** - 部屋の最小の幅 - */ + * 部屋の最小の幅 + */ uint32_t mMinRoomWidth = 0; /** - 部屋の最大の幅 - */ + * 部屋の最大の幅 + */ uint32_t mMaxRoomWidth = 0; /** - 部屋の最小の奥行き - */ + * 部屋の最小の奥行き + */ uint32_t mMinRoomDepth = 0; /** - 部屋の最大の奥行き - */ + * 部屋の最大の奥行き + */ uint32_t mMaxRoomDepth = 0; /** - 部屋の最小の高さ - */ + * 部屋の最小の高さ + */ uint32_t mMinRoomHeight = 0; /** - 部屋の最大の高さ - */ + * 部屋の最大の高さ + */ uint32_t mMaxRoomHeight = 0; /** - 部屋と部屋の水平方向の余白 - */ + * 部屋と部屋の水平方向の余白 + */ uint32_t mHorizontalRoomMargin = 0; /** - 部屋と部屋の垂直方向の余白 - */ + * 部屋と部屋の垂直方向の余白 + */ uint32_t mVerticalRoomMargin = 0; /** - 乱数生成器 - */ + * 乱数生成器 + */ std::shared_ptr mRandom; /** - スタート部屋のサイズ - */ + * スタート部屋のサイズ + */ FIntVector mStartRoomSize = { 0, 0, 0 }; /** - ゴール部屋のサイズ - */ + * ゴール部屋のサイズ + */ FIntVector mGoalRoomSize = { 0, 0, 0 }; }; } diff --git a/Source/DungeonGenerator/Private/Core/GenerateParameter.inl b/Source/DungeonGenerator/Private/Core/GenerateParameter.inl index 420ba2f..4ec3638 100644 --- a/Source/DungeonGenerator/Private/Core/GenerateParameter.inl +++ b/Source/DungeonGenerator/Private/Core/GenerateParameter.inl @@ -1,10 +1,10 @@ /** -ダンジョン生成パラメータに関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ダンジョン生成パラメータに関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Math/Random.h" @@ -18,6 +18,36 @@ namespace dungeon { } + inline ExpansionPolicy GenerateParameter::GetExpansionPolicy() const noexcept + { + return mDungeonExpansionPolicy; + } + + inline void GenerateParameter::SetExpansionPolicy(const ExpansionPolicy policy) noexcept + { + mDungeonExpansionPolicy = policy; + } + + inline StartLocationPolicy GenerateParameter::GetStartLocationPolicy() const noexcept + { + return mStartLocationPolicy; + } + + inline void GenerateParameter::SetStartLocationPolicy(const StartLocationPolicy startLocationPolicy) noexcept + { + mStartLocationPolicy = startLocationPolicy; + } + + inline uint8_t GenerateParameter::GetStartRoomCount() const noexcept + { + return mStartRoomCount; + } + + inline void GenerateParameter::SetStartRoomCount(const uint8_t count) noexcept + { + mStartRoomCount = std::max(count, 1); + } + inline uint8_t GenerateParameter::GetNumberOfCandidateFloors() const noexcept { return mNumberOfCandidateFloors; diff --git a/Source/DungeonGenerator/Private/Core/Generator.cpp b/Source/DungeonGenerator/Private/Core/Generator.cpp index a7d8946..76d02af 100644 --- a/Source/DungeonGenerator/Private/Core/Generator.cpp +++ b/Source/DungeonGenerator/Private/Core/Generator.cpp @@ -198,9 +198,9 @@ namespace dungeon } /* - 正規乱数 - https://ja.wikipedia.org/wiki/%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9%EF%BC%9D%E3%83%9F%E3%83%A5%E3%83%A9%E3%83%BC%E6%B3%95 - */ + * 正規乱数 + * https://ja.wikipedia.org/wiki/%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9%EF%BC%9D%E3%83%9F%E3%83%A5%E3%83%A9%E3%83%BC%E6%B3%95 + */ inline void NormalRandom(float& x, float& y, const std::shared_ptr& random) { const auto A = random->Get(); @@ -212,8 +212,8 @@ namespace dungeon } /** - mRoomsを生成します - */ + * mRoomsを生成します + */ bool Generator::GenerateRooms() noexcept { #if defined(DEBUG_ENABLE_MEASURE_GENERATION_TIME) @@ -229,20 +229,18 @@ namespace dungeon DUNGEON_GENERATOR_LOG(TEXT("Generate Rooms")); #endif + // ダンジョン全体のサイズを求める float radius = std::sqrtf(mGenerateParameter.GetNumberOfCandidateRooms()); - const float maxRoomWidth = std::max(mGenerateParameter.GetMaxRoomWidth(), mGenerateParameter.GetMaxRoomDepth()); + const float maxRoomWidth = std::min(mGenerateParameter.GetMinRoomWidth(), mGenerateParameter.GetMinRoomDepth()); radius *= maxRoomWidth + mGenerateParameter.GetHorizontalRoomMargin(); radius *= 0.5f; if (radius < 1.f) radius = 1.f; -#define USE_SIN_CURVE 1 - const float mapOffsetX = mGenerateParameter.GetRandom()->Get(dungeon::math::Pi2()); const float mapOffsetY = mGenerateParameter.GetRandom()->Get(dungeon::math::Pi2()); const float mapScaleX = mGenerateParameter.GetRandom()->Get(0.5f, 1.5f); const float mapScaleY = mGenerateParameter.GetRandom()->Get(0.5f, 1.5f); -#if USE_SIN_CURVE const auto getHeight = [mapOffsetX, mapOffsetY, mapScaleX, mapScaleY](const float x, const float y) -> float { const float tx = mapOffsetX + x * mapScaleX * dungeon::math::Pi2(); @@ -250,46 +248,28 @@ namespace dungeon const float noise = std::sin(tx) * std::sin(ty); return noise * 0.5f + 0.5f; }; -#else - PerlinNoise perlinNoise(mGenerateParameter.GetRandom()); - constexpr float noiseBoostRatio = 1.333f; - constexpr size_t octaves = 4; -#endif // Register Rooms for (size_t i = 0; i < mGenerateParameter.GetNumberOfCandidateRooms(); ++i) { float x, y; NormalRandom(x, y, mGenerateParameter.GetRandom()); - x = std::max(-1.f, std::min(x / 4.f, 1.f)); - y = std::max(-1.f, std::min(y / 4.f, 1.f)); -#if USE_SIN_CURVE - const float z = getHeight(x, y); - - FIntVector location( - static_cast(std::round(x * radius)), - static_cast(std::round(y * radius)), - static_cast(std::round(z * mGenerateParameter.GetNumberOfCandidateFloors())) - ); -#else - float noise = perlinNoise.OctaveNoise(octaves, x * 0.5, y * 0.5); - noise = noise * 0.5f + 0.5f; - noise *= noiseBoostRatio; - noise = std::max(0.f, std::min(noise, 1.f)); + x = std::max(-1.f, std::min(x / 4.f, 1.f)) * radius; + y = std::max(-1.f, std::min(y / 4.f, 1.f)) * radius; + const float z = getHeight(x, y) * mGenerateParameter.GetNumberOfCandidateFloors(); FIntVector location( - static_cast(std::round(x * radius)), - static_cast(std::round(y * radius)), - static_cast(std::round(noise * mGenerateParameter.GetNumberOfCandidateFloors())) + static_cast(std::round(x)), + static_cast(std::round(y)), + static_cast(std::round(z)) ); -#endif if (mGenerateParameter.GetHorizontalRoomMargin() == 0) { /* - RoomMarginが0の場合、部屋と部屋の間にスロープを作る隙間が無いので、 - 部屋の高さを必ず同じにする。 - */ + * RoomMarginが0の場合、部屋と部屋の間にスロープを作る隙間が無いので、 + * 部屋の高さを必ず同じにする。 + */ location.Z = 0; } @@ -305,12 +285,6 @@ namespace dungeon mRooms.emplace_back(std::move(room)); } -#if USE_SIN_CURVE == 0 & defined(DEBUG_GENERATE_BITMAP_FILE) - GenerateHeightImageForDebug(perlinNoise, octaves, noiseBoostRatio, "/debug/0_HeightMap.bmp"); - // 2_SeparateRooms_0.bmpと同様の内容になるのでコメントアウト - // GenerateRoomImageForDebug("/debug/1_GenerateRooms.bmp"); -#endif - #if defined(DEBUG_ENABLE_INFORMATION_FOR_REPLICATION) // 通信同期用に現在の乱数の種を出力する { @@ -324,8 +298,8 @@ namespace dungeon } /** - 部屋の重なりを解消します - */ + * 部屋の重なりを解消します + */ Generator::SeparateRoomsResult Generator::SeparateRooms(const size_t phase, const size_t subPhase) noexcept { #if defined(DEBUG_ENABLE_MEASURE_GENERATION_TIME) @@ -557,7 +531,18 @@ namespace dungeon else { const auto limit = std::sin(math::ToRadian(11.25)); - direction.Z = std::max(-limit, std::min(direction.Z, limit)); + if (mGenerateParameter.GetExpansionPolicy() == ExpansionPolicy::ExpandHorizontally) + { + // 展開を水平方向に制限 + direction.Z = std::max(-limit, std::min(direction.Z, limit)); + } + else if (mGenerateParameter.GetExpansionPolicy() == ExpansionPolicy::ExpandVertically) + { + // 展開を垂直方向に制限 + direction.X = std::max(-limit, std::min(direction.X, limit)); + direction.Y = std::max(-limit, std::min(direction.Y, limit)); + direction.Z = 1; + } } if (direction.Normalize() == false) { @@ -824,14 +809,26 @@ namespace dungeon #endif // 最小スパニングツリー - MinimumSpanningTree minimumSpanningTree(mGenerateParameter.GetRandom(), delaunayTriangulation, aisleComplexity); + MinimumSpanningTree minimumSpanningTree( + mGenerateParameter.GetRandom(), + delaunayTriangulation, + aisleComplexity, + mGenerateParameter.GetStartLocationPolicy(), + mGenerateParameter.GetStartRoomCount() + ); if (GenerateAisle(minimumSpanningTree) == false) return false; } else { // 最小スパニングツリー - MinimumSpanningTree minimumSpanningTree(mGenerateParameter.GetRandom(), points, aisleComplexity); + MinimumSpanningTree minimumSpanningTree( + mGenerateParameter.GetRandom(), + points, + aisleComplexity, + mGenerateParameter.GetStartLocationPolicy(), + mGenerateParameter.GetStartRoomCount() + ); if (GenerateAisle(minimumSpanningTree) == false) return false; } @@ -904,6 +901,31 @@ namespace dungeon } mStartRoom = mStartPoint->GetOwnerRoom(); + { + size_t startRoomCount = 0; + for (const auto& room : mRooms) + { + if (room->GetParts() == Room::Parts::Start) + ++startRoomCount; + } + + if (mGenerateParameter.GetStartLocationPolicy() == StartLocationPolicy::UseMultiStart) + { + const uint8_t expectedStartRoomCount = mGenerateParameter.GetStartRoomCount(); + if (startRoomCount != expectedStartRoomCount) + { + DUNGEON_GENERATOR_WARNING(TEXT("UseMultiStart expected %d start rooms but found %d."), expectedStartRoomCount, startRoomCount); + } + } + else + { + if (startRoomCount != 1) + { + DUNGEON_GENERATOR_WARNING(TEXT("Expected a single start room for this StartLocationPolicy, but found %d."), startRoomCount); + } + } + } + // ゴール位置を記録 mGoalPoint = minimumSpanningTree.GetGoalPoint(); if (mGoalPoint == nullptr) diff --git a/Source/DungeonGenerator/Private/Core/Generator.h b/Source/DungeonGenerator/Private/Core/Generator.h index 4d374db..bae7625 100644 --- a/Source/DungeonGenerator/Private/Core/Generator.h +++ b/Source/DungeonGenerator/Private/Core/Generator.h @@ -152,10 +152,10 @@ namespace dungeon const std::vector& GetFloorHeight() const; /** - 指定した座標が何階か検索します - @param[in] height ボクセル空間の高さ - @return 階層 - */ + * 指定した座標が何階か検索します + * @param[in] height ボクセル空間の高さ + * @return 階層 + */ size_t FindFloor(const int32_t height) const; public: diff --git a/Source/DungeonGenerator/Private/Core/Generator.inl b/Source/DungeonGenerator/Private/Core/Generator.inl index 6dcd182..3a729f1 100644 --- a/Source/DungeonGenerator/Private/Core/Generator.inl +++ b/Source/DungeonGenerator/Private/Core/Generator.inl @@ -1,10 +1,10 @@ /** -ダンジョン生成ヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ダンジョン生成ヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once diff --git a/Source/DungeonGenerator/Private/Core/Helper/Crc.h b/Source/DungeonGenerator/Private/Core/Helper/Crc.h index edd3823..b6402e0 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Crc.h +++ b/Source/DungeonGenerator/Private/Core/Helper/Crc.h @@ -1,10 +1,10 @@ /** -Helper function header file - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * Helper function header file + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once @@ -49,13 +49,13 @@ namespace dungeon }; } - /*! - Generate CRC32 - @param[in] text Pointer to text - @param[in] size Size of text - @param[in] hash Initial hash value - @return CRC32 - */ + /** + * Generate CRC32 + * @param[in] text Pointer to text + * @param[in] size Size of text + * @param[in] hash Initial hash value + * @return CRC32 + */ static constexpr uint32_t GenerateCrc32FromText(const char* text, const size_t size, uint32_t hash = 0xffffffffU) noexcept { for (size_t i = 0; i < size; ++i) @@ -66,13 +66,13 @@ namespace dungeon return hash ^ 0xffffffffU; } - /*! - Generate CRC32 - @param[in] data Pointer to data - @param[in] size Size of data - @param[in] hash Initial hash value - @return CRC32 - */ + /** + * Generate CRC32 + * @param[in] data Pointer to data + * @param[in] size Size of data + * @param[in] hash Initial hash value + * @return CRC32 + */ static constexpr uint32_t GenerateCrc32FromData(const void* data, const size_t size, uint32_t hash = 0xffffffffU) noexcept { return GenerateCrc32FromText(static_cast(data), size, hash); diff --git a/Source/DungeonGenerator/Private/Core/Helper/Direction.cpp b/Source/DungeonGenerator/Private/Core/Helper/Direction.cpp index 67bb97f..f03ec9d 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Direction.cpp +++ b/Source/DungeonGenerator/Private/Core/Helper/Direction.cpp @@ -1,10 +1,8 @@ /** -方向 - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Direction.h" @@ -13,9 +11,9 @@ namespace dungeon namespace detail { /** - 方向 - EDungeonDirection、Direction::IndexとPathFinder::SearchDirectionに並びを合わせて下さい - */ + * 方向 + * EDungeonDirection、Direction::IndexとPathFinder::SearchDirectionに並びを合わせて下さい + */ static const std::array Offsets = { { { 0, -1, 0 }, // 北 diff --git a/Source/DungeonGenerator/Private/Core/Helper/Direction.h b/Source/DungeonGenerator/Private/Core/Helper/Direction.h index 13768c5..c454e86 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Direction.h +++ b/Source/DungeonGenerator/Private/Core/Helper/Direction.h @@ -1,10 +1,8 @@ /** -方向 - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -16,16 +14,16 @@ namespace dungeon class Random; /** - 方向クラス - */ + * 方向クラス + */ class Direction final { public: /** - 方向の番号 - Grid::Attributeと並びを合わせて下さい - PathFinder::SearchDirectionと並びを合わせて下さい - */ + * 方向の番号 + * Grid::Attributeと並びを合わせて下さい + * PathFinder::SearchDirectionと並びを合わせて下さい + */ enum Index : uint8_t { North, @@ -36,120 +34,120 @@ namespace dungeon public: /** - コンストラクタ - @param[in] index 方向 - */ + * コンストラクタ + * @param[in] index 方向 + */ explicit Direction(const Index index = Index::North) noexcept; /** - コピーコンストラクタ - @param[in] other 方向 - */ + * コピーコンストラクタ + * @param[in] other 方向 + */ Direction(const Direction& other) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~Direction() = default; /** - 方向を取得します - @return 方向 - */ + * 方向を取得します + * @return 方向 + */ Index Get() const noexcept; /** - 方向を設定します - @param[in] index 方向 - */ + * 方向を設定します + * @param[in] index 方向 + */ void Set(const Index index) noexcept; /** - 方向を設定します - @param[in] index 方向 - */ + * 方向を設定します + * @param[in] index 方向 + */ Direction& operator=(const Index index) noexcept; /** - 方向を代入します - @param[in] other 代入するDirection - */ + * 方向を代入します + * @param[in] other 代入するDirection + */ Direction& operator=(const Direction& other) noexcept; /** - 一致 - */ + * 一致 + */ bool operator==(const Direction& other) const noexcept; /** - 不一致 - */ + * 不一致 + */ bool operator!=(const Direction& other) const noexcept; /** - 方向が南北に向いているか調べます - */ + * 方向が南北に向いているか調べます + */ bool IsNorthSouth() const noexcept; /** - 方向が南北に向いているか調べます - */ + * 方向が南北に向いているか調べます + */ static bool IsNorthSouth(const Index index) noexcept; /** - 角度を取得します - */ + * 角度を取得します + */ float ToDegree() const noexcept; /** - ラジアンを取得します - */ + * ラジアンを取得します + */ float ToRadian() const noexcept; /** - 方向を反対にします - @return 反対の方向 - */ + * 方向を反対にします + * @return 反対の方向 + */ Direction Inverse() const noexcept; /** - 方向を反対にします - */ + * 方向を反対にします + */ void SetInverse() noexcept; /** - ベクターを取得します - @return ベクター - */ + * ベクターを取得します + * @return ベクター + */ const FIntVector& GetVector() const noexcept; /** - ベクターを取得します - @param[in] index 方向 - @return ベクター - */ + * ベクターを取得します + * @param[in] index 方向 + * @return ベクター + */ static const FIntVector& GetVector(const Index index) noexcept; /** - ベクター一覧の開始イテレーターを取得します - */ + * ベクター一覧の開始イテレーターを取得します + */ static std::array::const_iterator Begin() noexcept; /** - ベクター一覧の終了イテレーターを取得します - */ + * ベクター一覧の終了イテレーターを取得します + */ static std::array::const_iterator End() noexcept; /** - ランダムな方向を取得します - @return ランダムな方向 - */ + * ランダムな方向を取得します + * @return ランダムな方向 + */ static Direction CreateFromRandom(const std::shared_ptr& random) noexcept; #if WITH_EDITOR /** - 方向名を取得します - */ + * 方向名を取得します + */ const FString& GetName() const noexcept; #endif diff --git a/Source/DungeonGenerator/Private/Core/Helper/Direction.inl b/Source/DungeonGenerator/Private/Core/Helper/Direction.inl index b94c07d..2256c6a 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Direction.inl +++ b/Source/DungeonGenerator/Private/Core/Helper/Direction.inl @@ -1,10 +1,8 @@ /** -方向 - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Math/Random.h" diff --git a/Source/DungeonGenerator/Private/Core/Helper/DrawLots.h b/Source/DungeonGenerator/Private/Core/Helper/DrawLots.h index 276dd22..f312de1 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/DrawLots.h +++ b/Source/DungeonGenerator/Private/Core/Helper/DrawLots.h @@ -1,10 +1,8 @@ -/* -抽選に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ +/** + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Math/Random.h" diff --git a/Source/DungeonGenerator/Private/Core/Helper/Finalizer.h b/Source/DungeonGenerator/Private/Core/Helper/Finalizer.h index a97b101..7bd1b0d 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Finalizer.h +++ b/Source/DungeonGenerator/Private/Core/Helper/Finalizer.h @@ -1,9 +1,8 @@ -/*! -@file Finalizer.h -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ +/** + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "NonCopyable.h" @@ -11,14 +10,33 @@ All Rights Reserved. namespace dungeon { + /** + * スコープ終了時に自動的にクリーンアップ処理を実行するクラス + * @tparam Callable 呼び出し可能オブジェクト(関数ポインタ、ラムダ、関数オブジェクト等) + * + * このクラスは RAII の原則に従い、以下の特性を持ちます。 + * - コンストラクタで渡された function が保持され、デストラクタで 1 回だけ呼び出される。 + * - コピーは 禁止(二重実行を防止)。ムーブは許可し、所有権を安全に移譲できる。 + * - 例外が送出されてもデストラクタは確実に呼び出される(例外安全)。 + * + * @note C++ の標準ライブラリにも `std::unique_ptr` のデリータや + * `std::lock_guard` のような RAII 用ユーティリティが多数ありますが、 + * 任意の任務をシンプルにラップしたいときに `Finalizer` が便利です。 + */ class Finalizer final : NonCopyable { public: + /** + * コンストラクタ + */ explicit Finalizer(const std::function& function) : mFunction(function) { } + /** + * デストラクタ + */ ~Finalizer() { mFunction(); diff --git a/Source/DungeonGenerator/Private/Core/Helper/Identifier.cpp b/Source/DungeonGenerator/Private/Core/Helper/Identifier.cpp index d432f95..8f8992a 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Identifier.cpp +++ b/Source/DungeonGenerator/Private/Core/Helper/Identifier.cpp @@ -1,10 +1,10 @@ /** -識別子クラスソースファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 識別子クラスソースファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Identifier.h" diff --git a/Source/DungeonGenerator/Private/Core/Helper/Identifier.h b/Source/DungeonGenerator/Private/Core/Helper/Identifier.h index 03a20e4..c4aee60 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Identifier.h +++ b/Source/DungeonGenerator/Private/Core/Helper/Identifier.h @@ -1,29 +1,31 @@ /** -識別子クラスヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 識別子クラスヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include +#include namespace dungeon { /** - 識別子クラス - */ + * 識別子クラス + */ class Identifier final { public: - //! 識別子の型 + /** + * 識別子の型 + */ using IdentifierType = uint16_t; - public: /** - 識別子のタイプ - */ + * 識別子のタイプ + */ enum class Type : uint8_t { Unknown = 0, @@ -31,7 +33,6 @@ namespace dungeon Aisle }; - public: Identifier() noexcept; explicit Identifier(const Type type) noexcept; explicit Identifier(const IdentifierType other) noexcept; @@ -65,6 +66,23 @@ namespace dungeon static constexpr uint8_t Shift = sizeof(mIdentifier) * 8 - BitCount; static constexpr IdentifierType MaskCounter = static_cast(~0) >> BitCount; static IdentifierType mCounter; + + friend struct std::hash; + }; +} + +namespace std +{ + /*! + * ハッシュ関数 + */ + template<> + struct hash + { + size_t operator()(const dungeon::Identifier& identifier) const noexcept + { + return identifier.mIdentifier; + } }; } diff --git a/Source/DungeonGenerator/Private/Core/Helper/Identifier.inl b/Source/DungeonGenerator/Private/Core/Helper/Identifier.inl index e40cde6..88573d4 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Identifier.inl +++ b/Source/DungeonGenerator/Private/Core/Helper/Identifier.inl @@ -1,11 +1,11 @@ /** -識別子クラスヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 識別子クラスヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include diff --git a/Source/DungeonGenerator/Private/Core/Helper/NonCopyable.h b/Source/DungeonGenerator/Private/Core/Helper/NonCopyable.h index 8632dd5..4fbb109 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/NonCopyable.h +++ b/Source/DungeonGenerator/Private/Core/Helper/NonCopyable.h @@ -1,19 +1,19 @@ -/*! -@file NonCopyable.h -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ +/** + * @file NonCopyable.h + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once namespace dungeon { - /*! - Copy prohibited Mix-in - Be sure to inherit by private inheritance. - */ - class NonCopyable +/** + * Copy prohibited Mix-in + * Be sure to inherit by private inheritance. + */ +class NonCopyable { protected: NonCopyable() = default; diff --git a/Source/DungeonGenerator/Private/Core/Helper/Stopwatch.h b/Source/DungeonGenerator/Private/Core/Helper/Stopwatch.h index fb7156d..60351b2 100644 --- a/Source/DungeonGenerator/Private/Core/Helper/Stopwatch.h +++ b/Source/DungeonGenerator/Private/Core/Helper/Stopwatch.h @@ -1,11 +1,10 @@ /** -@brief Stopwatch class header files - -@file Stopwatch.h -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * Stopwatch class header files + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include diff --git a/Source/DungeonGenerator/Private/Core/Math/Circle.h b/Source/DungeonGenerator/Private/Core/Math/Circle.h index d969cba..a4d4e70 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Circle.h +++ b/Source/DungeonGenerator/Private/Core/Math/Circle.h @@ -1,11 +1,11 @@ /** -球に関するヘッダーファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 球に関するヘッダーファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -13,8 +13,8 @@ All Rights Reserved. namespace dungeon { /** - 球クラス - */ + * 球クラス + */ struct Circle { FVector mCenter; diff --git a/Source/DungeonGenerator/Private/Core/Math/Math.h b/Source/DungeonGenerator/Private/Core/Math/Math.h index d178f97..af960a1 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Math.h +++ b/Source/DungeonGenerator/Private/Core/Math/Math.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -93,10 +93,10 @@ namespace dungeon } /** - 角度を0~360に収めます - \param[in] degree 角度 - \return 0~360 - */ + * 角度を0~360に収めます + * \param[in] degree 角度 + * \return 0~360 + */ template static constexpr T RoundDegree(const T degree) { @@ -108,10 +108,10 @@ namespace dungeon } /** - ラジアン角を0~2πに収めます - \param[in] radian ラジアン角 - \return 0~2π - */ + * ラジアン角を0~2πに収めます + * \param[in] radian ラジアン角 + * \return 0~2π + */ template static constexpr T RoundRadian(const T radian) { @@ -123,10 +123,10 @@ namespace dungeon } /** - 角度を-180~180に収めます - \param[in] degree 角度 - \return -180~180 - */ + * 角度を-180~180に収めます + * \param[in] degree 角度 + * \return -180~180 + */ template static constexpr T RoundDegreeWithSign(const T degree) { @@ -138,10 +138,10 @@ namespace dungeon } /** - ラジアン角を-π~πに収めます - \param[in] radian ラジアン角 - \return -π~π - */ + * ラジアン角を-π~πに収めます + * \param[in] radian ラジアン角 + * \return -π~π + */ template static constexpr T RoundRadianWithSign(const T radian) { @@ -153,11 +153,11 @@ namespace dungeon } /** - 角度の距離を取得します - \param[in] a 角度 - \param[in] b 角度 - \return 絶対差 - */ + * 角度の距離を取得します + * \param[in] a 角度 + * \param[in] b 角度 + * \return 絶対差 + */ template static constexpr T DegreeDistance(const T a, const T b) { @@ -165,11 +165,11 @@ namespace dungeon } /** - ラジアン角の距離を取得します - \param[in] a ラジアン角 - \param[in] b ラジアン角 - \return 絶対差 - */ + * ラジアン角の距離を取得します + * \param[in] a ラジアン角 + * \param[in] b ラジアン角 + * \return 絶対差 + */ template static constexpr T RadianDistance(const T a, const T b) { diff --git a/Source/DungeonGenerator/Private/Core/Math/PerlinNoise.cpp b/Source/DungeonGenerator/Private/Core/Math/PerlinNoise.cpp index 6db19aa..0d956ca 100644 --- a/Source/DungeonGenerator/Private/Core/Math/PerlinNoise.cpp +++ b/Source/DungeonGenerator/Private/Core/Math/PerlinNoise.cpp @@ -1,10 +1,10 @@ /** -パーリンノイズに関するソースファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * パーリンノイズに関するソースファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "PerlinNoise.h" #include "Random.h" diff --git a/Source/DungeonGenerator/Private/Core/Math/Plane.h b/Source/DungeonGenerator/Private/Core/Math/Plane.h index 117840c..5edc08a 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Plane.h +++ b/Source/DungeonGenerator/Private/Core/Math/Plane.h @@ -1,10 +1,10 @@ /** -平面に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 平面に関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -12,8 +12,8 @@ All Rights Reserved. namespace dungeon { /** - 平面クラス - */ + * 平面クラス + */ class Plane final { public: diff --git a/Source/DungeonGenerator/Private/Core/Math/Plane.inl b/Source/DungeonGenerator/Private/Core/Math/Plane.inl index 7d9be9f..e7f1466 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Plane.inl +++ b/Source/DungeonGenerator/Private/Core/Math/Plane.inl @@ -1,10 +1,10 @@ /** -平面に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 平面に関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Math.h" diff --git a/Source/DungeonGenerator/Private/Core/Math/Point.cpp b/Source/DungeonGenerator/Private/Core/Math/Point.cpp index c26eb39..9c00269 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Point.cpp +++ b/Source/DungeonGenerator/Private/Core/Math/Point.cpp @@ -1,10 +1,10 @@ /** -点に関するソースファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 点に関するソースファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Point.h" #include "Math.h" diff --git a/Source/DungeonGenerator/Private/Core/Math/Point.h b/Source/DungeonGenerator/Private/Core/Math/Point.h index 3e7147b..7b00607 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Point.h +++ b/Source/DungeonGenerator/Private/Core/Math/Point.h @@ -1,10 +1,10 @@ /** -点に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 点に関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -16,9 +16,9 @@ namespace dungeon class Room; /** - 点クラス - FVectorに所属する部屋への参照を持っています - */ + * 点クラス + * FVectorに所属する部屋への参照を持っています + */ class Point final : public FVector { public: @@ -26,96 +26,96 @@ namespace dungeon public: /** - コンストラクタ - */ + * コンストラクタ + */ Point() noexcept; /** - コンストラクタ - - @param[in] x X座標 - @param[in] y Y座標 - @param[in] z Z座標 - */ + * コンストラクタ + * + * @param[in] x X座標 + * @param[in] y Y座標 + * @param[in] z Z座標 + */ Point(const double x, const double y, const double z) noexcept; /** - コンストラクタ - @param[in] vector 三次元ベクター - */ + * コンストラクタ + * @param[in] vector 三次元ベクター + */ explicit Point(const FVector& vector) noexcept; /** - コンストラクタ - @param[in] room 所属する部屋 - */ + * コンストラクタ + * @param[in] room 所属する部屋 + */ explicit Point(const std::shared_ptr& room) noexcept; /** - コピーコンストラクタ - @param[in] other Point - */ + * コピーコンストラクタ + * @param[in] other Point + */ explicit Point(const Point& other) noexcept; /** - ムーブコンストラクタ - @param[in] other Point - */ + * ムーブコンストラクタ + * @param[in] other Point + */ Point(Point&& other) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~Point() = default; /** - コピー代入 - @param[in] other 代入する点 - */ + * コピー代入 + * @param[in] other 代入する点 + */ Point& operator=(const Point& other) noexcept; /** - ムーブ代入 - @param[in] other 代入する点 - */ + * ムーブ代入 + * @param[in] other 代入する点 + */ Point& operator=(Point&& other) noexcept; /** - 点が等しいか判定します - @param[in] other 比較する点 - @return trueならば等しい - */ + * 点が等しいか判定します + * @param[in] other 比較する点 + * @return trueならば等しい + */ bool operator==(const Point& other) const noexcept; /** - オーナーの部屋の中心にリセットします - */ + * オーナーの部屋の中心にリセットします + */ void ResetByRoomGroundCenter() noexcept; /** - 2点間の距離を求めます - @param[in] v0 点0 - @param[in] v1 点1 - @return 2点間の距離 - */ + * 2点間の距離を求めます + * @param[in] v0 点0 + * @param[in] v1 点1 + * @return 2点間の距離 + */ static double Dist(const Point& v0, const Point& v1) noexcept; /** - 2点間の距離の二乗を求めます - @param[in] v0 点0 - @param[in] v1 点1 - @return 2点間の距離の二乗 - */ + * 2点間の距離の二乗を求めます + * @param[in] v0 点0 + * @param[in] v1 点1 + * @return 2点間の距離の二乗 + */ static double DistSquared(const Point& v0, const Point& v1) noexcept; /** - 所属する部屋オブジェクトを取得します - */ + * 所属する部屋オブジェクトを取得します + */ const std::shared_ptr& GetOwnerRoom() const noexcept; /** - 所属する部屋オブジェクトを取得します - */ + * 所属する部屋オブジェクトを取得します + */ void SetOwnerRoom(const std::shared_ptr& room) noexcept; diff --git a/Source/DungeonGenerator/Private/Core/Math/Random.h b/Source/DungeonGenerator/Private/Core/Math/Random.h index 56881bb..e8b0e86 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Random.h +++ b/Source/DungeonGenerator/Private/Core/Math/Random.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once @@ -16,91 +16,91 @@ namespace dungeon Random(); /** - Constructor - @param[in] seed 乱数の種 - */ + * Constructor + * @param[in] seed 乱数の種 + */ explicit Random(const uint32_t seed); /** - copy constructor - */ + * copy constructor + */ explicit Random(const Random& other); /** - move constructor - */ + * move constructor + */ explicit Random(Random&& other) noexcept; /** - copy assignment - */ + * copy assignment + */ Random& operator = (const Random& other); /** - move assignment - */ + * move assignment + */ Random& operator = (Random&& other) noexcept; /** - Set the random number seed - @param[in] seed Random number seeds - */ + * Set the random number seed + * @param[in] seed Random number seeds + */ void SetSeed(const uint32_t seed); /** - @return -1 or 1 - T must be a signed type. - */ + * @return -1 or 1 + * T must be a signed type. + */ template T GetSign(); /** - Get a random number - @return Returns the range [type_min,type_max) if T is an integer, - or [0,1] with equal probability if T is a real number. - */ + * Get a random number + * @return Returns the range [type_min,type_max) if T is an integer, + * or [0,1] with equal probability if T is a real number. + */ template T Get(); /** - Get a random number - @param[in] to Upper value - @return Returns the range [0,to) if T is an integer, - or [0,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] to Upper value + * @return Returns the range [0,to) if T is an integer, + * or [0,to] with equal probability if T is a real number. + */ template T Get(const T to); /** - Get a random number - @param[in] from Lower value - @param[in] to Upper value - @return Returns the range [from,to) if T is an integer, - or [from,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] from Lower value + * @param[in] to Upper value + * @return Returns the range [from,to) if T is an integer, + * or [from,to] with equal probability if T is a real number. + */ template T Get(const T from, const T to); /** - Get the random number seed - @param[out] x Random number seeds - @param[out] y Random number seeds - @param[out] z Random number seeds - @param[out] w Random number seeds - */ + * Get the random number seed + * @param[out] x Random number seeds + * @param[out] y Random number seeds + * @param[out] z Random number seeds + * @param[out] w Random number seeds + */ void GetSeeds(uint32_t& x, uint32_t& y, uint32_t& z, uint32_t& w) const noexcept; private: /** - Get a random number of type uint32_t - @return Returns a range of [0,std::numeric_limits::max) - */ + * Get a random number of type uint32_t + * @return Returns a range of [0,std::numeric_limits::max) + */ uint32_t GetU32(); - /*! - Get a random number of type uint64_t - @return Returns a range of [0,std::numeric_limits::max) - */ + /** + * Get a random number of type uint64_t + * @return Returns a range of [0,std::numeric_limits::max) + */ uint64_t GetU64(); private: diff --git a/Source/DungeonGenerator/Private/Core/Math/Random.inl b/Source/DungeonGenerator/Private/Core/Math/Random.inl index e734586..6bb5a68 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Random.inl +++ b/Source/DungeonGenerator/Private/Core/Math/Random.inl @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include diff --git a/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.cpp b/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.cpp index f92e74d..b4ebeea 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.cpp +++ b/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.cpp @@ -1,11 +1,11 @@ /** -四面体 ソースファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 四面体 ソースファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Tetrahedron.h" #include "Math.h" @@ -14,8 +14,8 @@ All Rights Reserved. namespace dungeon { /** - 他の四面体と共有点を持つか - */ + * 他の四面体と共有点を持つか + */ bool Tetrahedron::HasCommonPoints(const Tetrahedron& t) const noexcept { return std::any_of(mPoints.begin(), mPoints.end(), [&t](const auto& sp) diff --git a/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.h b/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.h index b319db4..e70d630 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.h +++ b/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.h @@ -1,11 +1,11 @@ /** -四面体 ヘッダーファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 四面体 ヘッダーファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Circle.h" @@ -17,8 +17,8 @@ namespace dungeon class Point; /** - 四面体クラス - */ + * 四面体クラス + */ class Tetrahedron final { public: @@ -26,23 +26,23 @@ namespace dungeon public: /** - コンストラクタ - */ + * コンストラクタ + */ Tetrahedron() = default; /** - コンストラクタ - */ + * コンストラクタ + */ Tetrahedron(const std::shared_ptr& p0, const std::shared_ptr& p1, const std::shared_ptr& p2, const std::shared_ptr& p3) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~Tetrahedron() = default; /** - 他の四面体と共有点を持つか - */ + * 他の四面体と共有点を持つか + */ bool HasCommonPoints(const Tetrahedron& t) const noexcept; /* @@ -51,29 +51,29 @@ namespace dungeon Circle GetCircumscribedSphere() const noexcept; /** - 値のハッシュ値を取得します - @return 値のハッシュ値 - */ + * 値のハッシュ値を取得します + * @return 値のハッシュ値 + */ uint32_t GetHash() const noexcept; /** - 等価性の判定 - */ + * 等価性の判定 + */ bool operator==(const Tetrahedron& t) const noexcept; /** - 等価性の判定 - */ + * 等価性の判定 + */ bool operator!=(const Tetrahedron& t) const noexcept; /** - 等価性の判定 - */ + * 等価性の判定 + */ bool operator<(const Tetrahedron& t) const noexcept; /** - 頂点を取得します - */ + * 頂点を取得します + */ const std::shared_ptr& operator[](const size_t index) const noexcept; private: diff --git a/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.inl b/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.inl index 9b9617c..b5c1c66 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.inl +++ b/Source/DungeonGenerator/Private/Core/Math/Tetrahedron.inl @@ -1,11 +1,11 @@ /** -四面体 ヘッダーファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 四面体 ヘッダーファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Point.h" @@ -22,8 +22,8 @@ namespace dungeon namespace std { /** - unordered_map,unordered_set等で利用するハッシュ関数 - */ + * unordered_map,unordered_set等で利用するハッシュ関数 + */ template<> struct hash { diff --git a/Source/DungeonGenerator/Private/Core/Math/Triangle.h b/Source/DungeonGenerator/Private/Core/Math/Triangle.h index 6c70130..6dae3b7 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Triangle.h +++ b/Source/DungeonGenerator/Private/Core/Math/Triangle.h @@ -1,11 +1,11 @@ /** -三角形に関するヘッダーファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 三角形に関するヘッダーファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -15,36 +15,36 @@ namespace dungeon class Point; /** - 三角形クラス - */ + * 三角形クラス + */ class Triangle final { public: /** - コンストラクタ - 3頂点を与えて三角形をつくる - */ + * コンストラクタ + * 3頂点を与えて三角形をつくる + */ Triangle(const std::shared_ptr& p1, const std::shared_ptr& p2, const std::shared_ptr& p3) noexcept; /** - コンストラクタ - 3頂点を与えて三角形をつくる - */ + * コンストラクタ + * 3頂点を与えて三角形をつくる + */ Triangle(const FVector& p1, const FVector& p2, const FVector& p3) noexcept; /** - コピーコンストラクタ - */ + * コピーコンストラクタ + */ Triangle(const Triangle& other) noexcept; /** - ムーブコンストラクタ - */ + * ムーブコンストラクタ + */ Triangle(Triangle&& other) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~Triangle() = default; /* @@ -55,67 +55,67 @@ namespace dungeon bool HasCommonPoints(const Triangle& other) const noexcept; /** - 頂点を取得します - @param[in] index 頂点番号 - @return 頂点 - */ + * 頂点を取得します + * @param[in] index 頂点番号 + * @return 頂点 + */ const std::shared_ptr& GetPoint(const size_t index) const noexcept; /** - 面積を取得します - @return 面積 - */ + * 面積を取得します + * @return 面積 + */ double Area() const noexcept; /** - 右回りの面か取得します - @return trueならば右回りの辺 - */ + * 右回りの面か取得します + * @return trueならば右回りの辺 + */ bool IsCW() const noexcept; /** - 左回りの面か取得します - @return trueならば左回りの辺 - */ + * 左回りの面か取得します + * @return trueならば左回りの辺 + */ bool IsCCW() const noexcept; /** - 右回りの面に変換します - */ + * 右回りの面に変換します + */ void CW() noexcept; /** - 左回りの面に変換します - */ + * 左回りの面に変換します + */ void CCW() noexcept; /** - コピー代入 - */ + * コピー代入 + */ Triangle& operator=(const Triangle& other) noexcept; /** - ムーブ代入 - */ + * ムーブ代入 + */ Triangle& operator=(Triangle&& other) noexcept; /** - 同値判定 - @param[in] other 比較する三角形 - @return trueならば同じ - */ + * 同値判定 + * @param[in] other 比較する三角形 + * @return trueならば同じ + */ bool operator==(const Triangle& other) const noexcept; /** - 異値判定 - @param[in] other 比較する三角形 - @return trueならば異なる - */ + * 異値判定 + * @param[in] other 比較する三角形 + * @return trueならば異なる + */ bool operator!=(const Triangle& other) const noexcept; /** - 頂点を取得します - */ + * 頂点を取得します + */ FVector operator[](const size_t index) const noexcept; private: diff --git a/Source/DungeonGenerator/Private/Core/Math/Triangle.inl b/Source/DungeonGenerator/Private/Core/Math/Triangle.inl index 6a0dd71..f73a6bb 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Triangle.inl +++ b/Source/DungeonGenerator/Private/Core/Math/Triangle.inl @@ -1,11 +1,11 @@ /** -三角形に関するヘッダーファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 三角形に関するヘッダーファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Point.h" diff --git a/Source/DungeonGenerator/Private/Core/Math/Vector.h b/Source/DungeonGenerator/Private/Core/Math/Vector.h index 678062c..8f08c67 100644 --- a/Source/DungeonGenerator/Private/Core/Math/Vector.h +++ b/Source/DungeonGenerator/Private/Core/Math/Vector.h @@ -1,10 +1,10 @@ /** -ベクターに関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ベクターに関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -12,34 +12,34 @@ All Rights Reserved. namespace dungeon { /** - Converts an integer vector to a real vector - */ + * Converts an integer vector to a real vector + */ inline FVector ToVector(const FIntVector& vector) noexcept { return FVector(static_cast(vector.X), static_cast(vector.Y), static_cast(vector.Z)); } /** - Converts an real vector to a integer vector - */ + * Converts an real vector to a integer vector + */ inline FIntVector ToIntVector(const FVector& vector) noexcept { return FIntVector(static_cast(vector.X), static_cast(vector.Y), static_cast(vector.Z)); } /** - Converts an integer vector to a integer point - (Note that the Z value is discarded.) - */ + * Converts an integer vector to a integer point + * (Note that the Z value is discarded.) + */ inline FIntPoint ToIntPoint(const FIntVector& vector) noexcept { return FIntPoint(vector.X, vector.Y); } /** - Converts an real vector to a integer point - (Note that the Z value is discarded.) - */ + * Converts an real vector to a integer point + * (Note that the Z value is discarded.) + */ inline FIntPoint ToIntPoint(const FVector& vector) noexcept { return FIntPoint(static_cast(vector.X), static_cast(vector.Y)); diff --git a/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.cpp b/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.cpp index 04fca0f..c7015b7 100644 --- a/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.cpp +++ b/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.cpp @@ -1,9 +1,9 @@ /** -ミッショングラフが攻略可能かテストします - -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. + * ミッショングラフが攻略可能かテストします + * + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. */ #include "MissionGraphTester.h" diff --git a/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.h b/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.h index 46c6235..4b1ed28 100644 --- a/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.h +++ b/Source/DungeonGenerator/Private/Core/MissionGraph/MissionGraphTester.h @@ -1,9 +1,9 @@ /** -ミッショングラフが攻略可能かテストします - -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. + * ミッショングラフが攻略可能かテストします + * + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. */ #pragma once diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.cpp b/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.cpp index 465ad20..a2ec121 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.cpp +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.cpp @@ -1,11 +1,11 @@ /** -三次元ドロネー三角形分割に関するソースファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 三次元ドロネー三角形分割に関するソースファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "DelaunayTriangulation3D.h" #include diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.h b/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.h index 7823cd9..0d65a47 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.h +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/DelaunayTriangulation3D.h @@ -1,11 +1,11 @@ /** -三次元ドロネー三角形分割に関するヘッダーファイル - -@cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 三次元ドロネー三角形分割に関するヘッダーファイル + * + * @cite http://tercel-sakuragaoka.blogspot.com/2011/11/c-3-delaunay.html + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Math/Tetrahedron.h" @@ -16,10 +16,10 @@ All Rights Reserved. namespace dungeon { /** - 三次元ドロネー三角形分割クラス - - コンストラクタに与えられた座標を元に三角形を生成します - */ + * 三次元ドロネー三角形分割クラス + * + * コンストラクタに与えられた座標を元に三角形を生成します + */ class DelaunayTriangulation3D { using TeraType = std::pair; @@ -28,19 +28,19 @@ namespace dungeon public: /** - コンストラクタ - 与えられた点のリストをもとにDelaunay分割を行う - */ + * コンストラクタ + * 与えられた点のリストをもとにDelaunay分割を行う + */ explicit DelaunayTriangulation3D(const std::vector>& pointList) noexcept; /** - デストラクタ - */ + * デストラクタ + */ virtual ~DelaunayTriangulation3D() = default; /** - 三角形を更新します - */ + * 三角形を更新します + */ template void ForEach(Function&& function) noexcept { @@ -51,8 +51,8 @@ namespace dungeon } /** - 三角形を更新します - */ + * 三角形を更新します + */ template void ForEach(Function&& function) const noexcept { @@ -63,9 +63,9 @@ namespace dungeon } /** - 有効な分割か調べます - @return 有効ならばtrue - */ + * 有効な分割か調べます + * @return 有効ならばtrue + */ bool IsValid() const noexcept { return mTriangles.empty() == false; diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.cpp b/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.cpp index f0652d5..2b9a558 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.cpp +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.cpp @@ -1,11 +1,11 @@ /** -最小スパニングツリーに関するソースファイル - -@cite https://algo-logic.info/kruskal-mst/ -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 最小スパニングツリーに関するソースファイル + * + * @cite https://algo-logic.info/kruskal-mst/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "MinimumSpanningTree.h" #include "PathFinder.h" @@ -15,6 +15,7 @@ All Rights Reserved. #include "../RoomGeneration/Room.h" #include #include +#include namespace dungeon { @@ -101,18 +102,18 @@ namespace dungeon } //////////////////////////////////////////////////////////////////////////////////////////////// - /* - UnionFind:素集合系管理の構造体(union by rank) - IsSame(x, y): x と y が同じ集合にいるか。 計算量はならし O(α(n)) - Unite(x, y): x と y を同じ集合にする。計算量はならし O(α(n)) - */ + /** + * UnionFind:素集合系管理の構造体(union by rank) + * IsSame(x, y): x と y が同じ集合にいるか。 計算量はならし O(α(n)) + * Unite(x, y): x と y を同じ集合にする。計算量はならし O(α(n)) + */ class UnionFind final { public: /** - コンストラクタ - @param[in] edgeSize edgeの数 - */ + * コンストラクタ + * @param[in] edgeSize edgeの数 + */ explicit UnionFind(const size_t edgeSize) noexcept { mRank.resize(edgeSize, 0); @@ -124,21 +125,21 @@ namespace dungeon } /** - x と y が同じ集合にいるか調べます - @param[in] x 頂点番号 - @param[in] y 頂点番号 - @return trueならば同じ集合にいるか調べます - */ + * x と y が同じ集合にいるか調べます + * @param[in] x 頂点番号 + * @param[in] y 頂点番号 + * @return trueならば同じ集合にいるか調べます + */ bool IsSame(const size_t x, const size_t y) noexcept { return FindRoot(x) == FindRoot(y); } /** - x と y を同じ集合にする - @param[in] x 頂点番号 - @param[in] y 頂点番号 - */ + * x と y を同じ集合にする + * @param[in] x 頂点番号 + * @param[in] y 頂点番号 + */ void Unite(size_t x, size_t y) noexcept { x = FindRoot(x); @@ -159,9 +160,9 @@ namespace dungeon private: /** - 木の生成 - @param[in] index 頂点番号 - */ + * 木の生成 + * @param[in] index 頂点番号 + */ void MakeTree(const size_t index) noexcept { mParents[index] = index; @@ -169,10 +170,10 @@ namespace dungeon } /** - 親の頂点番号を検索 - @param[in] index 頂点番号 - @return 親の頂点番号 - */ + * 親の頂点番号を検索 + * @param[in] index 頂点番号 + * @return 親の頂点番号 + */ size_t FindRoot(size_t index) noexcept { if (index != mParents[index]) @@ -180,13 +181,12 @@ namespace dungeon return mParents[index]; } - private: std::vector mRank; std::vector mParents; }; //////////////////////////////////////////////////////////////////////////////////////////////// - MinimumSpanningTree::MinimumSpanningTree(const std::shared_ptr& random, const DelaunayTriangulation3D& delaunayTriangulation, const uint8_t aisleComplexity) noexcept +MinimumSpanningTree::MinimumSpanningTree(const std::shared_ptr& random, const DelaunayTriangulation3D& delaunayTriangulation, const uint8_t aisleComplexity, const StartLocationPolicy startLocationPolicy, const uint8_t startRoomCount) noexcept { Verteces verteces; std::vector indexedEdges; @@ -214,10 +214,10 @@ namespace dungeon }); // 初期化 - Initialize(random, verteces, indexedEdges, aisleComplexity); + Initialize(random, verteces, indexedEdges, aisleComplexity, startLocationPolicy, startRoomCount); } - MinimumSpanningTree::MinimumSpanningTree(const std::shared_ptr& random, const std::vector>& points, const uint8_t aisleComplexity) noexcept +MinimumSpanningTree::MinimumSpanningTree(const std::shared_ptr& random, const std::vector>& points, const uint8_t aisleComplexity, const StartLocationPolicy startLocationPolicy, const uint8_t startRoomCount) noexcept { Verteces verteces; @@ -238,13 +238,13 @@ namespace dungeon } // 初期化 - Initialize(random, verteces, indexedEdges, aisleComplexity); + Initialize(random, verteces, indexedEdges, aisleComplexity, startLocationPolicy, startRoomCount); } /* - クラスカル法で初期化します - */ - void MinimumSpanningTree::Initialize(const std::shared_ptr& random, const Verteces& verteces, std::vector& edges, const uint8_t aisleComplexity) noexcept + * クラスカル法で初期化します + */ +void MinimumSpanningTree::Initialize(const std::shared_ptr& random, const Verteces& verteces, std::vector& edges, const uint8_t aisleComplexity, const StartLocationPolicy startLocationPolicy, const uint8_t startRoomCount) noexcept { // コストが少ない順に整列 std::stable_sort(edges.begin(), edges.end(), [](const IndexedEdge& l, const IndexedEdge& r) @@ -345,16 +345,35 @@ namespace dungeon } // スタートを記録 - mStartPoint = FindStartPoint(); - mStartPoint->GetOwnerRoom()->SetParts(Room::Parts::Start); + if (startLocationPolicy == StartLocationPolicy::UseMultiStart) + { + const auto startPoints = FindMultiStartPoints(startRoomCount); + if (startPoints.empty() == false) + { + mStartPoint = startPoints.front(); + for (const auto& startPoint : startPoints) + { + startPoint->GetOwnerRoom()->SetParts(Room::Parts::Start); + } + } + } - // ゴールと各ポイントを記録 + if (mStartPoint == nullptr) + { + mStartPoint = FindStartPoint(startLocationPolicy); + if (mStartPoint != nullptr) + { + mStartPoint->GetOwnerRoom()->SetParts(Room::Parts::Start); + } + } + + // スタートから最も遠いポイントをゴールとして記録 + // 同時に はなれ になるポイントを記録 size_t startPointIndex = verteces.Find(mStartPoint); check(startPointIndex != static_cast(~0)); // cppcheck-suppress [knownConditionTrueFalse] if (startPointIndex != static_cast(~0)) { - // ゴールを記録 std::vector routeNodes; Cost(routeNodes, edges, startPointIndex, 0.f); if (routeNodes.empty()) @@ -364,7 +383,6 @@ namespace dungeon } else { - // 最も遠いポイントをゴールとして記録 float maxCost = std::numeric_limits::lowest(); size_t vertexIndex = 0; for (const auto& routeNode : routeNodes) @@ -449,62 +467,286 @@ namespace dungeon return std::find_if(indexedEdges.begin(), indexedEdges.end(), comparer) != indexedEdges.end(); } - std::shared_ptr MinimumSpanningTree::FindStartPoint() const noexcept + std::shared_ptr MinimumSpanningTree::FindStartPoint(const StartLocationPolicy startLocationPolicy) const noexcept { - /* - 全ての辺の中央の位置と - Yが最も大きい点をを求める - */ - std::shared_ptr center = std::make_shared(0.f, 0.f, 0.f); - std::shared_ptr bottom = nullptr; - size_t count = 0; + if (startLocationPolicy == StartLocationPolicy::UseCentralPoint) + { + const auto points = CollectUniquePoints(); + if (points.empty()) + { + return nullptr; + } + + FVector center(0.f, 0.f, 0.f); + for (const auto& point : points) + { + center += static_cast(*point); + } + center /= static_cast(points.size()); + + std::shared_ptr resultPoint = nullptr; + double min = std::numeric_limits::max(); + for (const auto& point : points) + { + const double distance = PathFinder::Heuristics(*point, center); + if (min > distance) + { + min = distance; + resultPoint = point; + } + } + return resultPoint; + } + + if (startLocationPolicy == StartLocationPolicy::UseHighestPoint) { - float maxY = std::numeric_limits::lowest(); + // 最も高い部屋を探す + std::shared_ptr result = nullptr; + + float maxZ = std::numeric_limits::lowest(); for (const auto& edge : mEdges) { - *center += static_cast(*edge.GetPoint(0)); - *center += static_cast(*edge.GetPoint(1)); - count += 2; + for (size_t i = 0; i < 2; ++i) + { + if (maxZ < edge.GetPoint(i)->Z) + { + maxZ = edge.GetPoint(i)->Z; + result = edge.GetPoint(i); + } + } + } + return result; + } + + if (startLocationPolicy == StartLocationPolicy::UseLowestPoint) + { + // 最も低い部屋を探す + std::shared_ptr result = nullptr; + + float minZ = std::numeric_limits::max(); + for (const auto& edge : mEdges) + { for (size_t i = 0; i < 2; ++i) { - if (maxY < edge.GetPoint(i)->Y) + if (minZ > edge.GetPoint(i)->Z) { - maxY = edge.GetPoint(i)->Y; - bottom = edge.GetPoint(i); + minZ = edge.GetPoint(i)->Z; + result = edge.GetPoint(i); } } } + + return result; } - if (bottom == nullptr) + //if (startLocationPolicy == StartLocationPolicy::UseSouthernMost) { - return nullptr; + /* + * 全ての辺の中央の位置と + * Yが最も大きい点をを求める + */ + std::shared_ptr center = std::make_shared(0.f, 0.f, 0.f); + std::shared_ptr bottom = nullptr; + size_t count = 0; + { + float maxY = std::numeric_limits::lowest(); + for (const auto& edge : mEdges) + { + *center += static_cast(*edge.GetPoint(0)); + *center += static_cast(*edge.GetPoint(1)); + count += 2; + + for (size_t i = 0; i < 2; ++i) + { + if (maxY < edge.GetPoint(i)->Y) + { + maxY = edge.GetPoint(i)->Y; + bottom = edge.GetPoint(i); + } + } + } + } + + if (bottom == nullptr) + { + return nullptr; + } + + if (count > 0) + { + *center /= static_cast(count); + } + + /* + * 最もYが大きく、最も中央にある点を探す + */ + { + const Point candidateStartPoint(center->X, bottom->Y, bottom->Z); + std::shared_ptr resultPoint = nullptr; + double min = std::numeric_limits::max(); + for (const auto& edge : mEdges) + { + for (size_t i = 0; i < 2; ++i) + { + const double distance = PathFinder::Heuristics(*edge.GetPoint(i), candidateStartPoint); + if (min > distance) + { + min = distance; + resultPoint = edge.GetPoint(i); + } + } + } + return resultPoint; + } } + } - if (count > 0) + std::vector> MinimumSpanningTree::FindMultiStartPoints(const size_t startRoomCount) const noexcept + { + if (startRoomCount == 0) { - *center /= static_cast(count); + return {}; } - // 最もYが大きく、最も中央にある点を探す + const auto points = CollectUniquePoints(); + if (points.empty()) + { + return {}; + } + + const size_t targetCount = std::min(startRoomCount, points.size()); + + FVector minPoint = static_cast(*points.front()); + FVector maxPoint = static_cast(*points.front()); + FVector center(0.f, 0.f, 0.f); + for (const auto& point : points) + { + const FVector location = static_cast(*point); + minPoint.X = std::min(minPoint.X, location.X); + minPoint.Y = std::min(minPoint.Y, location.Y); + minPoint.Z = std::min(minPoint.Z, location.Z); + maxPoint.X = std::max(maxPoint.X, location.X); + maxPoint.Y = std::max(maxPoint.Y, location.Y); + maxPoint.Z = std::max(maxPoint.Z, location.Z); + center += location; + } + center /= static_cast(points.size()); + + std::unordered_set usedRoomIds; + std::vector> startPoints; + + auto registerStartPoint = [&](const std::shared_ptr& point) + { + if (point == nullptr || point->GetOwnerRoom() == nullptr) + { + return; + } + const auto roomId = point->GetOwnerRoom()->GetIdentifier(); + if (usedRoomIds.emplace(roomId).second) + { + startPoints.emplace_back(point); + } + }; + + auto findClosestPoint = [&](const FVector& target) -> std::shared_ptr { - const Point candidateStartPoint(center->X, bottom->Y, bottom->Z); std::shared_ptr resultPoint = nullptr; double min = std::numeric_limits::max(); - for (const auto& edge : mEdges) + for (const auto& point : points) { - for (size_t i = 0; i < 2; ++i) + if (point->GetOwnerRoom() == nullptr) { - const double distance = PathFinder::Heuristics(*edge.GetPoint(i), candidateStartPoint); - if (min > distance) + continue; + } + const auto roomId = point->GetOwnerRoom()->GetIdentifier(); + if (usedRoomIds.contains(roomId)) + { + continue; + } + const double distance = PathFinder::Heuristics(*point, target); + if (min > distance) + { + min = distance; + resultPoint = point; + } + } + return resultPoint; + }; + + registerStartPoint(findClosestPoint(center)); + + const float centerZ = (minPoint.Z + maxPoint.Z) * 0.5f; + const std::array targets = { + FVector(minPoint.X, minPoint.Y, centerZ), + FVector(minPoint.X, maxPoint.Y, centerZ), + FVector(maxPoint.X, minPoint.Y, centerZ), + FVector(maxPoint.X, maxPoint.Y, centerZ), + }; + + for (const auto& target : targets) + { + registerStartPoint(findClosestPoint(target)); + } + + if (startPoints.size() < targetCount) + { + std::vector> remaining; + remaining.reserve(points.size()); + for (const auto& point : points) + { + if (point->GetOwnerRoom() == nullptr) + { + continue; + } + const auto roomId = point->GetOwnerRoom()->GetIdentifier(); + if (!usedRoomIds.contains(roomId)) + { + remaining.emplace_back(point); + } + } + + while (startPoints.size() < targetCount && remaining.empty() == false) + { + auto bestIt = remaining.begin(); + double bestDistance = -1.0; + for (auto it = remaining.begin(); it != remaining.end(); ++it) + { + double minDistance = std::numeric_limits::max(); + for (const auto& selectedPoint : startPoints) { - min = distance; - resultPoint = edge.GetPoint(i); + const double distance = PathFinder::Heuristics(**it, *selectedPoint); + minDistance = std::min(minDistance, distance); + } + if (minDistance > bestDistance) + { + bestDistance = minDistance; + bestIt = it; } } + + registerStartPoint(*bestIt); + remaining.erase(bestIt); + } + } + + return startPoints; + } + + std::vector> MinimumSpanningTree::CollectUniquePoints() const noexcept + { + std::vector> points; + for (const auto& edge : mEdges) + { + for (size_t i = 0; i < 2; ++i) + { + const auto& point = edge.GetPoint(i); + if (std::find(points.begin(), points.end(), point) == points.end()) + { + points.emplace_back(point); + } } - return resultPoint; } + return points; } } diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.h b/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.h index 822814b..edb313c 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.h +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.h @@ -1,14 +1,15 @@ /** -最小スパニングツリーに関するヘッダーファイル - -@cite https://algo-logic.info/kruskal-mst/ -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 最小スパニングツリーに関するヘッダーファイル + * + * @cite https://algo-logic.info/kruskal-mst/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DelaunayTriangulation3D.h" +#include "StartLocationPolicy.h" #include "../RoomGeneration/Aisle.h" namespace dungeon @@ -16,31 +17,31 @@ namespace dungeon class Random; /** - Minimum Spanning Tree Class - */ + * Minimum Spanning Tree Class + */ class MinimumSpanningTree final { using Edge = Aisle; public: /** - コンストラクタ - */ - MinimumSpanningTree(const std::shared_ptr& random, const DelaunayTriangulation3D& delaunayTriangulation, const uint8_t aisleComplexity) noexcept; + * コンストラクタ + */ + MinimumSpanningTree(const std::shared_ptr& random, const DelaunayTriangulation3D& delaunayTriangulation, const uint8_t aisleComplexity, const StartLocationPolicy startLocationPolicy, const uint8_t startRoomCount) noexcept; /** - コンストラクタ - */ - MinimumSpanningTree(const std::shared_ptr& random, const std::vector>& points, const uint8_t aisleComplexity) noexcept; + * コンストラクタ + */ + MinimumSpanningTree(const std::shared_ptr& random, const std::vector>& points, const uint8_t aisleComplexity, const StartLocationPolicy startLocationPolicy, const uint8_t startRoomCount) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~MinimumSpanningTree() = default; /** - 生成した辺を更新します - */ + * 生成した辺を更新します + */ template void ForEach(Function&& function) noexcept { @@ -51,8 +52,8 @@ namespace dungeon } /** - 生成した辺を参照します - */ + * 生成した辺を参照します + */ template void ForEach(Function&& function) const noexcept { @@ -63,50 +64,50 @@ namespace dungeon } /** - 最小スパニングツリーの辺の個数を取得します - @return 最小スパニングツリーの辺の個数 - */ + * 最小スパニングツリーの辺の個数を取得します + * @return 最小スパニングツリーの辺の個数 + */ size_t Size() const noexcept; /** - 開始地点にふさわしい点を取得します - @return 開始地点にふさわしい点 - */ + * 開始地点にふさわしい点を取得します + * @return 開始地点にふさわしい点 + */ const std::shared_ptr& GetStartPoint() const noexcept; /** - ゴール地点にふさわしい点を取得します - @return ゴール地点にふさわしい点 - */ + * ゴール地点にふさわしい点を取得します + * @return ゴール地点にふさわしい点 + */ const std::shared_ptr& GetGoalPoint() const noexcept; private: //////////////////////////////////////////////////////////////////////////////////////////////// /** - 頂点配列 クラス - */ + * 頂点配列 クラス + */ class Verteces final { public: /** - 頂点から頂点インデックスを取得します - @param[in] point 頂点 - @return 頂点インデックス - */ + * 頂点から頂点インデックスを取得します + * @param[in] point 頂点 + * @return 頂点インデックス + */ size_t Index(const std::shared_ptr& point) noexcept; /** - インデックスから頂点を取得します - @param[in] index 頂点インデックス - @return 頂点 - */ + * インデックスから頂点を取得します + * @param[in] index 頂点インデックス + * @return 頂点 + */ const std::shared_ptr& Get(const size_t index) const noexcept; /** - 頂点からインデックスを取得します - @param[in] point 頂点 - @return 頂点インデックス(見つからない場合は~0が返る) - */ + * 頂点からインデックスを取得します + * @param[in] point 頂点 + * @return 頂点インデックス(見つからない場合は~0が返る) + */ size_t Find(const std::shared_ptr& point) const noexcept; private: @@ -115,17 +116,17 @@ namespace dungeon //////////////////////////////////////////////////////////////////////////////////////////////// /** - 頂点インデックスを使った辺クラス - */ + * 頂点インデックスを使った辺クラス + */ class IndexedEdge final { public: /** - コンストラクタ - @param[in] e0 辺の頂点番号 - @param[in] e1 辺の頂点番号 - @param[in] length 頂点間の距離 - */ + * コンストラクタ + * @param[in] e0 辺の頂点番号 + * @param[in] e1 辺の頂点番号 + * @param[in] length 頂点間の距離 + */ IndexedEdge(const size_t e0, const size_t e1, const double length) noexcept; /* @@ -149,10 +150,10 @@ namespace dungeon IndexedEdge& operator=(IndexedEdge&& other) noexcept; /** - 頂点番号を取得します - @param[in] index 頂点インデックス - @return 頂点番号 - */ + * 頂点番号を取得します + * @param[in] index 頂点インデックス + * @return 頂点番号 + */ size_t GetEdge(const size_t index) const noexcept; /* @@ -173,8 +174,8 @@ namespace dungeon //////////////////////////////////////////////////////////////////////////////////////////////// /** - ルートノード - */ + * ルートノード + */ struct RouteNode final { size_t mVertexIndex; @@ -182,17 +183,17 @@ namespace dungeon }; /** - 初期化 - */ - void Initialize(const std::shared_ptr& random, const Verteces& verteces, std::vector& edges, const uint8_t aisleComplexity) noexcept; + * 初期化 + */ + void Initialize(const std::shared_ptr& random, const Verteces& verteces, std::vector& edges, const uint8_t aisleComplexity, const StartLocationPolicy startLocationPolicy, const uint8_t startRoomCount) noexcept; /** - 最小コストになるように経路を生成する - @param[out] result std::vector& - @param[in] edges std::vector& edges, - @param[in] vertexIndex const size_t vertexIndex, - @param[in] cost const float cost); - */ + * 最小コストになるように経路を生成する + * @param[out] result std::vector& + * @param[in] edges std::vector& edges, + * @param[in] vertexIndex const size_t vertexIndex, + * @param[in] cost const float cost); + */ static void Cost(std::vector& result, std::vector& edges, const size_t vertexIndex, const float cost) noexcept; /* @@ -201,10 +202,22 @@ namespace dungeon static bool RedundancyCheck(const std::vector& indexedEdges, const IndexedEdge& indexedEdge) noexcept; /** - 開始地点にふさわしい点を検索します - @return 開始地点にふさわしい点 - */ - std::shared_ptr FindStartPoint() const noexcept; + * 開始地点にふさわしい点を検索します + * @param[in] startLocationPolicy 開始地点ポリシー + * @return 開始地点にふさわしい点 + */ + std::shared_ptr FindStartPoint(const StartLocationPolicy startLocationPolicy) const noexcept; + + /** + * 開始地点にふさわしい点の集合を検索します + * @return 開始地点にふさわしい点の集合 + */ + std::vector> FindMultiStartPoints(const size_t startRoomCount) const noexcept; + + /** + * 重複しない点の一覧を取得します + */ + std::vector> CollectUniquePoints() const noexcept; private: std::vector mEdges; diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.inl b/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.inl index 80234d6..cbf163e 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.inl +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/MinimumSpanningTree.inl @@ -1,11 +1,11 @@ /** -最小スパニングツリーに関するヘッダーファイル - -@cite https://algo-logic.info/kruskal-mst/ -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 最小スパニングツリーに関するヘッダーファイル + * + * @cite https://algo-logic.info/kruskal-mst/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.cpp b/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.cpp index e92b629..0c73253 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.cpp +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.cpp @@ -1,10 +1,10 @@ /** -A*によるパス検索 ソースファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * A*によるパス検索 ソースファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "PathFinder.h" #include "../Debug/BuildInformation.h" diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.h b/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.h index 77cef25..a02d364 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.h +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.h @@ -1,10 +1,10 @@ /** -A*によるパス検索 ヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * A*によるパス検索 ヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Helper/NonCopyable.h" @@ -17,17 +17,17 @@ All Rights Reserved. namespace dungeon { /** - A*によるパス検索クラス - */ + * A*によるパス検索クラス + */ class PathFinder final : NonCopyable { public: class Result; /** - 検索可能な方向 - EDungeonDirectionとDirection::Indexと並びを合わせて下さい - */ + * 検索可能な方向 + * EDungeonDirectionとDirection::Indexと並びを合わせて下さい + */ enum class SearchDirection : uint8_t { North = 0, //!< 北方向へ検索 @@ -38,8 +38,8 @@ namespace dungeon }; /** - 検索ノードの種類 - */ + * 検索ノードの種類 + */ enum class NodeType : uint8_t { Gate, //!< 門 @@ -54,77 +54,77 @@ namespace dungeon public: /** - コンストラクタ - */ + * コンストラクタ + */ PathFinder() = default; /** - デストラクタ - */ + * デストラクタ + */ ~PathFinder() = default; /** - ノードを開く - @param[in] location 現在位置 - @param[in] goal ゴール位置 - @param[in] searchDirection 検索可能な方向 - @return 自身のキー - */ + * ノードを開く + * @param[in] location 現在位置 + * @param[in] goal ゴール位置 + * @param[in] searchDirection 検索可能な方向 + * @return 自身のキー + */ uint64_t Start(const FIntVector& location, const FIntVector& goal, const SearchDirection searchDirection) noexcept; /** - ノードを開く - @param[in] parentKey 親ノードのキー - @param[in] nodeType ノードの種類 - @param[in] cost 現在コスト - @param[in] location 現在位置 - @param[in] goal ゴール位置 - @param[in] direction 検索してきた方向 - @param[in] searchDirection 検索可能な方向 - @return 自身のキー - */ + * ノードを開く + * @param[in] parentKey 親ノードのキー + * @param[in] nodeType ノードの種類 + * @param[in] cost 現在コスト + * @param[in] location 現在位置 + * @param[in] goal ゴール位置 + * @param[in] direction 検索してきた方向 + * @param[in] searchDirection 検索可能な方向 + * @return 自身のキー + */ uint64_t Open(const uint64_t parentKey, const NodeType nodeType, const uint32_t cost, const FIntVector& location, const FIntVector& goal, const Direction direction, const SearchDirection searchDirection) noexcept; /** - Pop可能なノードがあるか調べます - @return trueならば空 - */ + * Pop可能なノードがあるか調べます + * @return trueならば空 + */ bool Empty() const noexcept; /** - Pop可能なノードの数を調べます - @return Pop可能なノードの数 - */ + * Pop可能なノードの数を調べます + * @return Pop可能なノードの数 + */ size_t OpenSize() const noexcept; /** - 検索済みノードの数を調べます - @return 検索済みノードノードの数 - */ + * 検索済みノードの数を調べます + * @return 検索済みノードノードの数 + */ size_t CloseSize() const noexcept; /** - 最も有望な位置を取得します - @param[out] nextKey 次に開く事ができるノードのキー - @param[out] nextNodeType 次のノードの種類 - @param[out] nextCost 次のコスト - @param[out] nextLocation 次の位置 - @param[out] nextDirection 次の方向 - @param[out] nextSearchDirection 次に検索可能な方向 - @return 値が返っているならtrue - */ + * 最も有望な位置を取得します + * @param[out] nextKey 次に開く事ができるノードのキー + * @param[out] nextNodeType 次のノードの種類 + * @param[out] nextCost 次のコスト + * @param[out] nextLocation 次の位置 + * @param[out] nextDirection 次の方向 + * @param[out] nextSearchDirection 次に検索可能な方向 + * @return 値が返っているならtrue + */ bool Pop(uint64_t& nextKey, NodeType& nextNodeType, uint32_t& nextCost, FIntVector& nextLocation, Direction& nextDirection, SearchDirection& nextSearchDirection) noexcept; /** - 経路を確定する - */ + * 経路を確定する + */ bool Commit(const FIntVector& goal) noexcept; /** - 経路が有効か調べます - 呼び出しはCommit後に行う必要があります - @return trueならば有効な経路 - */ + * 経路が有効か調べます + * 呼び出しはCommit後に行う必要があります + * @return trueならば有効な経路 + */ const std::shared_ptr& GetResult() const noexcept; @@ -132,17 +132,17 @@ namespace dungeon /** - Direction::IndexをSearchDirectionに変換します - @param[in] direction SearchDirection - @return Direction::Index - */ + * Direction::IndexをSearchDirectionに変換します + * @param[in] direction SearchDirection + * @return Direction::Index + */ static Direction Cast(const SearchDirection direction) noexcept; /** - SearchDirectionをDirection::Indexに変換します - @param[in] direction Direction::Index - @return Direction::Index - */ + * SearchDirectionをDirection::Indexに変換します + * @param[in] direction Direction::Index + * @return Direction::Index + */ static SearchDirection Cast(const Direction& direction) noexcept; @@ -151,86 +151,86 @@ namespace dungeon public: /** - 使用中ノードと関連するノードの予約をする - UseOpenNodeが呼ばれると予約ノードを使用中に変更します。 - 主に階段の空間に進入させない為に使用しています。 - @param[in] parentLocation 親の位置 - @param[in] openNode std::shared_ptr - */ + * 使用中ノードと関連するノードの予約をする + * UseOpenNodeが呼ばれると予約ノードを使用中に変更します。 + * 主に階段の空間に進入させない為に使用しています。 + * @param[in] parentLocation 親の位置 + * @param[in] openNode std::shared_ptr + */ void ReserveOpenNode(const FIntVector& parentLocation, const PathNodeSwitcher::Node& openNode); /** - ノードと関連ノードが使用中か調べます - 主に階段の空間に進入させない為に使用しています。 - @param[in] location 位置 - */ + * ノードと関連ノードが使用中か調べます + * 主に階段の空間に進入させない為に使用しています。 + * @param[in] location 位置 + */ bool IsUsingOpenNode(const FIntVector& location) const; private: /** - 使用予約されたノードを使用中に変更する - @param[in] parentHash ノードのハッシュ値 - */ + * 使用予約されたノードを使用中に変更する + * @param[in] parentHash ノードのハッシュ値 + */ void UseOpenNode(const uint64_t parentHash); /** - 使用中のノードを使用予約に戻す - @param[in] parentHash ノードのハッシュ値 - */ + * 使用中のノードを使用予約に戻す + * @param[in] parentHash ノードのハッシュ値 + */ void RevertOpenNode(const uint64_t parentHash); /** - 使用予約されたノードと使用中のノードをクリアする - */ + * 使用予約されたノードと使用中のノードをクリアする + */ void ClearOpenNode(); public: /** - 位置からハッシュキーを計算 - @param[in] location 位置 - @return ハッシュキー - */ + * 位置からハッシュキーを計算 + * @param[in] location 位置 + * @return ハッシュキー + */ static uint64_t Hash(const FIntVector& location) noexcept; private: /** - 総コストを計算を取得 - @param[in] cost 現在コスト - @param[in] location 現在位置 - @param[in] goal ゴール位置 - @return 総コスト - */ + * 総コストを計算を取得 + * @param[in] cost 現在コスト + * @param[in] location 現在位置 + * @param[in] goal ゴール位置 + * @return 総コスト + */ static uint32_t TotalCost(const uint32_t cost, const FIntVector& location, const FIntVector& goal) noexcept; /** - 総コストを計算を取得 - @param[in] cost 現在コスト - @param[in] heuristics ヒューリスティック - @return 総コスト - */ + * 総コストを計算を取得 + * @param[in] cost 現在コスト + * @param[in] heuristics ヒューリスティック + * @return 総コスト + */ static uint32_t TotalCost(const uint32_t cost, const uint32_t heuristics) noexcept; public: /** - ヒューリスティックを取得 - @param[in] location 現在位置 - @param[in] goal ゴール位置 - @return ヒューリスティック - */ + * ヒューリスティックを取得 + * @param[in] location 現在位置 + * @param[in] goal ゴール位置 + * @return ヒューリスティック + */ static uint32_t Heuristics(const FIntVector& location, const FIntVector& goal) noexcept; /** - ヒューリスティックを取得 - @param[in] location 現在位置 - @param[in] goal ゴール位置 - @return ヒューリスティック - */ + * ヒューリスティックを取得 + * @param[in] location 現在位置 + * @param[in] goal ゴール位置 + * @return ヒューリスティック + */ static double Heuristics(const FVector& location, const FVector& goal) noexcept; private: /** - 基底ノード - */ + * 基底ノード + */ struct BaseNode { BaseNode(const NodeType nodeType, const FIntVector& location, const Direction& direction) noexcept; @@ -243,8 +243,8 @@ namespace dungeon }; /** - Openノード - */ + * Openノード + */ struct OpenNode : public BaseNode { OpenNode(const uint64_t parentKey, const NodeType nodeType, const FIntVector& location, const Direction& direction, const SearchDirection searchDirection, const uint32_t cost) noexcept; @@ -257,8 +257,8 @@ namespace dungeon }; /** - Closeノード - */ + * Closeノード + */ struct CloseNode : public BaseNode { CloseNode(const uint64_t parentKey, const NodeType nodeType, const FIntVector& location, const Direction& direction, const uint32_t cost) noexcept; @@ -283,13 +283,13 @@ namespace dungeon bool IsValidPath() const noexcept; /** - 経路の長さを取得します - */ + * 経路の長さを取得します + */ size_t GetPathLength() const noexcept; /** - 経路を取得します - */ + * 経路を取得します + */ template void Path(Function&& function) const noexcept { diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.inl b/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.inl index 0c59140..c6f4ea9 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.inl +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/PathFinder.inl @@ -1,10 +1,10 @@ /** -A*によるパス検索 ヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * A*によるパス検索 ヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once @@ -82,11 +82,11 @@ namespace dungeon BaseNode */ /** - コンストラクタ - @param[in] nodeType ノードの種類 - @param[in] location 現在位置 - @param[in] direction 検索してきた方向 - */ + * コンストラクタ + * @param[in] nodeType ノードの種類 + * @param[in] location 現在位置 + * @param[in] direction 検索してきた方向 + */ inline PathFinder::BaseNode::BaseNode(const NodeType nodeType, const FIntVector& location, const Direction& direction) noexcept : mLocation(location) , mNodeType(nodeType) @@ -112,14 +112,14 @@ namespace dungeon OpenNode */ /** - コンストラクタ - @param[in] parentKey 親ノードのキー - @param[in] nodeType ノードの種類 - @param[in] location 現在位置 - @param[in] direction 検索してきた方向 - @param[in] searchDirection 検索可能な方向 - @param[in] cost コスト - */ + * コンストラクタ + * @param[in] parentKey 親ノードのキー + * @param[in] nodeType ノードの種類 + * @param[in] location 現在位置 + * @param[in] direction 検索してきた方向 + * @param[in] searchDirection 検索可能な方向 + * @param[in] cost コスト + */ inline PathFinder::OpenNode::OpenNode(const uint64_t parentKey, const NodeType nodeType, const FIntVector& location, const Direction& direction, const SearchDirection searchDirection, const uint32_t cost) noexcept : BaseNode(nodeType, location, direction) , mParentKey(parentKey) @@ -148,13 +148,13 @@ namespace dungeon CloseNode */ /** - コンストラクタ - @param[in] parentKey 親ノードのキー - @param[in] nodeType ノードの種類 - @param[in] location 現在位置 - @param[in] direction 検索してきた方向 - @param[in] cost コスト - */ + * コンストラクタ + * @param[in] parentKey 親ノードのキー + * @param[in] nodeType ノードの種類 + * @param[in] location 現在位置 + * @param[in] direction 検索してきた方向 + * @param[in] cost コスト + */ inline PathFinder::CloseNode::CloseNode(const uint64_t parentKey, const NodeType nodeType, const FIntVector& location, const Direction& direction, const uint32_t cost) noexcept : BaseNode(nodeType, location, direction) , mParentKey(parentKey) diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/PathGoalCondition.h b/Source/DungeonGenerator/Private/Core/PathGeneration/PathGoalCondition.h index ec35a7b..158fb8c 100644 --- a/Source/DungeonGenerator/Private/Core/PathGeneration/PathGoalCondition.h +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/PathGoalCondition.h @@ -1,10 +1,10 @@ /** -ゴール条件 ヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ゴール条件 ヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -13,61 +13,61 @@ All Rights Reserved. namespace dungeon { /** - ゴール条件クラス - */ + * ゴール条件クラス + */ class PathGoalCondition final { public: /** - コンストラクタ - */ + * コンストラクタ + */ PathGoalCondition() = default; /** - コンストラクタ - */ + * コンストラクタ + */ explicit PathGoalCondition(const FIntRect& rect) noexcept; /** - コピーコンストラクタ - */ + * コピーコンストラクタ + */ explicit PathGoalCondition(const PathGoalCondition& other) noexcept; /** - ムーブコンストラクタ - */ + * ムーブコンストラクタ + */ explicit PathGoalCondition(PathGoalCondition&& other) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~PathGoalCondition() = default; /** - ゴール範囲を取得 - */ + * ゴール範囲を取得 + */ const FIntRect& Get() const noexcept; /** - ゴール範囲を設定 - */ + * ゴール範囲を設定 + */ void Set(const FIntRect& rect) noexcept; /** - 座標がゴール条件を満たしているか? - @param[in] location 座標 - @return trueならば条件を満たしている - */ + * 座標がゴール条件を満たしているか? + * @param[in] location 座標 + * @return trueならば条件を満たしている + */ bool Contains(const FIntVector& location) const noexcept; /** - コピー代入 - */ + * コピー代入 + */ PathGoalCondition& operator=(const PathGoalCondition& other) noexcept; /** - ムーブ代入 - */ + * ムーブ代入 + */ PathGoalCondition& operator=(PathGoalCondition&& other) noexcept; private: diff --git a/Source/DungeonGenerator/Private/Core/PathGeneration/StartLocationPolicy.h b/Source/DungeonGenerator/Private/Core/PathGeneration/StartLocationPolicy.h new file mode 100644 index 0000000..71d31d5 --- /dev/null +++ b/Source/DungeonGenerator/Private/Core/PathGeneration/StartLocationPolicy.h @@ -0,0 +1,29 @@ +/** + * ダンジョンの開始位置に関する定義 + * + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ + +#pragma once +#include + +namespace dungeon +{ + /** + * Dungeon start location policy + * + * スタート位置の種類 + * EDungeonStartLocationPolicyと同じ意味にして下さい + */ + enum class StartLocationPolicy : uint8_t + { + NoAdjustment, + UseSouthernMost, + UseHighestPoint, + UseLowestPoint, + UseCentralPoint, + UseMultiStart, + }; +} diff --git a/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.h b/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.h index cf03ccf..1f023c6 100644 --- a/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.h +++ b/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.h @@ -1,10 +1,10 @@ /** -通路に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 通路に関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Helper/Identifier.h" @@ -16,116 +16,116 @@ namespace dungeon class Point; /** - 通路 クラス - */ + * 通路 クラス + */ class Aisle final { public: /** - コンストラクタ - @param[in] main 幹線通路 - @param[in] p0 辺の頂点 - @param[in] p1 辺の頂点 - */ + * コンストラクタ + * @param[in] main 幹線通路 + * @param[in] p0 辺の頂点 + * @param[in] p1 辺の頂点 + */ Aisle(const bool main, const std::shared_ptr& p0, const std::shared_ptr& p1) noexcept; /** - コピーコンストラクタ - @param[in] other Aisle - */ + * コピーコンストラクタ + * @param[in] other Aisle + */ Aisle(const Aisle& other) noexcept; /** - ムーブコンストラクタ - @param[in] other Aisle - */ + * ムーブコンストラクタ + * @param[in] other Aisle + */ Aisle(Aisle&& other) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~Aisle() = default; /** - 点が辺の頂点に含まれるか? - @param[in] point 比較する点 - @return trueならば等しい - */ + * 点が辺の頂点に含まれるか? + * @param[in] point 比較する点 + * @return trueならば等しい + */ bool Contain(const std::shared_ptr& point) const noexcept; /** - 頂点を取得します - @param[in] index 頂点番号(0~1) - @return 頂点 - */ + * 頂点を取得します + * @param[in] index 頂点番号(0~1) + * @return 頂点 + */ const std::shared_ptr& GetPoint(const size_t index) const noexcept; /** - 辺の長さを取得します - @return 辺の長さ - */ + * 辺の長さを取得します + * @return 辺の長さ + */ double GetLength() const noexcept; /** - 識別子を取得 - @return 識別子 - */ + * 識別子を取得 + * @return 識別子 + */ const Identifier& GetIdentifier() const noexcept; /** - 幹線通路か取得します - */ + * 幹線通路か取得します + */ bool IsMain() const noexcept; /** - 閉鎖状態を取得します - */ + * 閉鎖状態を取得します + */ bool IsLocked() const noexcept; /** - 閉鎖状態を設定します - */ + * 閉鎖状態を設定します + */ void SetLock(const bool lock) noexcept; /** - ユニークな鍵が必要な状態を取得します - */ + * ユニークな鍵が必要な状態を取得します + */ bool IsUniqueLocked() const noexcept; /** - ユニークな鍵が必要な状態を設定します - */ + * ユニークな鍵が必要な状態を設定します + */ void SetUniqueLock(const bool lock) noexcept; /** - 何らかの鍵が必要な状態を取得します - */ + * 何らかの鍵が必要な状態を取得します + */ bool IsAnyLocked() const noexcept; /** - コピー代入 - @param[in] other Aisle - */ + * コピー代入 + * @param[in] other Aisle + */ Aisle& operator=(const Aisle& other) noexcept; /** - ムーブ代入 - @param[in] other Aisle - */ + * ムーブ代入 + * @param[in] other Aisle + */ Aisle& operator=(Aisle&& other) noexcept; /** - 辺が等しいか判定します - @param[in] other 比較する辺 - @return trueならば等しい - */ + * 辺が等しいか判定します + * @param[in] other 比較する辺 + * @return trueならば等しい + */ bool operator==(const Aisle& other) const noexcept; /** - 辺が等しくないか判定します - @param[in] other 比較する辺 - @return trueならば等しくない - */ + * 辺が等しくないか判定します + * @param[in] other 比較する辺 + * @return trueならば等しくない + */ bool operator!=(const Aisle& other) const noexcept; diff --git a/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.inl b/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.inl index 5ab0e79..078a288 100644 --- a/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.inl +++ b/Source/DungeonGenerator/Private/Core/RoomGeneration/Aisle.inl @@ -1,10 +1,10 @@ /** -通路に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 通路に関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Math/Point.h" diff --git a/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.cpp b/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.cpp index 6b18548..61c61ab 100644 --- a/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.cpp +++ b/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.cpp @@ -1,10 +1,10 @@ /** -部屋に関するソースファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 部屋に関するソースファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Room.h" #include "../GenerateParameter.h" @@ -15,11 +15,11 @@ All Rights Reserved. namespace { /** - サイズを乱数で選択 - @param[in] minimum 最小値 - @param[in] maximum 最大値 - @return 乱数で決めたサイズ - */ + * サイズを乱数で選択 + * @param[in] minimum 最小値 + * @param[in] maximum 最大値 + * @return 乱数で決めたサイズ + */ static uint32_t randSize(const std::shared_ptr& random, const uint32_t minimum, const uint32_t maximum) { return random->Get(minimum, maximum + 1); diff --git a/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.h b/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.h index 9b3ccc6..532431e 100644 --- a/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.h +++ b/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.h @@ -1,10 +1,10 @@ /** -部屋に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 部屋に関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Helper/Identifier.h" @@ -20,16 +20,16 @@ namespace dungeon struct GenerateParameter; /** - 部屋クラス - 座標系がUnrealEngine準拠のZアップである事に注意して下さい。 - */ + * 部屋クラス + * 座標系がUnrealEngine準拠のZアップである事に注意して下さい。 + */ class Room final { public: /** - EDungeonRoomPartsと対応して下さい - 変更した場合はGetPartsNameもあわせて修正して下さい - */ + * EDungeonRoomPartsと対応して下さい + * 変更した場合はGetPartsNameもあわせて修正して下さい + */ enum class Parts : uint8_t { Unidentified, //!< 未識別 @@ -41,8 +41,8 @@ namespace dungeon static constexpr uint8_t PartsSize = static_cast(Parts::Goal) + 1; /** - 変更した場合はGetItemNameもあわせて修正して下さい - */ + * 変更した場合はGetItemNameもあわせて修正して下さい + */ enum class Item : uint8_t { Empty, @@ -53,157 +53,157 @@ namespace dungeon public: /** - コンストラクタ - */ + * コンストラクタ + */ Room(const GenerateParameter& parameter, const FIntVector& location) noexcept; /** - コンストラクタ - */ + * コンストラクタ + */ Room(const FIntVector& location, const FIntVector& size) noexcept; /** - コピーコンストラクタ - */ + * コピーコンストラクタ + */ Room(const Room& other) noexcept; /** - デストラクタ - */ + * デストラクタ + */ ~Room() = default; /** - コピー代入 - */ + * コピー代入 + */ Room& operator=(const Room& other) noexcept; /** - 識別子を取得 - @return 識別子 - */ + * 識別子を取得 + * @return 識別子 + */ const Identifier GetIdentifier() const noexcept; /** - X座標を取得 - @return X座標 - */ + * X座標を取得 + * @return X座標 + */ int32_t GetX() const noexcept; /** - Y座標を取得 - @return Y座標 - */ + * Y座標を取得 + * @return Y座標 + */ int32_t GetY() const noexcept; /** - Z座標を取得 - @return Z座標 - */ + * Z座標を取得 + * @return Z座標 + */ int32_t GetZ() const noexcept; /** - X座標を設定 - @param[in] x X座標 - */ + * X座標を設定 + * @param[in] x X座標 + */ void SetX(const int32_t x) noexcept; /** - Y座標を設定 - @param[in] y Y座標 - */ + * Y座標を設定 + * @param[in] y Y座標 + */ void SetY(const int32_t y) noexcept; /** - Z座標を設定 - @param[in] z Z座標 - */ + * Z座標を設定 + * @param[in] z Z座標 + */ void SetZ(const int32_t z) noexcept; /** - 幅を取得します - @return 幅 - */ + * 幅を取得します + * @return 幅 + */ int32_t GetWidth() const noexcept; /** - 奥行きを取得します - @return 奥行き - */ + * 奥行きを取得します + * @return 奥行き + */ int32_t GetDepth() const noexcept; /** - 高さを取得します - @return 高さ - */ + * 高さを取得します + * @return 高さ + */ int32_t GetHeight() const noexcept; /** - 幅を設定します - @param[in] width 幅 - */ + * 幅を設定します + * @param[in] width 幅 + */ void SetWidth(const int32_t width) noexcept; /** - 奥行きを設定します - @param[in] depth 奥行き - */ + * 奥行きを設定します + * @param[in] depth 奥行き + */ void SetDepth(const int32_t depth) noexcept; /** - 高さを設定します - @param[in] height 高さ - */ + * 高さを設定します + * @param[in] height 高さ + */ void SetHeight(const int32_t height) noexcept; /** - 矩形の左の座標を取得します - @return 矩形の左の座標 - */ + * 矩形の左の座標を取得します + * @return 矩形の左の座標 + */ int32_t GetLeft() const noexcept; /** - 矩形の右の座標を取得します - @return 矩形の右の座標(X + Width - 1) - */ + * 矩形の右の座標を取得します + * @return 矩形の右の座標(X + Width - 1) + */ int32_t GetRight() const noexcept; /** - 矩形の上の座標を取得します - @return 矩形の上の座標 - */ + * 矩形の上の座標を取得します + * @return 矩形の上の座標 + */ int32_t GetTop() const noexcept; /** - 矩形の下の座標を取得します - @return 矩形の下の座標(Y + Depth - 1) - */ + * 矩形の下の座標を取得します + * @return 矩形の下の座標(Y + Depth - 1) + */ int32_t GetBottom() const noexcept; /** - 矩形を取得します - */ + * 矩形を取得します + */ FIntRect GetRect() const noexcept; /** - 立方体の手前の座標(軸の大きい方)を取得します - */ + * 立方体の手前の座標(軸の大きい方)を取得します + */ int32_t GetForeground() const noexcept; /** - 立方体の奥の座標(軸の小さい方)を取得します - */ + * 立方体の奥の座標(軸の小さい方)を取得します + */ int32_t GetBackground() const noexcept; /** - 矩形の中心の座標を取得します - @return 矩形の中心 - */ + * 矩形の中心の座標を取得します + * @return 矩形の中心 + */ Point GetCenter() const noexcept; /** - 矩形の半分の辺を取得します - @return 矩形の半分の辺 - */ + * 矩形の半分の辺を取得します + * @return 矩形の半分の辺 + */ FVector GetExtent() const noexcept; /** @@ -217,26 +217,26 @@ namespace dungeon FVector GetMax() const noexcept; /** - 地面の中心の座標を取得します - @return 地面の中心 - */ + * 地面の中心の座標を取得します + * @return 地面の中心 + */ Point GetGroundCenter() const noexcept; /** - 部屋が交差しているか調べます - @param[in] other 調べる部屋 - @return trueならば交差している - */ + * 部屋が交差しているか調べます + * @param[in] other 調べる部屋 + * @return trueならば交差している + */ bool Intersect(const Room& other) const noexcept; /** - 部屋が交差しているか調べます - @param[in] other 調べる部屋 - @param[in] horizontalMargin 水平方向のマージン - @param[in] verticalMargin 垂直方向のマージン - @return trueならば交差している - 垂直方向のマージンは床方向に1、天井方向はかならず0で交差判定します。 - */ + * 部屋が交差しているか調べます + * @param[in] other 調べる部屋 + * @param[in] horizontalMargin 水平方向のマージン + * @param[in] verticalMargin 垂直方向のマージン + * @return trueならば交差している + * 垂直方向のマージンは床方向に1、天井方向はかならず0で交差判定します。 + */ bool Intersect(const Room& other, const uint32_t horizontalMargin, const uint32_t verticalMargin) const noexcept; /** @@ -248,55 +248,55 @@ namespace dungeon bool HorizontalIntersect(const Room& other, const uint32_t horizontalMargin) const noexcept; /** - 点が含まれるか調べます - @param[in] point 調べる点 - */ + * 点が含まれるか調べます + * @param[in] point 調べる点 + */ bool Contain(const Point& point) const noexcept; /** - 点が含まれるか調べます - @param[in] x 調べる点 - @param[in] y 調べる点 - @param[in] z 調べる点 - */ + * 点が含まれるか調べます + * @param[in] x 調べる点 + * @param[in] y 調べる点 + * @param[in] z 調べる点 + */ bool Contain(const int32_t x, const int32_t y, const int32_t z) const noexcept; /** - 点が含まれるか調べます - @param[in] location 調べる点 - */ + * 点が含まれるか調べます + * @param[in] location 調べる点 + */ bool Contain(const FIntVector& location) const noexcept; /** - 部屋のパーツを取得します - */ + * 部屋のパーツを取得します + */ Parts GetParts() const noexcept; /** - 部屋のパーツを設定します - */ + * 部屋のパーツを設定します + */ void SetParts(const Parts parts) noexcept; /** - 部屋のアイテムを取得します - */ + * 部屋のアイテムを取得します + */ Item GetItem() const noexcept; /** - 部屋のアイテムを設定します - */ + * 部屋のアイテムを設定します + */ void SetItem(const Item item) noexcept; /** - スタート位置からの深さを取得します - @return スタート位置からの深さ(部屋の数) - */ + * スタート位置からの深さを取得します + * @return スタート位置からの深さ(部屋の数) + */ uint8_t GetDepthFromStart() const noexcept; /** - スタート位置からの深さを取得します - @param[in] depthFromStart スタート位置からの深さ(部屋の数) - */ + * スタート位置からの深さを取得します + * @param[in] depthFromStart スタート位置からの深さ(部屋の数) + */ void SetDepthFromStart(const uint8_t depthFromStart) noexcept; /* @@ -355,13 +355,13 @@ namespace dungeon std::string GetName() const noexcept; /** - 部屋のパーツの名称します - */ + * 部屋のパーツの名称します + */ const std::string_view& GetPartsName() const noexcept; /** - 部屋のアイテムの名称します - */ + * 部屋のアイテムの名称します + */ const std::string_view& GetItemName() const noexcept; diff --git a/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.inl b/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.inl index 00a3a26..19bed87 100644 --- a/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.inl +++ b/Source/DungeonGenerator/Private/Core/RoomGeneration/Room.inl @@ -1,10 +1,10 @@ /** -部屋に関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 部屋に関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once diff --git a/Source/DungeonGenerator/Private/Core/Voxelization/Grid.cpp b/Source/DungeonGenerator/Private/Core/Voxelization/Grid.cpp index 9266d72..ff08648 100644 --- a/Source/DungeonGenerator/Private/Core/Voxelization/Grid.cpp +++ b/Source/DungeonGenerator/Private/Core/Voxelization/Grid.cpp @@ -1,18 +1,18 @@ /** -ボクセルなどに利用するグリッド情報のソースファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ボクセルなどに利用するグリッド情報のソースファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Grid.h" namespace dungeon { /** - 自身からtoGridを見た時に床が生成されるか判定します - */ + * 自身からtoGridを見た時に床が生成されるか判定します + */ bool Grid::CanBuildFloor(const bool checkNoMeshGeneration) const noexcept { // 床の生成禁止領域か? @@ -23,8 +23,8 @@ namespace dungeon } /** - 斜面が生成されるか判定します - */ + * 斜面が生成されるか判定します + */ bool Grid::CanBuildSlope() const noexcept { // 床の生成禁止領域か? @@ -35,8 +35,8 @@ namespace dungeon } /** - 自身からtoGridを見た時に屋根が生成されるか判定します - */ + * 自身からtoGridを見た時に屋根が生成されるか判定します + */ bool Grid::CanBuildRoof(const Grid& toUpperGrid, const bool checkNoMeshGeneration) const noexcept { if (checkNoMeshGeneration && IsNoRoofMeshGeneration()) @@ -68,8 +68,8 @@ namespace dungeon } /** - 自身からtoGridを見た時に扉が生成されるか判定します - */ + * 自身からtoGridを見た時に扉が生成されるか判定します + */ bool Grid::CanBuildGate(const Grid& toGrid, const Direction::Index direction, const bool mergeRooms) const noexcept { if (!Is(Type::Gate)) @@ -119,8 +119,8 @@ namespace dungeon } /** - 自身からtoGridを見た時に壁が生成されるか判定します - */ + * 自身からtoGridを見た時に壁が生成されるか判定します + */ bool Grid::CanBuildWall(const Grid& toGrid, const Direction::Index direction, const bool mergeRooms) const noexcept { // TODO: NoWallMeshGenerationフラグは進入禁止に使用されている別途生成禁止フラグが必要 diff --git a/Source/DungeonGenerator/Private/Core/Voxelization/Grid.h b/Source/DungeonGenerator/Private/Core/Voxelization/Grid.h index 100f2d6..852bc94 100644 --- a/Source/DungeonGenerator/Private/Core/Voxelization/Grid.h +++ b/Source/DungeonGenerator/Private/Core/Voxelization/Grid.h @@ -1,10 +1,10 @@ /** -ボクセルなどに利用するグリッド情報のヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ボクセルなどに利用するグリッド情報のヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Helper/Direction.h" @@ -280,9 +280,9 @@ namespace dungeon bool IsNoFloorMeshGeneration() const noexcept; /** - 天井のメッシュ生成禁止か取得します - @return trueならメッシュ生成禁止 - */ + * 天井のメッシュ生成禁止か取得します + * @return trueならメッシュ生成禁止 + */ bool IsNoRoofMeshGeneration() const noexcept; /** diff --git a/Source/DungeonGenerator/Private/Core/Voxelization/Grid.inl b/Source/DungeonGenerator/Private/Core/Voxelization/Grid.inl index ce43ea0..06eeefb 100644 --- a/Source/DungeonGenerator/Private/Core/Voxelization/Grid.inl +++ b/Source/DungeonGenerator/Private/Core/Voxelization/Grid.inl @@ -1,10 +1,10 @@ /** -ボクセルなどに利用するグリッド情報のヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * ボクセルなどに利用するグリッド情報のヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Helper/Direction.h" diff --git a/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.cpp b/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.cpp index d2d5ebf..83aa4a1 100644 --- a/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.cpp +++ b/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.cpp @@ -1,10 +1,10 @@ /** -部屋の中に構造物を生成できるか調査・生成します - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * 部屋の中に構造物を生成できるか調査・生成します + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "RoomStructureGenerator.h" #include "Voxel.h" diff --git a/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.h b/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.h index 4d3751d..2bdf379 100644 --- a/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.h +++ b/Source/DungeonGenerator/Private/Core/Voxelization/RoomStructureGenerator.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "../Helper/NonCopyable.h" diff --git a/Source/DungeonGenerator/Private/Core/Voxelization/Voxel.inl b/Source/DungeonGenerator/Private/Core/Voxelization/Voxel.inl index e31ac92..b2deac8 100644 --- a/Source/DungeonGenerator/Private/Core/Voxelization/Voxel.inl +++ b/Source/DungeonGenerator/Private/Core/Voxelization/Voxel.inl @@ -1,10 +1,10 @@ /** -グリッドに関するヘッダーファイル - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * グリッドに関するヘッダーファイル + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once diff --git a/Source/DungeonGenerator/Private/DungeonBlueprint.cpp b/Source/DungeonGenerator/Private/DungeonBlueprint.cpp index 1818700..88a8c99 100644 --- a/Source/DungeonGenerator/Private/DungeonBlueprint.cpp +++ b/Source/DungeonGenerator/Private/DungeonBlueprint.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "DungeonBlueprint.h" #include "PluginInformation.h" @@ -14,19 +14,19 @@ All Rights Reserved. const FString& UDungeonBlueprint::GetPluginVersion() noexcept { - static const FString text(TEXT(DUNGENERATOR_PLUGIN_VERSION_NAME)); + static const FString text(TEXT(DUNGEON_GENERATOR_PLUGIN_VERSION_NAME)); return text; } const FString& UDungeonBlueprint::GetDocumentURL() noexcept { - static const FString text(TEXT(DUNGENERATOR_PLUGIN_DOCS_URL)); + static const FString text(TEXT(DUNGEON_GENERATOR_PLUGIN_DOCS_URL)); return text; } const FString& UDungeonBlueprint::GetSupportURL() noexcept { - static const FString text(TEXT(DUNGENERATOR_PLUGIN_SUPPORT_URL)); + static const FString text(TEXT(DUNGEON_GENERATOR_PLUGIN_SUPPORT_URL)); return text; } diff --git a/Source/DungeonGenerator/Private/DungeonGenerateActor.cpp b/Source/DungeonGenerator/Private/DungeonGenerateActor.cpp index 3832fdb..b104b2e 100644 --- a/Source/DungeonGenerator/Private/DungeonGenerateActor.cpp +++ b/Source/DungeonGenerator/Private/DungeonGenerateActor.cpp @@ -1,12 +1,12 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. - -ADungeonGeneratedActorはエディターからの静的生成時にFDungeonGenerateEditorModuleからスポーンします。 -ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配置不可能(NotPlaceable)にするため、 -継承元であるADungeonGenerateBaseをAbstract指定して共通機能をまとめています。 -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + * + * ADungeonGeneratedActorはエディターからの静的生成時にFDungeonGenerateEditorModuleからスポーンします。 + * ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配置不可能(NotPlaceable)にするため、 + * 継承元であるADungeonGenerateBaseをAbstract指定して共通機能をまとめています。 + */ #include "DungeonGenerateActor.h" #include "PluginInformation.h" @@ -35,7 +35,7 @@ ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配 ADungeonGenerateActor::ADungeonGenerateActor(const FObjectInitializer& initializer) : Super(initializer) - , BuildJobTag(TEXT(DUNGENERATOR_PLUGIN_VERSION_NAME "-" JENKINS_JOB_TAG)) + , BuildJobTag(TEXT(DUNGEON_GENERATOR_PLUGIN_VERSION_NAME "-" JENKINS_JOB_TAG)) , LicenseTag(TEXT(JENKINS_LICENSE)) , LicenseId(TEXT(JENKINS_UUID)) { @@ -121,7 +121,7 @@ void ADungeonGenerateActor::OnPostDungeonGeneration(const bool result) } } -/********** InstancedStaticMesh **********/ +////////// InstancedStaticMesh ////////// uint32 ADungeonGenerateActor::InstancedMeshHash(const FVector& position, const double quantizationSize) { uint32 x = static_cast(position.X / quantizationSize); @@ -199,7 +199,7 @@ void ADungeonGenerateActor::ApplyInstancedMeshCullDistance() } } -/********** 生成と破棄 **********/ +////////// 生成と破棄 ////////// void ADungeonGenerateActor::PreGenerateImplementation() { if (!IsValid(DungeonGenerateParameter)) diff --git a/Source/DungeonGenerator/Private/DungeonGenerateBase.cpp b/Source/DungeonGenerator/Private/DungeonGenerateBase.cpp index ac4bdc4..bcc0a88 100644 --- a/Source/DungeonGenerator/Private/DungeonGenerateBase.cpp +++ b/Source/DungeonGenerator/Private/DungeonGenerateBase.cpp @@ -1,12 +1,12 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. - -ADungeonGeneratedActorはエディターからの静的生成時にFDungeonGenerateEditorModuleからスポーンします。 -ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配置不可能(NotPlaceable)にするため、 -継承元であるADungeonGenerateBaseをAbstract指定して共通機能をまとめています。 -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + * + * ADungeonGeneratedActorはエディターからの静的生成時にFDungeonGenerateEditorModuleからスポーンします。 + * ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配置不可能(NotPlaceable)にするため、 + * 継承元であるADungeonGenerateBaseをAbstract指定して共通機能をまとめています。 + */ #include "DungeonGenerateBase.h" @@ -20,6 +20,7 @@ ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配 #include "Core/Helper/Stopwatch.h" #include "Core/Math/Math.h" #include "Core/Math/Random.h" +#include "Core/RoomGeneration/Room.h" #include "Core/Voxelization/Voxel.h" #include "MainLevel/DungeonComponentActivatorComponent.h" #include "Mission/DungeonRoomProps.h" @@ -426,7 +427,7 @@ bool ADungeonGenerateBase::BeginDungeonGeneration(const UDungeonGenerateParamete #endif DUNGEON_GENERATOR_LOG(TEXT("version '%s', license '%s', uuid '%s', commit '%s', HasAuthority '%s'"), - TEXT(DUNGENERATOR_PLUGIN_VERSION_NAME), + TEXT(DUNGEON_GENERATOR_PLUGIN_VERSION_NAME), TEXT(JENKINS_LICENSE), TEXT(JENKINS_UUID), TEXT(JENKINS_GIT_COMMIT), @@ -477,11 +478,33 @@ bool ADungeonGenerateBase::BeginDungeonGeneration(const UDungeonGenerateParamete generateParameter.SetAisleComplexity(mParameter->GetAisleComplexity()); generateParameter.SetGenerateSlopeInRoom(mParameter->GenerateSlopeInRoom); generateParameter.SetGenerateStructuralColumn(mParameter->GenerateStructuralColumn); + EDungeonStartLocationPolicy startLocationPolicy = mParameter->StartLocationPolicy; + if (mParameter->IsUseMissionGraph() == false && + (startLocationPolicy == EDungeonStartLocationPolicy::UseCentralPoint || startLocationPolicy == EDungeonStartLocationPolicy::UseMultiStart)) + { + DUNGEON_GENERATOR_WARNING(TEXT("StartLocationPolicy requires UseMissionGraph disabled. Falling back to UseSouthernMost.")); + startLocationPolicy = EDungeonStartLocationPolicy::UseSouthernMost; + } + generateParameter.SetStartLocationPolicy(static_cast(startLocationPolicy)); + uint8 startRoomCount = 1; + if (startLocationPolicy == EDungeonStartLocationPolicy::UseMultiStart) + { + TArray startPoints; + CollectPlayerStartExceptPlayerStartPIE(startPoints); + if (startPoints.IsEmpty()) + { + DUNGEON_GENERATOR_WARNING(TEXT("UseMultiStart requires at least one PlayerStart. Falling back to a single start room.")); + } + startRoomCount = static_cast(FMath::Clamp(startPoints.Num(), 1, 255)); + } + generateParameter.SetStartRoomCount(startRoomCount); + if (mParameter->MergeRooms) { generateParameter.SetHorizontalRoomMargin(0); generateParameter.SetVerticalRoomMargin(0); + generateParameter.SetExpansionPolicy(dungeon::ExpansionPolicy::ExpandHorizontally); generateParameter.SetNumberOfCandidateFloors(0); generateParameter.SetMissionGraph(false); generateParameter.SetAisleComplexity(0); @@ -489,19 +512,20 @@ bool ADungeonGenerateBase::BeginDungeonGeneration(const UDungeonGenerateParamete else { generateParameter.SetHorizontalRoomMargin(mParameter->RoomMargin); - if (mParameter->Flat) + if (mParameter->ExpansionPolicy == EDungeonExpansionPolicy::Flat) { generateParameter.SetVerticalRoomMargin(0); + generateParameter.SetExpansionPolicy(dungeon::ExpansionPolicy::Flat); generateParameter.SetNumberOfCandidateFloors(0); } else { generateParameter.SetVerticalRoomMargin(mParameter->VerticalRoomMargin); + generateParameter.SetExpansionPolicy(static_cast(mParameter->ExpansionPolicy)); generateParameter.SetNumberOfCandidateFloors(mParameter->NumberOfCandidateFloors); } } - check(generateParameter.GetMinRoomWidth() <= generateParameter.GetMaxRoomWidth()); check(generateParameter.GetMinRoomDepth() <= generateParameter.GetMaxRoomDepth()); check(generateParameter.GetMinRoomHeight() <= generateParameter.GetMaxRoomHeight()); @@ -1614,6 +1638,9 @@ void ADungeonGenerateBase::MovePlayerStart(const TArray& startPoi if (IsValid(mParameter) == false) return; + if (mParameter->StartLocationPolicy == EDungeonStartLocationPolicy::NoAdjustment) + return; + // PlayerStartをスタート位置へ移動しないならここで終了します if (mParameter->IsMovePlayerStartToStartingPoint() == false) return; @@ -1621,13 +1648,48 @@ void ADungeonGenerateBase::MovePlayerStart(const TArray& startPoi // Calculate the position to shift APlayerStart const double halfHorizontalSize = mParameter->GetGridSize().HorizontalSize / 2; const double halfVerticalSize = mParameter->GetGridSize().VerticalSize / 2; - const auto& startRoomBoundingBox = GetStartBoundingBox(); - const auto& startRoomCenterLocation = startRoomBoundingBox.GetCenter(); + TArray startRoomBoundingBoxes; + if (mParameter->StartLocationPolicy == EDungeonStartLocationPolicy::UseMultiStart) + { + if (mGenerator) + { + mGenerator->ForEach([this, &startRoomBoundingBoxes](const std::shared_ptr& room) + { + if (room->GetParts() != dungeon::Room::Parts::Start) + return; - for (int32 index = 0; index < startPoints.Num(); ++index) + FBox boundingBox( + room->GetMin() * mParameter->GetGridSize().To3D(), + room->GetMax() * mParameter->GetGridSize().To3D() + ); + startRoomBoundingBoxes.Add(boundingBox.ShiftBy(GetActorLocation())); + } + ); + } + + if (startRoomBoundingBoxes.IsEmpty()) + { + startRoomBoundingBoxes.Add(GetStartBoundingBox()); + } + } + else { + startRoomBoundingBoxes.Add(GetStartBoundingBox()); + } + + if (mParameter->StartLocationPolicy == EDungeonStartLocationPolicy::UseMultiStart && + startRoomBoundingBoxes.Num() != startPoints.Num()) + { + DUNGEON_GENERATOR_WARNING(TEXT("Start room count (%d) does not match PlayerStart count (%d)."), + startRoomBoundingBoxes.Num(), + startPoints.Num()); + } + + auto movePlayerStartToRoom = [&](APlayerStart* playerStart, const FBox& roomBoundingBox) + { + const auto& startRoomCenterLocation = roomBoundingBox.GetCenter(); + // APlayerStart cannot use GetSimpleCollisionCylinder because collision is disabled. - APlayerStart* playerStart = startPoints[index]; if (USceneComponent* rootComponent = playerStart->GetRootComponent()) { // Create a small margin to avoid grounding. @@ -1643,9 +1705,9 @@ void ADungeonGenerateBase::MovePlayerStart(const TArray& startPoi FHitResult hitResult; do { const FVector location( - FMath::RandRange(startRoomBoundingBox.Min.X + halfHorizontalSize, startRoomBoundingBox.Max.X - halfHorizontalSize), - FMath::RandRange(startRoomBoundingBox.Min.Y + halfHorizontalSize, startRoomBoundingBox.Max.Y - halfHorizontalSize), - startRoomBoundingBox.Min.Z + FMath::RandRange(roomBoundingBox.Min.X + halfHorizontalSize, roomBoundingBox.Max.X - halfHorizontalSize), + FMath::RandRange(roomBoundingBox.Min.Y + halfHorizontalSize, roomBoundingBox.Max.Y - halfHorizontalSize), + roomBoundingBox.Min.Z ); const FVector startLocation = location + FVector(0, 0, halfVerticalSize); @@ -1675,6 +1737,15 @@ void ADungeonGenerateBase::MovePlayerStart(const TArray& startPoi { DUNGEON_GENERATOR_ERROR(TEXT("PlayerStart's RootComponent was not set and could not be moved (%s)"), *playerStart->GetName()); } + }; + + for (int32 index = 0; index < startPoints.Num(); ++index) + { + APlayerStart* playerStart = startPoints[index]; + const int32 boundingBoxIndex = startRoomBoundingBoxes.Num() == 0 + ? 0 + : (index % startRoomBoundingBoxes.Num()); + movePlayerStartToRoom(playerStart, startRoomBoundingBoxes[boundingBoxIndex]); } } diff --git a/Source/DungeonGenerator/Private/DungeonGeneratedActor.cpp b/Source/DungeonGenerator/Private/DungeonGeneratedActor.cpp index 92cd668..c05c75a 100644 --- a/Source/DungeonGenerator/Private/DungeonGeneratedActor.cpp +++ b/Source/DungeonGenerator/Private/DungeonGeneratedActor.cpp @@ -1,12 +1,12 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. - -ADungeonGeneratedActorはエディターからの静的生成時にFDungeonGenerateEditorModuleからスポーンします。 -ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配置不可能(NotPlaceable)にするため、 -継承元であるADungeonGenerateBaseをAbstract指定して共通機能をまとめています。 -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + * + * ADungeonGeneratedActorはエディターからの静的生成時にFDungeonGenerateEditorModuleからスポーンします。 + * ADungeonGenerateActorは配置可能(Placeable)、ADungeonGeneratedActorは配置不可能(NotPlaceable)にするため、 + * 継承元であるADungeonGenerateBaseをAbstract指定して共通機能をまとめています。 + */ #include "DungeonGeneratedActor.h" diff --git a/Source/DungeonGenerator/Private/DungeonGeneratorModule.cpp b/Source/DungeonGenerator/Private/DungeonGeneratorModule.cpp index 6b40cea..65fbd05 100644 --- a/Source/DungeonGenerator/Private/DungeonGeneratorModule.cpp +++ b/Source/DungeonGenerator/Private/DungeonGeneratorModule.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "DungeonGeneratorModule.h" diff --git a/Source/DungeonGenerator/Private/DungeonInstancedMeshCluster.cpp b/Source/DungeonGenerator/Private/DungeonInstancedMeshCluster.cpp index b24e91f..3b2bf1b 100644 --- a/Source/DungeonGenerator/Private/DungeonInstancedMeshCluster.cpp +++ b/Source/DungeonGenerator/Private/DungeonInstancedMeshCluster.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ #include "DungeonInstancedMeshCluster.h" #include "DungeonGenerateBase.h" diff --git a/Source/DungeonGenerator/Private/Helper/DungeonAisleGridMap.cpp b/Source/DungeonGenerator/Private/Helper/DungeonAisleGridMap.cpp index a18588b..7ca2f25 100644 --- a/Source/DungeonGenerator/Private/Helper/DungeonAisleGridMap.cpp +++ b/Source/DungeonGenerator/Private/Helper/DungeonAisleGridMap.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ /* 通路グリッドをまとめたマップクラス diff --git a/Source/DungeonGenerator/Private/Helper/DungeonDebugUtility.h b/Source/DungeonGenerator/Private/Helper/DungeonDebugUtility.h index c5ebc50..a3e87c8 100644 --- a/Source/DungeonGenerator/Private/Helper/DungeonDebugUtility.h +++ b/Source/DungeonGenerator/Private/Helper/DungeonDebugUtility.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include diff --git a/Source/DungeonGenerator/Private/Helper/DungeonLevelStreamingActor.cpp b/Source/DungeonGenerator/Private/Helper/DungeonLevelStreamingActor.cpp index 8cabfb1..cc56e64 100644 --- a/Source/DungeonGenerator/Private/Helper/DungeonLevelStreamingActor.cpp +++ b/Source/DungeonGenerator/Private/Helper/DungeonLevelStreamingActor.cpp @@ -1,11 +1,11 @@ /** -Helper class that loads the level when the player enters the OverlapVolume -プレイヤーが OverlapVolume に入るときにレベルをロードするヘルパークラス - -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * Helper class that loads the level when the player enters the OverlapVolume + * プレイヤーが OverlapVolume に入るときにレベルをロードするヘルパークラス + * + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Helper/DungeonLevelStreamingActor.h" #include diff --git a/Source/DungeonGenerator/Private/Helper/DungeonRandom.cpp b/Source/DungeonGenerator/Private/Helper/DungeonRandom.cpp index b31a092..de2a116 100644 --- a/Source/DungeonGenerator/Private/Helper/DungeonRandom.cpp +++ b/Source/DungeonGenerator/Private/Helper/DungeonRandom.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ /* 共通ランダムクラス diff --git a/Source/DungeonGenerator/Private/MainLevel/DungeonComponentActivatorComponent.cpp b/Source/DungeonGenerator/Private/MainLevel/DungeonComponentActivatorComponent.cpp index 8b06a8d..1dbe164 100644 --- a/Source/DungeonGenerator/Private/MainLevel/DungeonComponentActivatorComponent.cpp +++ b/Source/DungeonGenerator/Private/MainLevel/DungeonComponentActivatorComponent.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "MainLevel/DungeonComponentActivatorComponent.h" #include "MainLevel/DungeonMainLevelScriptActor.h" diff --git a/Source/DungeonGenerator/Private/MainLevel/DungeonMainLevelScriptActor.cpp b/Source/DungeonGenerator/Private/MainLevel/DungeonMainLevelScriptActor.cpp index a75f2a4..3167229 100644 --- a/Source/DungeonGenerator/Private/MainLevel/DungeonMainLevelScriptActor.cpp +++ b/Source/DungeonGenerator/Private/MainLevel/DungeonMainLevelScriptActor.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "MainLevel/DungeonMainLevelScriptActor.h" #include "MainLevel/DungeonComponentActivatorComponent.h" @@ -28,8 +28,8 @@ All Rights Reserved. ADungeonMainLevelScriptActor::ADungeonMainLevelScriptActor(const FObjectInitializer& objectInitializer) : Super(objectInitializer) - , mActiveRegionExtent(0) , mLastEnableLoadControl(bEnableLoadControl) + , mActiveRegionExtent(0) { PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.bStartWithTickEnabled = true; @@ -130,10 +130,11 @@ void ADungeonMainLevelScriptActor::PreInitializeComponents() mBoundingSize = boundingSize.Y; // パーティエーションを生成 - mPartitionWidth = static_cast(std::ceil(boundingSize.X / mPartitionSize)); - mPartitionDepth = static_cast(std::ceil(boundingSize.Y / mPartitionSize)); - DungeonPartitions.Reserve(mPartitionWidth * mPartitionDepth); - for (size_t i = 0; i < mPartitionWidth * mPartitionDepth; ++i) + mPartitionWidth = std::ceil(boundingSize.X / mPartitionSize); + mPartitionDepth = std::ceil(boundingSize.Y / mPartitionSize); + mPartitionHeight = std::ceil(boundingSize.Z / mPartitionSize); + DungeonPartitions.Reserve(mPartitionWidth * mPartitionDepth * mPartitionHeight); + for (size_t i = 0; i < mPartitionWidth * mPartitionDepth * mPartitionHeight; ++i) { DungeonPartitions.Add(NewObject(this)); } @@ -158,7 +159,7 @@ void ADungeonMainLevelScriptActor::EndPlay(const EEndPlayReason::Type endPlayRea { Super::EndPlay(endPlayReason); - mPartitionWidth = mPartitionDepth = 0; + mPartitionWidth = mPartitionDepth = mPartitionHeight = 0; DungeonPartitions.Reset(); mBounding.Init(); } @@ -237,20 +238,66 @@ UDungeonPartition* ADungeonMainLevelScriptActor::Find(const FVector& worldLocati return nullptr; if (localLocation.Y < 0 || mPartitionDepth <= localLocation.Y) return nullptr; + if (localLocation.Z < 0 || mPartitionHeight <= localLocation.Z) + return nullptr; const size_t x = static_cast(localLocation.X); const size_t y = static_cast(localLocation.Y); - return Index(x, y); + const size_t z = static_cast(localLocation.Z); + return Index(x, y, z); } -/* - * スレッドセーフにして下さい - */ -UDungeonPartition* ADungeonMainLevelScriptActor::Index(const size_t x, const size_t y) const noexcept +size_t ADungeonMainLevelScriptActor::ToIndex(const size_t x, const size_t y, const size_t z) const noexcept +{ + check(x < mPartitionWidth); + check(y < mPartitionDepth); + check(z < mPartitionHeight); + return mPartitionWidth * mPartitionDepth * z + mPartitionWidth * y + x; +} + +size_t ADungeonMainLevelScriptActor::ToIndex(const FIntVector& vector) const noexcept +{ + return ToIndex(vector.X, vector.Y, vector.Z); +} + +size_t ADungeonMainLevelScriptActor::ToIndex(const FVector& vector) const noexcept +{ + return ToIndex(vector.X, vector.Y, vector.Z); +} + +FIntVector ADungeonMainLevelScriptActor::ToIntVector(const size_t index) const noexcept +{ + const int32 x = index % mPartitionWidth; + const int32 y = index / mPartitionWidth % mPartitionDepth; + const int32 z = index / (mPartitionWidth * mPartitionDepth); + check(x < mPartitionWidth); + check(y < mPartitionDepth); + check(z < mPartitionHeight); + return { x, y, z }; +} + +FVector ADungeonMainLevelScriptActor::ToVector(const size_t index) const noexcept { + const int32 x = index % mPartitionWidth; + const int32 y = index / mPartitionWidth % mPartitionDepth; + const int32 z = index / (mPartitionWidth * mPartitionDepth); check(x < mPartitionWidth); check(y < mPartitionDepth); - const size_t index = mPartitionWidth * y + x; + check(z < mPartitionHeight); + return FVector(x, y, z); +} + +UDungeonPartition* ADungeonMainLevelScriptActor::Index(const size_t x, const size_t y, const size_t z) const noexcept +{ + const size_t index = ToIndex(x, y, z); + UDungeonPartition* partition = DungeonPartitions[index]; + check(IsValid(partition)); + return partition; +} + +UDungeonPartition* ADungeonMainLevelScriptActor::Index(const FIntVector& vector) const noexcept +{ + const size_t index = ToIndex(vector); UDungeonPartition* partition = DungeonPartitions[index]; check(IsValid(partition)); return partition; @@ -315,13 +362,18 @@ void ADungeonMainLevelScriptActor::Mark(const FVector& playerLocation) const const FVector end = (activeBounds.Max - mBounding.Min) / mPartitionSize; const int32_t sx = std::max(0.0, start.X); const int32_t sy = std::max(0.0, start.Y); + const int32_t sz = std::max(0.0, start.Z); const int32_t ex = std::min(std::ceil(end.X), mPartitionWidth); const int32_t ey = std::min(std::ceil(end.Y), mPartitionDepth); - for (int32_t y = sy; y < ey; ++y) + const int32_t ez = std::min(std::ceil(end.Z), mPartitionHeight); + for (int32_t z = sz; z < ez; ++z) { - for (int32_t x = sx; x < ex; ++x) + for (int32_t y = sy; y < ey; ++y) { - Index(x, y)->Mark(); + for (int32_t x = sx; x < ex; ++x) + { + Index(x, y, z)->Mark(); + } } } } @@ -334,17 +386,9 @@ void ADungeonMainLevelScriptActor::Mark(const FSceneView* sceneView) const const FVector partitionExtent(mPartitionSize * 0.5); ParallelFor(DungeonPartitions.Num(), [this, sceneView, partitionExtent](const size_t index) { - const double x = index % mPartitionWidth * mPartitionSize; - const double y = index / mPartitionWidth * mPartitionSize; - const FVector origin( - mBounding.Min.X + x + partitionExtent.X, - mBounding.Min.Y + y + partitionExtent.Y, - mBounding.Min.Z + (mBounding.Max.Z - mBounding.Min.Z) * 0.5 - ); - // 視点から遠すぎる場合は計算をスキップ - const double distance = FVector::Dist2D(sceneView->ViewLocation, origin); - if (distance < mActiveViewRange) + const auto& origin = ToVector(index) * mPartitionSize + partitionExtent; + if (FVector::Distance(sceneView->ViewLocation, origin) < mActiveViewRange) { // パーティエーションが視錐台と交差している if (sceneView->ViewFrustum.IntersectBox(origin, partitionExtent)) @@ -536,7 +580,7 @@ bool ADungeonMainLevelScriptActor::TestSegmentAABB(const FVector& segmentStart, } void ADungeonMainLevelScriptActor::DrawFrustumLines( - UWorld* world, const FVector& viewLocation, const FRotator& viewRotation, + const UWorld* world, const FVector& viewLocation, const FRotator& viewRotation, float FovY, float aspect, float nearDistance, float farDistance, const FColor& color, float lifeTime, float thickness) { @@ -575,27 +619,29 @@ void ADungeonMainLevelScriptActor::DrawFrustumLines( void ADungeonMainLevelScriptActor::DrawDebugInformation() const { // パーティエーションの状態を線で描画します - const double h = (mBounding.Max.Z - mBounding.Min.Z) * 0.5; - const double z = mBounding.Min.Z; - constexpr double margin = 10; - const FVector halfSize(mPartitionSize * 0.5 - margin, mPartitionSize * 0.5 - margin, h - margin); - for (double y = mBounding.Min.Y; y < mBounding.Max.Y; y += mPartitionSize) + constexpr double Margin = 10; + const FVector offset(mPartitionSize * 0.5); + const FVector halfSize(offset - FVector(Margin)); + for (double z = mBounding.Min.Z; z < mBounding.Max.Z; z += mPartitionSize) { - for (double x = mBounding.Min.X; x < mBounding.Max.X; x += mPartitionSize) + for (double y = mBounding.Min.Y; y < mBounding.Max.Y; y += mPartitionSize) { - if (const auto* partition = Find(FVector(x + 1, y + 1, z))) + for (double x = mBounding.Min.X; x < mBounding.Max.X; x += mPartitionSize) { - const auto color = partition->IsMarked() ? FColor::Red : FColor::Blue; - const FVector location(x, y, z); - UKismetSystemLibrary::DrawDebugBox( - GetWorld(), - location + halfSize, - halfSize, - color, - FRotator::ZeroRotator, - 0.f, - 10.f - ); + const FVector worldLocation(x, y, z); + if (const auto* partition = Find(worldLocation + FVector::One())) + { + const auto color = partition->IsMarked() ? FColor::Red : FColor::Blue; + UKismetSystemLibrary::DrawDebugBox( + GetWorld(), + worldLocation + offset, + halfSize, + color, + FRotator::ZeroRotator, + 0.f, + 10.f + ); + } } } } @@ -603,11 +649,11 @@ void ADungeonMainLevelScriptActor::DrawDebugInformation() const // 有効な範囲を黄色い線で描画します if (const UWorld* world = GetValid(GetWorld())) { - for (FConstPlayerControllerIterator iterator = world->GetPlayerControllerIterator(); iterator; ++iterator) + for (auto iterator = world->GetPlayerControllerIterator(); iterator; ++iterator) { if (const auto* playerController = iterator->Get()) { - const auto& playerPawn = playerController->GetPawn(); + const APawn* playerPawn = playerController->GetPawn(); if (IsValid(playerPawn) && playerPawn->IsPlayerControlled()) { UKismetSystemLibrary::DrawDebugBox( diff --git a/Source/DungeonGenerator/Private/MainLevel/DungeonPartition.cpp b/Source/DungeonGenerator/Private/MainLevel/DungeonPartition.cpp index 797b74f..1ecdb14 100644 --- a/Source/DungeonGenerator/Private/MainLevel/DungeonPartition.cpp +++ b/Source/DungeonGenerator/Private/MainLevel/DungeonPartition.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "MainLevel/DungeonPartition.h" #include "MainLevel/DungeonComponentActivatorComponent.h" diff --git a/Source/DungeonGenerator/Private/Mission/DungeonRoomItem.cpp b/Source/DungeonGenerator/Private/Mission/DungeonRoomItem.cpp index 64f9ccb..6c2243b 100644 --- a/Source/DungeonGenerator/Private/Mission/DungeonRoomItem.cpp +++ b/Source/DungeonGenerator/Private/Mission/DungeonRoomItem.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Mission/DungeonRoomItem.h" diff --git a/Source/DungeonGenerator/Private/Mission/DungeonRoomParts.cpp b/Source/DungeonGenerator/Private/Mission/DungeonRoomParts.cpp index f1af392..5792187 100644 --- a/Source/DungeonGenerator/Private/Mission/DungeonRoomParts.cpp +++ b/Source/DungeonGenerator/Private/Mission/DungeonRoomParts.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Mission/DungeonRoomParts.h" diff --git a/Source/DungeonGenerator/Private/Mission/DungeonRoomProps.cpp b/Source/DungeonGenerator/Private/Mission/DungeonRoomProps.cpp index 5b8f1b7..16d74bf 100644 --- a/Source/DungeonGenerator/Private/Mission/DungeonRoomProps.cpp +++ b/Source/DungeonGenerator/Private/Mission/DungeonRoomProps.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Mission/DungeonRoomProps.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonActorParts.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonActorParts.cpp index 574f26a..cefbd18 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonActorParts.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonActorParts.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonActorParts.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonActorPartsWithDirection.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonActorPartsWithDirection.cpp index 5bcbf96..7aa1f5e 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonActorPartsWithDirection.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonActorPartsWithDirection.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonActorPartsWithDirection.h" #include "Parameter/DungeonPartsTransform.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonDoorActorParts.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonDoorActorParts.cpp index 2a97357..ec091ee 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonDoorActorParts.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonDoorActorParts.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonDoorActorParts.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonGenerateParameter.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonGenerateParameter.cpp index 1665adb..efa7ddc 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonGenerateParameter.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonGenerateParameter.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonGenerateParameter.h" #include "PluginInformation.h" @@ -22,7 +22,7 @@ All Rights Reserved. UDungeonGenerateParameter::UDungeonGenerateParameter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) - , PluginVersion(DUNGENERATOR_PLUGIN_VERSION) + , PluginVersion(DUNGEON_GENERATOR_PLUGIN_VERSION) { } @@ -63,12 +63,13 @@ void UDungeonGenerateParameter::SetRandomParameter() noexcept RoomDepth.Max = RoomDepth.Min + random->Get(1, 5); RoomHeight.Min = random->Get(1, 3); RoomHeight.Max = RoomHeight.Min + random->Get(1, 3); - RoomMargin = random->Get(1, 5); - VerticalRoomMargin = random->Get(5); - NumberOfCandidateRooms = random->Get(5, 50); - NumberOfCandidateFloors = random->Get(5); - MergeRooms = random->Get(); - Flat = random->Get(); + RoomMargin = random->Get(1, 5); + VerticalRoomMargin = random->Get(5); + NumberOfCandidateRooms = random->Get(5, 50); + NumberOfCandidateFloors = random->Get(5); + MergeRooms = random->Get(); + ExpansionPolicy = static_cast(random->Get(0, static_cast(EDungeonExpansionPolicy::Flat))); + Flat = ExpansionPolicy == EDungeonExpansionPolicy::Flat; GenerateSlopeInRoom = random->Get(); GenerateStructuralColumn = random->Get(); @@ -108,6 +109,38 @@ bool UDungeonGenerateParameter::IsSupportedForNetworking() const return true; } +void UDungeonGenerateParameter::PostLoad() +{ + Super::PostLoad(); + + if (Flat && ExpansionPolicy != EDungeonExpansionPolicy::Flat) + { + ExpansionPolicy = EDungeonExpansionPolicy::Flat; + } + + if (ExpansionPolicy == EDungeonExpansionPolicy::Flat) + { + Flat = false; + } + + if (MovePlayerStartToStartingPoint == false && StartLocationPolicy != EDungeonStartLocationPolicy::NoAdjustment) + { + StartLocationPolicy = EDungeonStartLocationPolicy::NoAdjustment; + } + + if (StartLocationPolicy == EDungeonStartLocationPolicy::NoAdjustment) + { + MovePlayerStartToStartingPoint = false; + } + + if (UseMissionGraph && + (StartLocationPolicy == EDungeonStartLocationPolicy::UseCentralPoint || + StartLocationPolicy == EDungeonStartLocationPolicy::UseMultiStart)) + { + StartLocationPolicy = EDungeonStartLocationPolicy::UseSouthernMost; + } +} + #if WITH_EDITOR void UDungeonGenerateParameter::Dump() const @@ -191,7 +224,7 @@ void UDungeonGenerateParameter::DumpToJson() const FString jsonString(TEXT("{\n")); { - jsonString += TEXT(" \"Version\":\"") + FString(TEXT(DUNGENERATOR_PLUGIN_VERSION_NAME)) + TEXT("\",\n"); + jsonString += TEXT(" \"Version\":\"") + FString(TEXT(DUNGEON_GENERATOR_PLUGIN_VERSION_NAME)) + TEXT("\",\n"); jsonString += TEXT(" \"Tag\":\"") + FString(TEXT(JENKINS_JOB_TAG)) + TEXT("\",\n"); jsonString += TEXT(" \"UUID\":\"") + FString(TEXT(JENKINS_UUID)) + TEXT("\",\n"); jsonString += TEXT(" \"License\":\"") + FString(TEXT(JENKINS_LICENSE)) + TEXT("\",\n"); diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonMeshParts.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonMeshParts.cpp index 5eb4a2e..df0b30d 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonMeshParts.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonMeshParts.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonMeshParts.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonMeshPartsWithDirection.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonMeshPartsWithDirection.cpp index 55877d5..9bf470d 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonMeshPartsWithDirection.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonMeshPartsWithDirection.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonMeshPartsWithDirection.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonMeshSet.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonMeshSet.cpp index b5204fb..0703a61 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonMeshSet.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonMeshSet.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonMeshSet.h" #include "Parameter/DungeonActorParts.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonMeshSetDatabase.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonMeshSetDatabase.cpp index 4319451..8a67d5f 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonMeshSetDatabase.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonMeshSetDatabase.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonMeshSetDatabase.h" #include "Core/Debug/Debug.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonPartsTransform.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonPartsTransform.cpp index 00af06a..fc2fabf 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonPartsTransform.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonPartsTransform.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonPartsTransform.h" #include "Core/Helper/Direction.h" diff --git a/Source/DungeonGenerator/Private/Parameter/DungeonRandomActorParts.cpp b/Source/DungeonGenerator/Private/Parameter/DungeonRandomActorParts.cpp index c619ab9..82b4901 100644 --- a/Source/DungeonGenerator/Private/Parameter/DungeonRandomActorParts.cpp +++ b/Source/DungeonGenerator/Private/Parameter/DungeonRandomActorParts.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonRandomActorParts.h" diff --git a/Source/DungeonGenerator/Private/PluginInformation.h b/Source/DungeonGenerator/Private/PluginInformation.h index 1de3bda..45c48ac 100644 --- a/Source/DungeonGenerator/Private/PluginInformation.h +++ b/Source/DungeonGenerator/Private/PluginInformation.h @@ -1,19 +1,19 @@ /*! -This is automatically generated file. -DO NOT EDIT THIS FILE. -\author Shun Moriya -\copyright 2023- Shun Moriya +This is automatically generated file. +DO NOT EDIT THIS FILE. +\author Shun Moriya +\copyright 2023- Shun Moriya All Rights Reserved. */ #pragma once -#if !defined(DUNGENERATOR_PLUGIN_INFORMATION_DETECTED) -#define DUNGENERATOR_PLUGIN_INFORMATION_DETECTED -#define DUNGENERATOR_PLUGIN_FILE_VERSION 3 -#define DUNGENERATOR_PLUGIN_VERSION 0 -#define DUNGENERATOR_PLUGIN_VERSION_NAME "1.0.0" -#define DUNGENERATOR_PLUGIN_FRIENDLY_NAME "Procedural 3D Dungeon Generator" -#define DUNGENERATOR_PLUGIN_DESCRIPTION "Procedural 3D dungeon generator plugin. Easy generation of levels, mini-maps and missions." -#define DUNGENERATOR_PLUGIN_DOCS_URL "https://github.com/shun126/UE5-DungeonGeneratorDemo/wiki" -#define DUNGENERATOR_PLUGIN_SUPPORT_URL "https://github.com/shun126/UE5-DungeonGeneratorDemo/discussions/" -#define DUNGENERATOR_PLUGIN_BETA_VERSION true +#if !defined(DUNGEON_GENERATOR_PLUGIN_INFORMATION_DETECTED) +#define DUNGEON_GENERATOR_PLUGIN_INFORMATION_DETECTED +#define DUNGEON_GENERATOR_PLUGIN_FILE_VERSION 3 +#define DUNGEON_GENERATOR_PLUGIN_VERSION 63 +#define DUNGEON_GENERATOR_PLUGIN_VERSION_NAME "1.8.0" +#define DUNGEON_GENERATOR_PLUGIN_FRIENDLY_NAME "Dungeon Generator" +#define DUNGEON_GENERATOR_PLUGIN_DESCRIPTION "Procedural 3d dungeon generator plugin. Easy generation of levels, mini-maps and missions." +#define DUNGEON_GENERATOR_PLUGIN_DOCS_URL "https://github.com/shun126/UE5-DungeonGeneratorDemo/wiki" +#define DUNGEON_GENERATOR_PLUGIN_SUPPORT_URL "https://github.com/shun126/DungeonGenerator/discussions" +#define DUNGEON_GENERATOR_PLUGIN_BETA_VERSION true #endif diff --git a/Source/DungeonGenerator/Private/SubActor/DungeonActorSpawnDirector.cpp b/Source/DungeonGenerator/Private/SubActor/DungeonActorSpawnDirector.cpp index 8700a46..1f70ae1 100644 --- a/Source/DungeonGenerator/Private/SubActor/DungeonActorSpawnDirector.cpp +++ b/Source/DungeonGenerator/Private/SubActor/DungeonActorSpawnDirector.cpp @@ -2,7 +2,7 @@ * @author Shun Moriya * @copyright 2025- Shun Moriya * All Rights Reserved. - * + * * A spawner class that spawns actors at regular intervals. * ADungeonActorSpawnDirector provides the ability to spawn actors in the game at specified intervals. * The type of actor to be spawned and the probability of its occurrence are defined by the FDungeonSpawnActorParameter structure. diff --git a/Source/DungeonGenerator/Private/SubActor/DungeonDoorBase.cpp b/Source/DungeonGenerator/Private/SubActor/DungeonDoorBase.cpp index 6c5fbc8..8320852 100644 --- a/Source/DungeonGenerator/Private/SubActor/DungeonDoorBase.cpp +++ b/Source/DungeonGenerator/Private/SubActor/DungeonDoorBase.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "SubActor/DungeonDoorBase.h" #include "Core/Helper/Crc.h" diff --git a/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorBase.cpp b/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorBase.cpp index 8c617d3..e7fb925 100644 --- a/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorBase.cpp +++ b/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorBase.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "SubActor/DungeonRoomSensorBase.h" #include "SubActor/DungeonDoorBase.h" diff --git a/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorDatabase.cpp b/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorDatabase.cpp index cc5bce5..571064c 100644 --- a/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorDatabase.cpp +++ b/Source/DungeonGenerator/Private/SubActor/DungeonRoomSensorDatabase.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "SubActor/DungeonRoomSensorDatabase.h" #include "Core/Math/Random.h" diff --git a/Source/DungeonGenerator/Private/SubActor/DungeonVerifiableActor.cpp b/Source/DungeonGenerator/Private/SubActor/DungeonVerifiableActor.cpp index 148ae20..31aea75 100644 --- a/Source/DungeonGenerator/Private/SubActor/DungeonVerifiableActor.cpp +++ b/Source/DungeonGenerator/Private/SubActor/DungeonVerifiableActor.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #include "SubActor/DungeonVerifiableActor.h" #include "Core/Helper/Crc.h" diff --git a/Source/DungeonGenerator/Public/DungeonBlueprint.h b/Source/DungeonGenerator/Public/DungeonBlueprint.h index 1b25a78..42342c4 100644 --- a/Source/DungeonGenerator/Public/DungeonBlueprint.h +++ b/Source/DungeonGenerator/Public/DungeonBlueprint.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -12,9 +12,9 @@ All Rights Reserved. class ADungeonRoomSensorBase; /** -BluePrint function library -ダンジョン生成ブループリント関数 -*/ + * BluePrint function library + * ダンジョン生成ブループリント関数 + */ UCLASS(ClassGroup = "DungeonGenerator") class UDungeonBlueprint : public UBlueprintFunctionLibrary { @@ -22,72 +22,72 @@ class UDungeonBlueprint : public UBlueprintFunctionLibrary public: /** - Get the version of the plugin - プラグインのバージョンを取得します - */ + * Get the version of the plugin + * プラグインのバージョンを取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static const FString& GetPluginVersion() noexcept; /** - Get the URL of the plugin document - プラグインドキュメントのURLを取得します - */ + * Get the URL of the plugin document + * プラグインドキュメントのURLを取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static const FString& GetDocumentURL() noexcept; /** - Get the URL of the plugin support page - プラグインサポートページのURLを取得します - */ + * Get the URL of the plugin support page + * プラグインサポートページのURLを取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static const FString& GetSupportURL() noexcept; /** - Get build tag - ビルドタグを取得します - */ + * Get build tag + * ビルドタグを取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static const FString& GetBuildTag() noexcept; /** - Get commit ID - コミットIDを取得します - */ + * Get commit ID + * コミットIDを取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static const FString& GetCommitID() noexcept; /** - Get the plugin identifier - プラグインの識別子を取得します - */ + * Get the plugin identifier + * プラグインの識別子を取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static const FString& GetIdentifier() noexcept; /** - Get License Type - ライセンスを取得します - */ + * Get License Type + * ライセンスを取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static const FString& GetLicenseType() noexcept; /** - Transform from world location to texture location - ワールドの位置からテクスチャの位置へ変換します - */ + * Transform from world location to texture location + * ワールドの位置からテクスチャの位置へ変換します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") static FVector2D TransformWorldToTexture(const FVector worldLocation, const float worldToTextureScale) noexcept; /** - Find DungeonRoomSensorBase by location - 位置からDungeonRoomSensorBaseを検索します - */ + * Find DungeonRoomSensorBase by location + * 位置からDungeonRoomSensorBaseを検索します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator", meta = (WorldContext = "worldContextObject")) static ADungeonRoomSensorBase* FindDungeonRoomSensorByLocation(const UObject* worldContextObject, const FVector location) noexcept; /** - Find DungeonRoomSensorBase from the player - プレイヤーからDungeonRoomSensorBaseを検索します - */ + * Find DungeonRoomSensorBase from the player + * プレイヤーからDungeonRoomSensorBaseを検索します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator", meta = (WorldContext = "worldContextObject")) static ADungeonRoomSensorBase* FindDungeonRoomSensorFromPlayer(const UObject* worldContextObject, const int32 playerIndex) noexcept; }; diff --git a/Source/DungeonGenerator/Public/DungeonGenerateActor.h b/Source/DungeonGenerator/Public/DungeonGenerateActor.h index d23c78f..9d2c842 100644 --- a/Source/DungeonGenerator/Public/DungeonGenerateActor.h +++ b/Source/DungeonGenerator/Public/DungeonGenerateActor.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonGenerateBase.h" @@ -245,7 +245,7 @@ class DUNGEONGENERATOR_API ADungeonGenerateActor : public ADungeonGenerateBase /** * Location of the starting room of the dungeon * PlayerStart location can be found in Get All Actors of Class - * + * * ダンジョンのスタート部屋の位置 * PlayerStartの位置はGet All Actors of Classで検索して下さい */ diff --git a/Source/DungeonGenerator/Public/DungeonGenerateBase.h b/Source/DungeonGenerator/Public/DungeonGenerateBase.h index 3357273..2ca5f05 100644 --- a/Source/DungeonGenerator/Public/DungeonGenerateBase.h +++ b/Source/DungeonGenerator/Public/DungeonGenerateBase.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Helper/DungeonRandom.h" @@ -56,7 +56,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDungeonGenerateBaseOnEndGenerateSi * This is a collection of dungeon generation functions common to both runtime and editor. * Cannot be spawned or placed because it is a virtual class. * Please use derived classes to generate instances. - * + * * ランタイム、エディタ共通のダンジョン生成機能をまとめています。 * 仮想クラスなのでスポーンや配置をする事ができません。 * インスタンスを生成する場合は派生クラスを利用して下さい。 @@ -95,10 +95,10 @@ class DUNGEONGENERATOR_API ADungeonGenerateBase : public AActor /** * Begin Generate dungeon * After generation is complete, be sure to call EndDungeonGeneration. - * + * * ダンジョン生成開始 * 生成完了後、必ずEndDungeonGenerationを呼び出してください。 - * + * * @param[in] parameter UDungeonGenerateParameter * @param[in] hasAuthority HasAuthority * @return If false, generation fails @@ -192,22 +192,22 @@ class DUNGEONGENERATOR_API ADungeonGenerateBase : public AActor //////////////////////////////////////////////////////////////////////////// protected: /** - Get dungeon generation core object. - @return dungeon::Generator - */ + * Get dungeon generation core object. + * @return dungeon::Generator + */ std::shared_ptr GetGenerator() const; /** - Notification when a dungeon is successfully created - ダンジョンの生成に成功した時の通知 - */ + * Notification when a dungeon is successfully created + * ダンジョンの生成に成功した時の通知 + */ UPROPERTY(BlueprintAssignable, Category = "DungeonGenerator|Event") FDungeonGeneratorActorNotifyGenerationSuccessSignature OnGenerationSuccess; /** - Notification when dungeon creation fails - ダンジョンの生成に失敗した時の通知 - */ + * Notification when dungeon creation fails + * ダンジョンの生成に失敗した時の通知 + */ UPROPERTY(BlueprintAssignable, Category = "DungeonGenerator|Event") FDungeonGeneratorActorNotifyGenerationFailureSignature OnGenerationFailure; @@ -324,13 +324,13 @@ class DUNGEONGENERATOR_API ADungeonGenerateBase : public AActor virtual void FitNavMeshBoundsVolume(); /** - PlayerStartPIEアクターを除くPlayerStartアクターを収集してstartPointsに記録します - */ + * PlayerStartPIEアクターを除くPlayerStartアクターを収集してstartPointsに記録します + */ void CollectPlayerStartExceptPlayerStartPIE(TArray& startPoints); /** - PlayerStartアクターを移動します - */ + * PlayerStartアクターを移動します + */ void MovePlayerStart(const TArray& startPoints); private: @@ -368,9 +368,9 @@ class DUNGEONGENERATOR_API ADungeonGenerateBase : public AActor // Debug public: /** - Calculate CRC32 - @return CRC32 - */ + * Calculate CRC32 + * @return CRC32 + */ uint32_t CalculateCRC32() const noexcept; #if WITH_EDITOR diff --git a/Source/DungeonGenerator/Public/DungeonGeneratedActor.h b/Source/DungeonGenerator/Public/DungeonGeneratedActor.h index 954a66d..df400b0 100644 --- a/Source/DungeonGenerator/Public/DungeonGeneratedActor.h +++ b/Source/DungeonGenerator/Public/DungeonGeneratedActor.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonGenerateBase.h" diff --git a/Source/DungeonGenerator/Public/DungeonGeneratorModule.h b/Source/DungeonGenerator/Public/DungeonGeneratorModule.h index a5cc6dc..b2c98ef 100644 --- a/Source/DungeonGenerator/Public/DungeonGeneratorModule.h +++ b/Source/DungeonGenerator/Public/DungeonGeneratorModule.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include #include /** -Dungeon generator module -ダンジョン生成モジュール -*/ + * Dungeon generator module + * ダンジョン生成モジュール + */ class FDungeonGeneratorModule : public IModuleInterface { public: diff --git a/Source/DungeonGenerator/Public/DungeonInstancedMeshCluster.h b/Source/DungeonGenerator/Public/DungeonInstancedMeshCluster.h index 0012a53..8a8ec65 100644 --- a/Source/DungeonGenerator/Public/DungeonInstancedMeshCluster.h +++ b/Source/DungeonGenerator/Public/DungeonInstancedMeshCluster.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ #pragma once #include diff --git a/Source/DungeonGenerator/Public/Helper/DungeonAisleGridMap.h b/Source/DungeonGenerator/Public/Helper/DungeonAisleGridMap.h index a4e20d1..432f268 100644 --- a/Source/DungeonGenerator/Public/Helper/DungeonAisleGridMap.h +++ b/Source/DungeonGenerator/Public/Helper/DungeonAisleGridMap.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Helper/DungeonDirection.h" @@ -61,7 +61,7 @@ class DUNGEONGENERATOR_API UDungeonAisleGridMap : public UObject /** * Register aisle grid * 通路グリッドを登録します - */ + */ void Register(const int32 identifier, const EDungeonDirection direction, const FVector& location); /** diff --git a/Source/DungeonGenerator/Public/Helper/DungeonDirection.h b/Source/DungeonGenerator/Public/Helper/DungeonDirection.h index f1f3d44..b1866f9 100644 --- a/Source/DungeonGenerator/Public/Helper/DungeonDirection.h +++ b/Source/DungeonGenerator/Public/Helper/DungeonDirection.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ #pragma once #include diff --git a/Source/DungeonGenerator/Public/Helper/DungeonLevelStreamingActor.h b/Source/DungeonGenerator/Public/Helper/DungeonLevelStreamingActor.h index 95e8a77..7810651 100644 --- a/Source/DungeonGenerator/Public/Helper/DungeonLevelStreamingActor.h +++ b/Source/DungeonGenerator/Public/Helper/DungeonLevelStreamingActor.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -12,9 +12,9 @@ All Rights Reserved. class UBoxComponent; /** -Helper class that loads the level when the player enters the OverlapVolume -プレイヤーが OverlapVolume に入るときにレベルをロードするヘルパークラス -*/ + * Helper class that loads the level when the player enters the OverlapVolume + * プレイヤーが OverlapVolume に入るときにレベルをロードするヘルパークラス + */ UCLASS(ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API ADungeonLevelStreamingActor : public AActor { @@ -22,13 +22,13 @@ class DUNGEONGENERATOR_API ADungeonLevelStreamingActor : public AActor public: /** - constructor - */ + * constructor + */ explicit ADungeonLevelStreamingActor(const FObjectInitializer& initializer); /** - destructor - */ + * destructor + */ virtual ~ADungeonLevelStreamingActor() override = default; protected: diff --git a/Source/DungeonGenerator/Public/Helper/DungeonRandom.h b/Source/DungeonGenerator/Public/Helper/DungeonRandom.h index 412b189..64f6876 100644 --- a/Source/DungeonGenerator/Public/Helper/DungeonRandom.h +++ b/Source/DungeonGenerator/Public/Helper/DungeonRandom.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -40,66 +40,66 @@ class DUNGEONGENERATOR_API CDungeonRandom void ResetOwner(); /** - @return true or false - */ + * @return true or false + */ bool GetBoolean() const; /** - @return -1 or 1 - */ + * @return -1 or 1 + */ IntegerType GetIntegerSign() const; /** - Get a random number - @return Returns the range [type_min,type_max) if T is an integer, - or [0,1] with equal probability if T is a real number. - */ + * Get a random number + * @return Returns the range [type_min,type_max) if T is an integer, + * or [0,1] with equal probability if T is a real number. + */ IntegerType GetInteger() const; /** - Get a random number - @param[in] to Upper value - @return Returns the range [0,to) if T is an integer, - or [0,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] to Upper value + * @return Returns the range [0,to) if T is an integer, + * or [0,to] with equal probability if T is a real number. + */ IntegerType GetInteger(const IntegerType to) const; /** - Get a random number - @param[in] from Lower value - @param[in] to Upper value - @return Returns the range [from,to) if T is an integer, - or [from,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] from Lower value + * @param[in] to Upper value + * @return Returns the range [from,to) if T is an integer, + * or [from,to] with equal probability if T is a real number. + */ IntegerType GetInteger(const IntegerType from, const IntegerType to) const; /** - @return -1 or 1 - */ + * @return -1 or 1 + */ NumberType GetNumberSign() const; /** - Get a random number - @return Returns the range [type_min,type_max) if T is an integer, - or [0,1] with equal probability if T is a real number. - */ + * Get a random number + * @return Returns the range [type_min,type_max) if T is an integer, + * or [0,1] with equal probability if T is a real number. + */ NumberType GetNumber() const; /** - Get a random number - @param[in] to Upper value - @return Returns the range [0,to) if T is an integer, - or [0,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] to Upper value + * @return Returns the range [0,to) if T is an integer, + * or [0,to] with equal probability if T is a real number. + */ NumberType GetNumber(const NumberType to) const; /** - Get a random number - @param[in] from Lower value - @param[in] to Upper value - @return Returns the range [from,to) if T is an integer, - or [from,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] from Lower value + * @param[in] to Upper value + * @return Returns the range [from,to) if T is an integer, + * or [from,to] with equal probability if T is a real number. + */ NumberType GetNumber(const NumberType from, const NumberType to) const; private: @@ -122,74 +122,74 @@ class DUNGEONGENERATOR_API UDungeonRandom : public UObject void SetOwner(const std::shared_ptr& random); /** - @return true or false - */ + * @return true or false + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") bool GetBoolean() const; /** - @return -1 or 1 - */ + * @return -1 or 1 + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") int32 GetIntegerSign() const; /** - Get a random number - @return Returns the range [type_min,type_max) if T is an integer, - or [0,1] with equal probability if T is a real number. - */ + * Get a random number + * @return Returns the range [type_min,type_max) if T is an integer, + * or [0,1] with equal probability if T is a real number. + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") int32 GetInteger() const; /** - Get a random number - @param[in] to Upper value - @return Returns the range [0,to) if T is an integer, - or [0,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] to Upper value + * @return Returns the range [0,to) if T is an integer, + * or [0,to] with equal probability if T is a real number. + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") int32 GetIntegerFrom(const int32 to) const; /** - Get a random number - @param[in] from Lower value - @param[in] to Upper value - @return Returns the range [from,to) if T is an integer, - or [from,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] from Lower value + * @param[in] to Upper value + * @return Returns the range [from,to) if T is an integer, + * or [from,to] with equal probability if T is a real number. + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") int32 GetIntegerInRangeFrom(const int32 from, const int32 to) const; /** - @return -1 or 1 - */ + * @return -1 or 1 + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") float GetNumberSign() const; /** - Get a random number - @return Returns the range [type_min,type_max) if T is an integer, - or [0,1] with equal probability if T is a real number. - */ + * Get a random number + * @return Returns the range [type_min,type_max) if T is an integer, + * or [0,1] with equal probability if T is a real number. + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") float GetFloat() const; /** - Get a random number - @param[in] to Upper value - @return Returns the range [0,to) if T is an integer, - or [0,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] to Upper value + * @return Returns the range [0,to) if T is an integer, + * or [0,to] with equal probability if T is a real number. + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") float GetFloatFrom(const float to) const; /** - Get a random number - @param[in] from Lower value - @param[in] to Upper value - @return Returns the range [from,to) if T is an integer, - or [from,to] with equal probability if T is a real number. - */ + * Get a random number + * @param[in] from Lower value + * @param[in] to Upper value + * @return Returns the range [from,to) if T is an integer, + * or [from,to] with equal probability if T is a real number. + */ UFUNCTION(BlueprintPure, Category = "DungeonGenerator") float GetFloatInRangeFrom(const float from, const float to) const; diff --git a/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivationSaver.h b/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivationSaver.h index fdd37c2..b6c63a6 100644 --- a/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivationSaver.h +++ b/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivationSaver.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -12,9 +12,9 @@ All Rights Reserved. #include /** -A class that assists in saving and restoring the active status of a component owned by an actor -アクターが所有するコンポーネントのアクティブ状態の保存と復元を支援するクラス。 -*/ + * A class that assists in saving and restoring the active status of a component owned by an actor + * アクターが所有するコンポーネントのアクティブ状態の保存と復元を支援するクラス。 + */ template class DungeonComponentActivationSaver final { @@ -30,22 +30,22 @@ class DungeonComponentActivationSaver final ~DungeonComponentActivationSaver() = default; /** - Records the activity of components owned by the actor - @param[in] actor - @param[in] function - */ + * Records the activity of components owned by the actor + * @param[in] actor + * @param[in] function + */ void Stash(const AActor* actor, const std::function(UActorComponent*)>& function); /** - Restore the activity of recorded components - @param[in] function - */ + * Restore the activity of recorded components + * @param[in] function + */ void Pop(const std::function& function); /** - No records? - @return Returns true if nothing is recorded. - */ + * No records? + * @return Returns true if nothing is recorded. + */ bool IsEmpty() const; private: diff --git a/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivatorComponent.h b/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivatorComponent.h index 3822303..de4c2d8 100644 --- a/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivatorComponent.h +++ b/Source/DungeonGenerator/Public/MainLevel/DungeonComponentActivatorComponent.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonComponentActivationSaver.h" @@ -27,19 +27,19 @@ enum class EDungeonComponentActivateReason : uint8 constexpr uint8_t DungeonComponentActivateReasonSize = 3; /** -OnPartitionActivate will be called when the DungeonPartition belonging to -the player approaches the vicinity of the player. -OnPartitionInactivate is called when the DungeonPartition moves away. - -The shadow control method for point light derived classes has been changed. -Only lights with CastShadow enabled at the time of BeginPlay will have shadow enable/disable control. - -所属しているDungeonPartitionがプレイヤー周辺に近づいたらOnPartitionActivateが呼ばれます。 -離れたらOnPartitionInactivateが呼ばれます。 - -ポイントライト派生クラスの影の制御方法が変更されました。 -BeginPlay時点でCastShadowが有効のライトのみ、影の有効無効制御が行われます。 -*/ + * OnPartitionActivate will be called when the DungeonPartition belonging to + * the player approaches the vicinity of the player. + * OnPartitionInactivate is called when the DungeonPartition moves away. + * + * The shadow control method for point light derived classes has been changed. + * Only lights with CastShadow enabled at the time of BeginPlay will have shadow enable/disable control. + * + * 所属しているDungeonPartitionがプレイヤー周辺に近づいたらOnPartitionActivateが呼ばれます。 + * 離れたらOnPartitionInactivateが呼ばれます。 + * + * ポイントライト派生クラスの影の制御方法が変更されました。 + * BeginPlay時点でCastShadowが有効のライトのみ、影の有効無効制御が行われます。 + */ UCLASS(ClassGroup = "DungeonGenerator", meta = (BlueprintSpawnableComponent)) class DUNGEONGENERATOR_API UDungeonComponentActivatorComponent : public UActorComponent { @@ -104,16 +104,16 @@ class DUNGEONGENERATOR_API UDungeonComponentActivatorComponent : public UActorCo protected: /** - 所属しているDungeonPartitionがプレイヤー周辺に近づいたら呼び出されます。 - The DungeonPartition will be called when it approaches the player's vicinity. - */ + * 所属しているDungeonPartitionがプレイヤー周辺に近づいたら呼び出されます。 + * The DungeonPartition will be called when it approaches the player's vicinity. + */ UFUNCTION(BlueprintImplementableEvent) void OnPartitionActivate(); /** - 所属しているDungeonPartitionがプレイヤー周辺から離れたら呼び出されます。 - It is called when the DungeonPartition to which it belongs leaves the player's vicinity. - */ + * 所属しているDungeonPartitionがプレイヤー周辺から離れたら呼び出されます。 + * It is called when the DungeonPartition to which it belongs leaves the player's vicinity. + */ UFUNCTION(BlueprintImplementableEvent) void OnPartitionInactivate(); @@ -139,44 +139,44 @@ class DUNGEONGENERATOR_API UDungeonComponentActivatorComponent : public UActorCo protected: /** - If enabled, controls the validity of the owner actor's Tick - 有効にするとオーナーアクターのTickの有効性を制御します - */ + * If enabled, controls the validity of the owner actor's Tick + * 有効にするとオーナーアクターのTickの有効性を制御します + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") bool EnableOwnerActorTickControl = true; /** - If enabled, controls the effectiveness of the owner actor's AI - 有効にするとオーナーアクターのAIの有効性を制御します - */ + * If enabled, controls the effectiveness of the owner actor's AI + * 有効にするとオーナーアクターのAIの有効性を制御します + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") bool EnableOwnerActorAiControl = true; /** - If enabled, controls the activation of the owner actor's components - 有効にするとオーナーアクターのコンポーネントのアクティブ性を制御します - */ + * If enabled, controls the activation of the owner actor's components + * 有効にするとオーナーアクターのコンポーネントのアクティブ性を制御します + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") bool EnableComponentActivationControl = true; /** - If enabled, controls the visibility of the owner actor's components - 有効にするとオーナーアクターのコンポーネントの表示を制御します - */ + * If enabled, controls the visibility of the owner actor's components + * 有効にするとオーナーアクターのコンポーネントの表示を制御します + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") bool EnableComponentVisibilityControl = true; /** - If enabled, controls the Cast Shadow of the owner actor's point light and spotlight - 有効にするとオーナーアクターのポイントライトとスポットライトのCast Shadowを制御します - */ + * If enabled, controls the Cast Shadow of the owner actor's point light and spotlight + * 有効にするとオーナーアクターのポイントライトとスポットライトのCast Shadowを制御します + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") bool EnableLightShadowControl = true; /** - If enabled, controls the enable of the collision component of the owner actor - 有効にするとオーナーアクターのコリジョンコンポーネントの有効性を制御します - */ + * If enabled, controls the enable of the collision component of the owner actor + * 有効にするとオーナーアクターのコリジョンコンポーネントの有効性を制御します + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") bool EnableCollisionEnableControl = true; diff --git a/Source/DungeonGenerator/Public/MainLevel/DungeonMainLevelScriptActor.h b/Source/DungeonGenerator/Public/MainLevel/DungeonMainLevelScriptActor.h index d36d834..c4fdafa 100644 --- a/Source/DungeonGenerator/Public/MainLevel/DungeonMainLevelScriptActor.h +++ b/Source/DungeonGenerator/Public/MainLevel/DungeonMainLevelScriptActor.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonPartition.h" @@ -17,16 +17,16 @@ class APlayerController; class FSceneView; /** -This class manages the DungeonComponentActivatorComponent validity -within a runtime-generated dungeon. -The dungeon is partitioned into a specified range of partitions, -and the components registered in the partitions component -registered in the partition. - -ランタイム生成ダンジョン内のDungeonComponentActivatorComponent有効性を管理するクラスです。 -ダンジョンを指定の範囲のパーティションで区切り、パーティションに登録されたコンポーネントの -アクティブ性を制御します。 -*/ + * This class manages the DungeonComponentActivatorComponent validity + * within a runtime-generated dungeon. + * The dungeon is partitioned into a specified range of partitions, + * and the components registered in the partitions component + * registered in the partition. + * + * ランタイム生成ダンジョン内のDungeonComponentActivatorComponent有効性を管理するクラスです。 + * ダンジョンを指定の範囲のパーティションで区切り、パーティションに登録されたコンポーネントの + * アクティブ性を制御します。 + */ UCLASS(ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptActor { @@ -54,7 +54,7 @@ class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptAct * Maximum distance from vertical player to activate partition * パーティションをアクティブにする垂直方向のプレイヤーからの最大距離 */ - static constexpr double PartitionVerticalMaxSize = 100.0 * 100.0; + static constexpr double PartitionVerticalMaxSize = 50.0 * 100.0; public: /** @@ -70,7 +70,7 @@ class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptAct public: /** * Called before dungeon generation - * + * * ダンジョン生成前に呼ばれます */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator") @@ -78,7 +78,7 @@ class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptAct /** * Called after dungeon generation - * + * * ダンジョン生成後に呼ばれます */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator") @@ -111,7 +111,14 @@ class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptAct virtual void Tick(float deltaSeconds) override; private: - UDungeonPartition* Index(const size_t x, const size_t y) const noexcept; + size_t ToIndex(const size_t x, const size_t y, const size_t z) const noexcept; + size_t ToIndex(const FIntVector& vector) const noexcept; + size_t ToIndex(const FVector& vector) const noexcept; + FIntVector ToIntVector(const size_t index) const noexcept; + FVector ToVector(const size_t index) const noexcept; + + UDungeonPartition* Index(const size_t x, const size_t y, const size_t z) const noexcept; + UDungeonPartition* Index(const FIntVector& vector) const noexcept; const FSceneView* GetSceneView(const APlayerController* playerController) const; void Begin() const; @@ -139,7 +146,7 @@ class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptAct */ static bool TestSegmentAABB(const FVector& segmentStart, const FVector& segmentEnd, const FVector& aabbCenter, const FVector& aabbExtent); - static void DrawFrustumLines(UWorld* world, const FVector& viewLocation, const FRotator& viewRotation, + static void DrawFrustumLines(const UWorld* world, const FVector& viewLocation, const FRotator& viewRotation, float FovY, float aspect, float nearDistance, float farDistance, const FColor& color, float lifeTime = 0.f, float thickness = 0.f); @@ -191,8 +198,8 @@ class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptAct bool ShowDebugInformation = false; /** - * Displays debugging information - * デバッグ情報を表示します + * Debug display of the view frustum + * 視錐台をデバッグ表示します */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Category = "DungeonGenerator|Debug") bool ShowFrustumInformation = false; @@ -201,10 +208,11 @@ class DUNGEONGENERATOR_API ADungeonMainLevelScriptActor : public ALevelScriptAct private: FBox mBounding; double mBoundingSize = PartitionHorizontalMinSize; - size_t mPartitionWidth = 0; - size_t mPartitionDepth = 0; double mPartitionSize = PartitionHorizontalMinSize; - FVector mActiveRegionExtent; + uint16_t mPartitionWidth = 0; + uint16_t mPartitionDepth = 0; + uint16_t mPartitionHeight = 0; float mActiveViewRange = 0.f; bool mLastEnableLoadControl; + FVector mActiveRegionExtent; }; diff --git a/Source/DungeonGenerator/Public/MainLevel/DungeonPartition.h b/Source/DungeonGenerator/Public/MainLevel/DungeonPartition.h index 1cff24c..c24dc6b 100644 --- a/Source/DungeonGenerator/Public/MainLevel/DungeonPartition.h +++ b/Source/DungeonGenerator/Public/MainLevel/DungeonPartition.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "MainLevel/DungeonComponentActivatorComponent.h" @@ -15,23 +15,23 @@ All Rights Reserved. class ADungeonMainLevelScriptActor; /** -This class represents the area delimited by the dungeon. -ActivateDuneComponentActivatorComponent if it is a partition around a player. -If the partition is away from the player, deactivate it. - -ダンジョンを区切った領域を表すクラスです。 -プレイヤー周辺のパーティションならDungeonComponentActivatorComponentをアクティブ化します。 -プレイヤーから離れているパーティションなら非アクティブ化します。 -*/ + * This class represents the area delimited by the dungeon. + * ActivateDuneComponentActivatorComponent if it is a partition around a player. + * If the partition is away from the player, deactivate it. + * + * ダンジョンを区切った領域を表すクラスです。 + * プレイヤー周辺のパーティションならDungeonComponentActivatorComponentをアクティブ化します。 + * プレイヤーから離れているパーティションなら非アクティブ化します。 + */ UCLASS(ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API UDungeonPartition : public UObject { GENERATED_BODY() /** - Time from inactivity target to deactivation. - 非アクティブ化対象になってから実際に非アクティブ化するまでの秒数。 - */ + * Time from inactivity target to deactivation. + * 非アクティブ化対象になってから実際に非アクティブ化するまでの秒数。 + */ static constexpr float InactivateRemainTimer = 3.f; public: diff --git a/Source/DungeonGenerator/Public/Mission/DungeonRoomItem.h b/Source/DungeonGenerator/Public/Mission/DungeonRoomItem.h index bd998d4..0d573fa 100644 --- a/Source/DungeonGenerator/Public/Mission/DungeonRoomItem.h +++ b/Source/DungeonGenerator/Public/Mission/DungeonRoomItem.h @@ -1,20 +1,20 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include #include "DungeonRoomItem.generated.h" /** -Items to be placed in the room -Same content as dungeon::Room::Item - -部屋に置くアイテム -dungeon::Room::Item と同じ内容です。 -*/ + * Items to be placed in the room + * Same content as dungeon::Room::Item + * + * 部屋に置くアイテム + * dungeon::Room::Item と同じ内容です。 + */ UENUM(BlueprintType) enum class EDungeonRoomItem : uint8 { @@ -24,14 +24,14 @@ enum class EDungeonRoomItem : uint8 }; /** -Number of different items to be placed in the room -*/ + * Number of different items to be placed in the room + */ static constexpr uint8 DungeonRoomItemSize = static_cast(EDungeonRoomItem::UniqueKey) + 1; /** -Gets the symbolic name of the item to be placed in the room -Same content as dungeon::Room::Parts -@param[in] item EDungeonRoomItem -@return EDungeonRoomItem symbol name -*/ + * Gets the symbolic name of the item to be placed in the room + * Same content as dungeon::Room::Parts + * @param[in] item EDungeonRoomItem + * @return EDungeonRoomItem symbol name + */ extern const FString& GetDungeonRoomItemName(const EDungeonRoomItem item); diff --git a/Source/DungeonGenerator/Public/Mission/DungeonRoomParts.h b/Source/DungeonGenerator/Public/Mission/DungeonRoomParts.h index c1f6703..b077641 100644 --- a/Source/DungeonGenerator/Public/Mission/DungeonRoomParts.h +++ b/Source/DungeonGenerator/Public/Mission/DungeonRoomParts.h @@ -1,20 +1,20 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include #include "DungeonRoomParts.generated.h" /** -Type of room parts -Same content as dungeon::Room::Parts - -ルームパーツの種類 -dungeon::Room::Parts と同じ内容です。 -*/ + * Type of room parts + * Same content as dungeon::Room::Parts + * + * ルームパーツの種類 + * dungeon::Room::Parts と同じ内容です。 + */ UENUM(BlueprintType) enum class EDungeonRoomParts : uint8 { @@ -26,12 +26,12 @@ enum class EDungeonRoomParts : uint8 }; /** -Type of room parts -Same content as dungeon::Room::Parts - -ルームパーツの種類 -dungeon::Room::Parts と同じ内容です。 -*/ + * Type of room parts + * Same content as dungeon::Room::Parts + * + * ルームパーツの種類 + * dungeon::Room::Parts と同じ内容です。 + */ UENUM(BlueprintType) enum class EDungeonRoomLocatorParts : uint8 { @@ -41,29 +41,29 @@ enum class EDungeonRoomLocatorParts : uint8 }; /** -Number of different room parts -*/ + * Number of different room parts + */ static constexpr uint8 DungeonRoomPartsSize = static_cast(EDungeonRoomParts::Goal) + 1; /** -Get the symbol name of a room part. -Same content as dungeon::Room::Parts -@param[in] parts EDungeonRoomParts -@return Symbol name for EDungeonRoomParts -*/ + * Get the symbol name of a room part. + * Same content as dungeon::Room::Parts + * @param[in] parts EDungeonRoomParts + * @return Symbol name for EDungeonRoomParts + */ extern const FString& GetDungeonRoomPartsName(const EDungeonRoomParts parts); /** -Compare EDungeonRoomParts and EDungeonRoomLocatorParts -*/ + * Compare EDungeonRoomParts and EDungeonRoomLocatorParts + */ inline constexpr bool Equal(const EDungeonRoomParts parts, const EDungeonRoomLocatorParts locatorParts) { return static_cast(parts) == static_cast(locatorParts); } /** -Compare EDungeonRoomParts and EDungeonRoomLocatorParts -*/ + * Compare EDungeonRoomParts and EDungeonRoomLocatorParts + */ inline constexpr bool Equal(const EDungeonRoomLocatorParts locatorParts, const EDungeonRoomParts parts) { return Equal(parts, locatorParts); @@ -71,7 +71,7 @@ inline constexpr bool Equal(const EDungeonRoomLocatorParts locatorParts, const E /** * Cast from EDungeonRoomLocatorParts to EDungeonRoomParts - * + * * EDungeonRoomLocatorPartsからEDungeonRoomPartsへのキャスト */ inline constexpr EDungeonRoomParts Cast(const EDungeonRoomLocatorParts parts) @@ -81,7 +81,7 @@ inline constexpr EDungeonRoomParts Cast(const EDungeonRoomLocatorParts parts) /** * Cast from EDungeonRoomParts to EDungeonRoomLocatorParts - * + * * EDungeonRoomPartsからEDungeonRoomLocatorPartsへのキャスト */ inline constexpr EDungeonRoomLocatorParts Cast(const EDungeonRoomParts parts) diff --git a/Source/DungeonGenerator/Public/Mission/DungeonRoomProps.h b/Source/DungeonGenerator/Public/Mission/DungeonRoomProps.h index b68bee0..ca6fe82 100644 --- a/Source/DungeonGenerator/Public/Mission/DungeonRoomProps.h +++ b/Source/DungeonGenerator/Public/Mission/DungeonRoomProps.h @@ -1,19 +1,19 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include #include "DungeonRoomProps.generated.h" /** -Objects to be placed in the room -Same content as dungeon::Grid::Props -部屋に配置するオブジェクト -dungeon::Grid::Props と同じ内容にして下さい。 -*/ + * Objects to be placed in the room + * Same content as dungeon::Grid::Props + * 部屋に配置するオブジェクト + * dungeon::Grid::Props と同じ内容にして下さい。 + */ UENUM(BlueprintType) enum class EDungeonRoomProps : uint8 { @@ -23,17 +23,17 @@ enum class EDungeonRoomProps : uint8 }; /** -Number of different types of placements to be placed in the room -室内に配置するプレースメントの種類数 -*/ + * Number of different types of placements to be placed in the room + * 室内に配置するプレースメントの種類数 + */ static constexpr uint8 DungeonRoomPropsSize = static_cast(EDungeonRoomProps::UniqueLock) + 1; /** -Gets the symbolic name of the placement that should be placed in the room -Same content as dungeon::Room::Parts -部屋に置くべき配置のシンボル名を取得する -dungeon::Grid::Parts と同じ内容にして下さい。 -@param[in] props EDungeonRoomProps -@return EDungeonRoomProps symbol name -*/ + * Gets the symbolic name of the placement that should be placed in the room + * Same content as dungeon::Room::Parts + * 部屋に置くべき配置のシンボル名を取得する + * dungeon::Grid::Parts と同じ内容にして下さい。 + * @param[in] props EDungeonRoomProps + * @return EDungeonRoomProps symbol name + */ extern const FString& GetDungeonRoomPropsName(const EDungeonRoomProps props); diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonActorParts.h b/Source/DungeonGenerator/Public/Parameter/DungeonActorParts.h index f13a97c..3a3016d 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonActorParts.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonActorParts.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonPartsTransform.h" #include "DungeonActorParts.generated.h" /** -Actor Parts -アクターのパーツ -*/ + * Actor Parts + * アクターのパーツ + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonActorParts : public FDungeonPartsTransform { @@ -25,9 +25,9 @@ struct DUNGEONGENERATOR_API FDungeonActorParts : public FDungeonPartsTransform public: /** - Class of actor to spawn - スポーンするアクターのクラス - */ + * Class of actor to spawn + * スポーンするアクターのクラス + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator", meta = (AllowedClasses = "/Script/Engine.Actor")) TObjectPtr ActorClass = nullptr; }; \ No newline at end of file diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonActorPartsWithDirection.h b/Source/DungeonGenerator/Public/Parameter/DungeonActorPartsWithDirection.h index 85975ec..009a858 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonActorPartsWithDirection.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonActorPartsWithDirection.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonActorParts.h" #include "DungeonActorPartsWithDirection.generated.h" /** -Actor parts with direction specification -方向付きアクターのパーツ -*/ + * Actor parts with direction specification + * 方向付きアクターのパーツ + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonActorPartsWithDirection : public FDungeonActorParts { @@ -31,9 +31,9 @@ struct DUNGEONGENERATOR_API FDungeonActorPartsWithDirection : public FDungeonAct public: /** - Direction of placement - 配置する方向 - */ + * Direction of placement + * 配置する方向 + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator") EDungeonPartsPlacementDirection PlacementDirection = EDungeonPartsPlacementDirection::RandomDirection; }; diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonDoorActorParts.h b/Source/DungeonGenerator/Public/Parameter/DungeonDoorActorParts.h index 48b1976..8cc218b 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonDoorActorParts.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonDoorActorParts.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonPartsTransform.h" #include "DungeonDoorActorParts.generated.h" /** -Door actor Parts -ドアアクターのパーツ -*/ + * Door actor Parts + * ドアアクターのパーツ + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonDoorActorParts : public FDungeonPartsTransform { @@ -25,9 +25,9 @@ struct DUNGEONGENERATOR_API FDungeonDoorActorParts : public FDungeonPartsTransfo public: /** - Class of actor to spawn - スポーンするアクターのクラス - */ + * Class of actor to spawn + * スポーンするアクターのクラス + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator", meta = (AllowedClasses = "/Script/DungeonGenerator.DungeonDoorBase")) TObjectPtr ActorClass = nullptr; }; diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonGenerateParameter.h b/Source/DungeonGenerator/Public/Parameter/DungeonGenerateParameter.h index 04b294c..d8c1b97 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonGenerateParameter.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonGenerateParameter.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonGridSize.h" @@ -18,6 +18,35 @@ class UDungeonAisleGridMap; class UDungeonRandom; class UDungeonRoomSensorDatabase; +/** + * Dungeon expansion policy + * ダンジョンの拡張ポリシー + */ +UENUM() +enum class EDungeonExpansionPolicy : uint8 +{ + Flat, + ExpandHorizontally, + ExpandVertically, + ExpandAnyDirection, +}; + +/** + * Dungeon start location policy + * + * スタート位置の種類 + */ +UENUM() +enum class EDungeonStartLocationPolicy : uint8 +{ + NoAdjustment, + UseSouthernMost, + UseHighestPoint, + UseLowestPoint, + UseCentralPoint, + UseMultiStart, +}; + /** * Frequency of generation * 生成頻度 @@ -141,7 +170,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject /** * Converts from a grid coordinate system to a world coordinate system - * + * * グリッド座標系からワールド座標系への変換 */ FVector ToWorld(const FIntVector& location) const; @@ -250,6 +279,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject // overrides virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; virtual bool IsSupportedForNetworking() const override; + virtual void PostLoad() override; protected: /** @@ -317,7 +347,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject * 垂直方向の部屋と部屋の空白 * Room Vertical Marginを有効にするにはMergeRoomsのチェックを外す必要があります */ - UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite, meta = (ClampMin = "0", EditCondition = "!MergeRooms && !Flat "), DisplayName = "Vertical Room Margin") + UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite, meta = (ClampMin = "0", EditCondition = "!MergeRooms && ExpansionPolicy != EDungeonExpansionPolicy::Flat"), DisplayName = "Vertical Room Margin") uint8 VerticalRoomMargin = 0; /** @@ -338,6 +368,17 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite) bool MergeRooms = false; + /** + * Defines the direction in which rooms expand during dungeon generation. + * Each value influences room proliferation logic and is used to control the dungeon's structure (tall, wide, or mixed). + * + * ダンジョン生成時に部屋をどの方向へ展開するかを定義します。 + * 各値は部屋の増殖ロジックに影響し、ダンジョンの構造(縦長・横長・混在)を + * コントロールするために使用されます。 + */ + UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite, meta = (EditCondition = "!MergeRooms && !Flat")) + EDungeonExpansionPolicy ExpansionPolicy = EDungeonExpansionPolicy::ExpandHorizontally; + /** * Candidate Number of Generated Hierarchies This is used as a reference number of hierarchies for generation, * not as the final number of hierarchies. @@ -345,7 +386,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject * 生成される階層数の候補 * これは最終的な階層の数ではなく生成時の参考階層数として利用されます。 */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator", meta = (ClampMin = "0", ClampMax = "5", EditCondition = "!Flat")) + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator", meta = (ClampMin = "0", ClampMax = "5", EditCondition = "ExpansionPolicy != EDungeonExpansionPolicy::Flat")) uint8 NumberOfCandidateFloors = 3; /** @@ -353,7 +394,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject * * 平面的なダンジョンを生成します */ - UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite, meta = (EditCondition = "!MergeRooms")) + UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite, meta = (EditCondition = "!MergeRooms", DeprecatedProperty, DeprecationMessage = "Use ExpansionPolicy=Flat")) bool Flat = false; /** @@ -361,9 +402,20 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject * * 開始時にPlayerStartを自動的にスタート部屋に移動します */ - UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite) + UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite, meta = (DeprecatedProperty, DeprecationMessage = "Use StartLocationPolicy")) bool MovePlayerStartToStartingPoint = true; + /** + * When generating dungeons, this specifies the criteria for selecting the room where the player starts. + * Each policy makes its determination based on the room's positional information (coordinates or floor level). + * + * ダンジョン生成時に、プレイヤーの開始位置となる部屋を + * どの基準で選択するかを指定します。各ポリシーは部屋の + * 位置情報(座標や階層)に基づいて判定を行います。 + */ + UPROPERTY(EditAnywhere, Category = "DungeonGenerator", BlueprintReadWrite) + EDungeonStartLocationPolicy StartLocationPolicy = EDungeonStartLocationPolicy::UseSouthernMost; + /** * Enable MissionGraph to generate missions with keys. * MergeRooms must be unchecked and AisleComplexity must be 0 for UseMissionGraph to be enabled. @@ -397,7 +449,7 @@ class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject /** * Generate structural columns in the room * May be enabled by future forcing. - * + * * 部屋の中に構造柱を生成する * 将来的強制的に有効になる可能性があります。 */ @@ -579,7 +631,7 @@ inline bool UDungeonGenerateParameter::IsMergeRooms() const noexcept inline bool UDungeonGenerateParameter::IsMovePlayerStartToStartingPoint() const noexcept { - return MovePlayerStartToStartingPoint; + return MovePlayerStartToStartingPoint && StartLocationPolicy != EDungeonStartLocationPolicy::NoAdjustment; } inline bool UDungeonGenerateParameter::IsUseMissionGraph() const noexcept diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonGridSize.h b/Source/DungeonGenerator/Public/Parameter/DungeonGridSize.h index 0d1b120..bb5f689 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonGridSize.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonGridSize.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include #include "DungeonGridSize.generated.h" /** -Dungeon grid size -ダンジョンのグリッドサイズ -*/ + * Dungeon grid size + * ダンジョンのグリッドサイズ + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonGridSize { @@ -19,15 +19,15 @@ struct DUNGEONGENERATOR_API FDungeonGridSize public: /** - コンストラクタ - constructor - */ + * コンストラクタ + * constructor + */ FDungeonGridSize() = default; /** - コンストラクタ - constructor - */ + * コンストラクタ + * constructor + */ FDungeonGridSize(const float horizontalSize, const float verticalSize) noexcept : HorizontalSize(horizontalSize) , VerticalSize(verticalSize) @@ -35,9 +35,9 @@ struct DUNGEONGENERATOR_API FDungeonGridSize } /** - コピーコンストラクタ - copy constructor - */ + * コピーコンストラクタ + * copy constructor + */ FDungeonGridSize(const FDungeonGridSize& other) noexcept : HorizontalSize(other.HorizontalSize) , VerticalSize(other.VerticalSize) @@ -45,9 +45,9 @@ struct DUNGEONGENERATOR_API FDungeonGridSize } /** - ムーブコンストラクタ - move constructor - */ + * ムーブコンストラクタ + * move constructor + */ FDungeonGridSize(FDungeonGridSize&& other) noexcept : HorizontalSize(other.HorizontalSize) , VerticalSize(other.VerticalSize) @@ -55,15 +55,15 @@ struct DUNGEONGENERATOR_API FDungeonGridSize } /** - デストラクタ - destructor - */ + * デストラクタ + * destructor + */ virtual ~FDungeonGridSize() = default; /** - コピー代入 - copy assignment - */ + * コピー代入 + * copy assignment + */ FDungeonGridSize& operator=(const FDungeonGridSize& other) noexcept { HorizontalSize = other.HorizontalSize; @@ -72,9 +72,9 @@ struct DUNGEONGENERATOR_API FDungeonGridSize } /** - ムーブ代入 - move assignment - */ + * ムーブ代入 + * move assignment + */ FDungeonGridSize& operator=(FDungeonGridSize&& other) noexcept { HorizontalSize = other.HorizontalSize; @@ -83,9 +83,9 @@ struct DUNGEONGENERATOR_API FDungeonGridSize } /** - 一致か調べます - equal - */ + * 一致か調べます + * equal + */ bool IsNearlyEqual(const FDungeonGridSize& other, float tolerance = std::numeric_limits::epsilon()) const noexcept { const auto horizontalDelta = std::abs(HorizontalSize - other.HorizontalSize); @@ -94,18 +94,18 @@ struct DUNGEONGENERATOR_API FDungeonGridSize } /** - FVector2Dにキャストします - Cast to FVector2D - */ + * FVector2Dにキャストします + * Cast to FVector2D + */ FVector2D To2D() const noexcept { return FVector2D(HorizontalSize, VerticalSize); } /** - FVectorにキャストします - Cast to FVector - */ + * FVectorにキャストします + * Cast to FVector + */ FVector To3D() const noexcept { return FVector(HorizontalSize, HorizontalSize, VerticalSize); diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonMeshParts.h b/Source/DungeonGenerator/Public/Parameter/DungeonMeshParts.h index 96aa8f4..88cbc3f 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonMeshParts.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonMeshParts.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonPartsTransform.h" #include "DungeonMeshParts.generated.h" /** -Mesh Parts -メッシュのパーツ -*/ + * Mesh Parts + * メッシュのパーツ + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonMeshParts : public FDungeonPartsTransform { @@ -25,9 +25,9 @@ struct DUNGEONGENERATOR_API FDungeonMeshParts : public FDungeonPartsTransform public: /** - Class of static mesh to spawn - スポーンするスタティックメッシュ - */ + * Class of static mesh to spawn + * スポーンするスタティックメッシュ + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator") TObjectPtr StaticMesh = nullptr; }; diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonMeshPartsWithDirection.h b/Source/DungeonGenerator/Public/Parameter/DungeonMeshPartsWithDirection.h index 5b19045..54b3dd2 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonMeshPartsWithDirection.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonMeshPartsWithDirection.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonMeshParts.h" #include "DungeonMeshPartsWithDirection.generated.h" /** -Mesh parts with direction specification -方向付きメッシュのパーツ -*/ + * Mesh parts with direction specification + * 方向付きメッシュのパーツ + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonMeshPartsWithDirection : public FDungeonMeshParts { @@ -19,9 +19,9 @@ struct DUNGEONGENERATOR_API FDungeonMeshPartsWithDirection : public FDungeonMesh public: /** - Direction of placement - 配置する方向 - */ + * Direction of placement + * 配置する方向 + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator") EDungeonPartsPlacementDirection PlacementDirection = EDungeonPartsPlacementDirection::RandomDirection; diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonMeshSet.h b/Source/DungeonGenerator/Public/Parameter/DungeonMeshSet.h index 611925f..ddf0c05 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonMeshSet.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonMeshSet.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonMeshParts.h" @@ -25,9 +25,9 @@ namespace dungeon } /** -Dungeon mesh set -ダンジョンのメッシュセット -*/ + * Dungeon mesh set + * ダンジョンのメッシュセット + */ USTRUCT(Blueprintable, BlueprintType) struct DUNGEONGENERATOR_API FDungeonMeshSet { @@ -177,8 +177,8 @@ struct DUNGEONGENERATOR_API FDungeonMeshSet } /** - 壁のパーツを選択する方法を取得します - */ + * 壁のパーツを選択する方法を取得します + */ EDungeonPartsSelectionMethod GetWallPartsSelectionMethod() const noexcept { return WallPartsSelectionMethod; @@ -192,72 +192,72 @@ struct DUNGEONGENERATOR_API FDungeonMeshSet protected: /** - How to select floor parts - 床のパーツを選択する方法 - */ + * How to select floor parts + * 床のパーツを選択する方法 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Floor", BlueprintReadWrite) EDungeonPartsSelectionMethod FloorPartsSelectionMethod = EDungeonPartsSelectionMethod::Random; /** - Specify the floor parts. Multiple parts can be set and will be selected based on FloorPartsSelectionMethod. - 床のパーツを指定して下さい。パーツは複数設定する事ができ、FloorPartsSelectionMethodを元に選択されます。 - */ + * Specify the floor parts. Multiple parts can be set and will be selected based on FloorPartsSelectionMethod. + * 床のパーツを指定して下さい。パーツは複数設定する事ができ、FloorPartsSelectionMethodを元に選択されます。 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Floor", BlueprintReadWrite) TArray FloorParts; /** - How to select wall parts - 壁のパーツを選択する方法 - */ + * How to select wall parts + * 壁のパーツを選択する方法 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Wall", BlueprintReadWrite) EDungeonPartsSelectionMethod WallPartsSelectionMethod = EDungeonPartsSelectionMethod::Random; /** - Specify the wall parts. Multiple parts can be set and will be selected based on WallPartsSelectionMethod. - 壁のパーツを指定して下さい。パーツは複数設定する事ができ、WallPartsSelectionMethodを元に選択されます。 - */ + * Specify the wall parts. Multiple parts can be set and will be selected based on WallPartsSelectionMethod. + * 壁のパーツを指定して下さい。パーツは複数設定する事ができ、WallPartsSelectionMethodを元に選択されます。 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Wall", BlueprintReadWrite) TArray WallParts; /** - How to select roof parts - 天井のパーツを選択する方法 - */ + * How to select roof parts + * 天井のパーツを選択する方法 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Roof", BlueprintReadWrite) EDungeonPartsSelectionMethod RoofPartsSelectionMethod = EDungeonPartsSelectionMethod::Random; /** - Specify the roof parts. Multiple parts can be set and will be selected based on RoofPartsSelectionMethod. - 天井のパーツを指定して下さい。パーツは複数設定する事ができ、RoofPartsSelectionMethodを元に選択されます。 - */ + * Specify the roof parts. Multiple parts can be set and will be selected based on RoofPartsSelectionMethod. + * 天井のパーツを指定して下さい。パーツは複数設定する事ができ、RoofPartsSelectionMethodを元に選択されます。 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Roof", BlueprintReadWrite) TArray RoofParts; /** - How to generate parts for stairs and ramps - 階段やスロープの部品を生成する方法 - */ + * How to generate parts for stairs and ramps + * 階段やスロープの部品を生成する方法 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Sloop", BlueprintReadWrite) EDungeonPartsSelectionMethod SloopPartsSelectionMethod = EDungeonPartsSelectionMethod::Random; /** - Specify parts for stairs and ramps. Multiple parts can be set and will be selected based on the SloopPartsSelectionMethod. - 階段やスロープのパーツを指定して下さい。パーツは複数設定する事ができ、SloopPartsSelectionMethodを元に選択されます。 - */ + * Specify parts for stairs and ramps. Multiple parts can be set and will be selected based on the SloopPartsSelectionMethod. + * 階段やスロープのパーツを指定して下さい。パーツは複数設定する事ができ、SloopPartsSelectionMethodを元に選択されます。 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Sloop", BlueprintReadWrite) TArray SlopeParts; /** - How to select catwalk parts - 中二階通路のパーツを選択する方法 - */ + * How to select catwalk parts + * 中二階通路のパーツを選択する方法 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Catwalk", BlueprintReadWrite) EDungeonPartsSelectionMethod CatwalkPartsSelectionMethod = EDungeonPartsSelectionMethod::Random; /** - Specify the catwalk parts. Multiple parts can be set and will be selected based on CatwalkPartsSelectionMethod. - 中二階通路のパーツを指定して下さい。パーツは複数設定する事ができ、CatwalkPartsSelectionMethodを元に選択されます。 - */ + * Specify the catwalk parts. Multiple parts can be set and will be selected based on CatwalkPartsSelectionMethod. + * 中二階通路のパーツを指定して下さい。パーツは複数設定する事ができ、CatwalkPartsSelectionMethodを元に選択されます。 + */ UPROPERTY(EditAnywhere, Category = "DungeonGenerator|Catwalk", BlueprintReadWrite) TArray CatwalkParts; diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetDatabase.h b/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetDatabase.h index d62b1e8..ea83fc5 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetDatabase.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetDatabase.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonMeshSetSelectionMethod.h" @@ -17,9 +17,9 @@ namespace dungeon } /** -Database of dungeon mesh sets -ダンジョンのメッシュセットのデータベース -*/ + * Database of dungeon mesh sets + * ダンジョンのメッシュセットのデータベース + */ UCLASS(ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API UDungeonMeshSetDatabase : public UObject { @@ -30,13 +30,13 @@ class DUNGEONGENERATOR_API UDungeonMeshSetDatabase : public UObject virtual ~UDungeonMeshSetDatabase() override = default; /** - FDungeonMeshSetを取得します - */ + * FDungeonMeshSetを取得します + */ virtual const FDungeonMeshSet* AtImplement(const size_t index) const; /** - FDungeonMeshSetをランダムに抽選します - */ + * FDungeonMeshSetをランダムに抽選します + */ virtual const FDungeonMeshSet* SelectImplement(const uint16_t identifier, const uint8_t depthRatioFromStart, const std::shared_ptr& random) const; template @@ -57,16 +57,16 @@ class DUNGEONGENERATOR_API UDungeonMeshSetDatabase : public UObject protected: /** - Part Selection Method - パーツを選択する方法 - */ + * Part Selection Method + * パーツを選択する方法 + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") EDungeonMeshSetSelectionMethod SelectionMethod = EDungeonMeshSetSelectionMethod::DepthFromStart; /** - Set the DungeonRoomMeshSet; multiple DungeonRoomMeshSets can be set. - DungeonRoomMeshSetを設定して下さい。DungeonRoomMeshSetは複数設定する事ができます。 - */ + * Set the DungeonRoomMeshSet; multiple DungeonRoomMeshSets can be set. + * DungeonRoomMeshSetを設定して下さい。DungeonRoomMeshSetは複数設定する事ができます。 + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator") TArray Parts; }; diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetSelectionMethod.h b/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetSelectionMethod.h index 3a8d147..301886f 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetSelectionMethod.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonMeshSetSelectionMethod.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ #pragma once #include #include "DungeonMeshSetSelectionMethod.generated.h" /** -Part Selection Method -パーツを選択する方法 -*/ + * Part Selection Method + * パーツを選択する方法 + */ UENUM(BlueprintType) enum class EDungeonMeshSetSelectionMethod : uint8 { diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonPartsPlacementDirection.h b/Source/DungeonGenerator/Public/Parameter/DungeonPartsPlacementDirection.h index 589a944..c7a4f0c 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonPartsPlacementDirection.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonPartsPlacementDirection.h @@ -1,16 +1,16 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonPartsPlacementDirection.generated.h" /** -Parts placement direction -パーツを配置する方向 -*/ + * Parts placement direction + * パーツを配置する方向 + */ UENUM(BlueprintType) enum class EDungeonPartsPlacementDirection : uint8 { diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonPartsSelectionMethod.h b/Source/DungeonGenerator/Public/Parameter/DungeonPartsSelectionMethod.h index 153b711..dfb4a42 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonPartsSelectionMethod.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonPartsSelectionMethod.h @@ -1,16 +1,16 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonPartsSelectionMethod.generated.h" /** -Part Selection Method -パーツを選択する方法 -*/ + * Part Selection Method + * パーツを選択する方法 + */ UENUM(BlueprintType) enum class EDungeonPartsSelectionMethod : uint8 { diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonPartsTransform.h b/Source/DungeonGenerator/Public/Parameter/DungeonPartsTransform.h index 3dafb90..b4a448d 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonPartsTransform.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonPartsTransform.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonPartsPlacementDirection.h" @@ -21,9 +21,9 @@ namespace dungeon } /** -Parts transform -パーツのトランスフォーム -*/ + * Parts transform + * パーツのトランスフォーム + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonPartsTransform { @@ -31,9 +31,9 @@ struct DUNGEONGENERATOR_API FDungeonPartsTransform public: /** - Set the relative transform of the static mesh - スタティックメッシュの相対トランスフォームを設定して下さい - */ + * Set the relative transform of the static mesh + * スタティックメッシュの相対トランスフォームを設定して下さい + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator") FTransform RelativeTransform; diff --git a/Source/DungeonGenerator/Public/Parameter/DungeonRandomActorParts.h b/Source/DungeonGenerator/Public/Parameter/DungeonRandomActorParts.h index 7a6756f..505a588 100644 --- a/Source/DungeonGenerator/Public/Parameter/DungeonRandomActorParts.h +++ b/Source/DungeonGenerator/Public/Parameter/DungeonRandomActorParts.h @@ -1,17 +1,17 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonActorPartsWithDirection.h" #include "DungeonRandomActorParts.generated.h" /** -Actor parts with Probability -ランダム選択するアクターのパーツ -*/ + * Actor parts with Probability + * ランダム選択するアクターのパーツ + */ USTRUCT(BlueprintType) struct DUNGEONGENERATOR_API FDungeonRandomActorParts : public FDungeonActorPartsWithDirection { @@ -25,9 +25,9 @@ struct DUNGEONGENERATOR_API FDungeonRandomActorParts : public FDungeonActorParts public: /** - Production frequency - 配置する頻度 - */ + * Production frequency + * 配置する頻度 + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator", meta = (ClampMin = "0.", ClampMax = "1.")) float Frequency = 1.f; }; diff --git a/Source/DungeonGenerator/Public/SubActor/DungeonActorSpawnDirector.h b/Source/DungeonGenerator/Public/SubActor/DungeonActorSpawnDirector.h index 170d361..66afe2c 100644 --- a/Source/DungeonGenerator/Public/SubActor/DungeonActorSpawnDirector.h +++ b/Source/DungeonGenerator/Public/SubActor/DungeonActorSpawnDirector.h @@ -20,7 +20,7 @@ namespace dungeon * A parameter structure that defines the type and probability of the actor to be spawned. * FDungeonSpawnActorParameter is used by Spawner to specify the class type of the actor to be spawned and * the class type of the actor to be spawned and its probability of occurrence. - * + * * スポーンするアクターの型と確率を定義するパラメータ構造体。 * FDungeonSpawnActorParameter は Spawner によって利用され、生成対象となるアクターのクラス型と * その発生確率を指定します。 @@ -82,7 +82,7 @@ class DUNGEONGENERATOR_API ADungeonActorSpawnDirector : public AActor /** * Specify the class type of the actor to be generated and its probability of occurrence. - * + * * 生成対象となるアクターのクラス型とその発生確率を指定して下さい。 */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator") diff --git a/Source/DungeonGenerator/Public/SubActor/DungeonDoorBase.h b/Source/DungeonGenerator/Public/SubActor/DungeonDoorBase.h index 9f5e563..e7d74a1 100644 --- a/Source/DungeonGenerator/Public/SubActor/DungeonDoorBase.h +++ b/Source/DungeonGenerator/Public/SubActor/DungeonDoorBase.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonVerifiableActor.h" @@ -20,14 +20,14 @@ namespace dungeon } /** -Dungeon Door Actor -DungeonDoorBase is an actor intended to be replicated. -Please be very careful with server-client synchronization. - -ダンジョンドアアクター -DungeonDoorBaseはレプリケーションする前提のアクターです。 -サーバーとクライアントの同期に十分注意して下さい。 -*/ + * Dungeon Door Actor + * DungeonDoorBase is an actor intended to be replicated. + * Please be very careful with server-client synchronization. + * + * ダンジョンドアアクター + * DungeonDoorBaseはレプリケーションする前提のアクターです。 + * サーバーとクライアントの同期に十分注意して下さい。 + */ UCLASS(Abstract, ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API ADungeonDoorBase : public ADungeonVerifiableActor { @@ -38,35 +38,35 @@ class DUNGEONGENERATOR_API ADungeonDoorBase : public ADungeonVerifiableActor virtual ~ADungeonDoorBase() override = default; /** - Get DungeonRoomProps - DungeonRoomPropsを取得します - */ + * Get DungeonRoomProps + * DungeonRoomPropsを取得します + */ EDungeonRoomProps GetRoomProps() const; /** - Set DungeonRoomProps - DungeonRoomPropsを設定します - */ + * Set DungeonRoomProps + * DungeonRoomPropsを設定します + */ void SetRoomProps(const EDungeonRoomProps props); /** - Is locked door? - 鍵付きドアか? - */ + * Is locked door? + * 鍵付きドアか? + */ UFUNCTION(BlueprintCallable, BlueprintPure, Category = "DungeonGenerator") bool IsLockedDoor() const; /** - Function called during initialization after object creation - オブジェクト生成後に呼び出される初期化用関数 - */ + * Function called during initialization after object creation + * オブジェクト生成後に呼び出される初期化用関数 + */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator", meta = (CallInEditor = "true")) void OnInitialize(const EDungeonRoomProps props); /** - Finalize function called before object destruction - オブジェクト破棄前に呼び出される終了用関数 - */ + * Finalize function called before object destruction + * オブジェクト破棄前に呼び出される終了用関数 + */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator", meta = (CallInEditor = "true")) void OnFinalize(const bool finish); @@ -75,21 +75,21 @@ class DUNGEONGENERATOR_API ADungeonDoorBase : public ADungeonVerifiableActor protected: /** - Functions for initialization after object creation - オブジェクト生成後の初期化用関数 - */ + * Functions for initialization after object creation + * オブジェクト生成後の初期化用関数 + */ virtual void OnNativeInitialize(const EDungeonRoomProps props); /** - Function called before object destruction - オブジェクト破棄前の終了用関数 - */ + * Function called before object destruction + * オブジェクト破棄前の終了用関数 + */ virtual void OnNativeFinalize(); /** - Get random numbers common to dungeon generation systems - ダンジョン生成システム共通の乱数を取得します - */ + * Get random numbers common to dungeon generation systems + * ダンジョン生成システム共通の乱数を取得します + */ CDungeonRandom& GetRandom() noexcept; private: @@ -98,9 +98,9 @@ class DUNGEONGENERATOR_API ADungeonDoorBase : public ADungeonVerifiableActor private: /** - Types of props attached to the door - ドアに付属する小道具の種類 - */ + * Types of props attached to the door + * ドアに付属する小道具の種類 + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator", meta = (AllowPrivateAccess = "true")) EDungeonRoomProps Props = EDungeonRoomProps::None; diff --git a/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorBase.h b/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorBase.h index 2806341..1ee0aad 100644 --- a/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorBase.h +++ b/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorBase.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "SubActor/DungeonVerifiableActor.h" @@ -25,19 +25,19 @@ namespace dungeon } /** -奈落落下 動的マルチキャストデリゲートイベントの宣言 -*/ + * 奈落落下 動的マルチキャストデリゲートイベントの宣言 + */ DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDungeonRoomSensorBaseEventSignature); /** -Room Area Sensor Actor -DungeonRoomSensorBase is an actor that is not intended to be replicated. -Please be very careful with server-client synchronization. - -部屋の領域センサーアクター -DungeonRoomSensorBaseはレプリケーションされない前提のアクターです。 -サーバーとクライアントの同期に十分注意して下さい。 -*/ + * Room Area Sensor Actor + * DungeonRoomSensorBase is an actor that is not intended to be replicated. + * Please be very careful with server-client synchronization. + * + * 部屋の領域センサーアクター + * DungeonRoomSensorBaseはレプリケーションされない前提のアクターです。 + * サーバーとクライアントの同期に十分注意して下さい。 + */ UCLASS(Abstract, ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableActor { @@ -48,140 +48,140 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct virtual ~ADungeonRoomSensorBase() override = default; /** - Get the room identifier - 部屋の識別子を取得します - */ + * Get the room identifier + * 部屋の識別子を取得します + */ int32 GetIdentifier() const noexcept; /** - Preparation for initialization immediately after spawning - If OnPrepare succeeds, OnInitialize is called and the failing DungeonRoomSensorBase is deleted. - スポーン直後の初期化準備 - OnPrepareが成功するとOnInitializeが呼び出され、失敗するDungeonRoomSensorBaseは破棄されます。 - */ + * Preparation for initialization immediately after spawning + * If OnPrepare succeeds, OnInitialize is called and the failing DungeonRoomSensorBase is deleted. + * スポーン直後の初期化準備 + * OnPrepareが成功するとOnInitializeが呼び出され、失敗するDungeonRoomSensorBaseは破棄されます。 + */ UFUNCTION(BlueprintNativeEvent, Category = "DungeonGenerator", meta = (CallInEditor = "true")) bool OnPrepare(const float depthFromStartRatio); virtual bool OnPrepare_Implementation(const float depthFromStartRatio); /** - Function called during initialization after object creation - オブジェクト生成後に呼び出される初期化用関数 - */ + * Function called during initialization after object creation + * オブジェクト生成後に呼び出される初期化用関数 + */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator", meta = (CallInEditor = "true")) void OnInitialize(const EDungeonRoomParts parts, const EDungeonRoomItem item, const uint8 depthFromStart, const float depthFromStartRatio); /** - Finalize function called before object destruction - オブジェクト破棄前に呼び出される終了用関数 - */ + * Finalize function called before object destruction + * オブジェクト破棄前に呼び出される終了用関数 + */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator", meta = (CallInEditor = "true")) void OnFinalize(const bool finish); /** - Function called on reset - */ + * Function called on reset + */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator") void OnReset(const bool fallToAbyss); /** - Function called on resume - */ + * Function called on resume + */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator") void OnResume(); /** - Get the bounding of the room entry sensor - 部屋の進入センサーの範囲を取得します - */ + * Get the bounding of the room entry sensor + * 部屋の進入センサーの範囲を取得します + */ UBoxComponent* GetBounding(); /** - Get the bounding of the room entry sensor - 部屋の進入センサーの範囲を取得します - */ + * Get the bounding of the room entry sensor + * 部屋の進入センサーの範囲を取得します + */ const UBoxComponent* GetBounding() const; /** - Get room size - 部屋の範囲を取得します - */ + * Get room size + * 部屋の範囲を取得します + */ const FBox& GetRoomSize() const noexcept; /** - Get the ideal number of people in the bounding - 部屋に含める理想的な人数を求めます - @param[in] areaRequiredPerPerson (default : 500cm) - @param[in] maxNumberOfActor (default : 5 actors) - @return ideal number of people in the bounding - */ + * Get the ideal number of people in the bounding + * 部屋に含める理想的な人数を求めます + * @param[in] areaRequiredPerPerson (default : 500cm) + * @param[in] maxNumberOfActor (default : 5 actors) + * @return ideal number of people in the bounding + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") int32 IdealNumberOfActor(const float areaRequiredPerPerson = 500.f, const int32 maxNumberOfActor = 5) const; /** - Get a random position in the bounding - If useLocalRandom is set to false, be sure to call it the same number of times for all clients. - - 部屋の範囲内のランダムな位置を取得します - useLocalRandomをfalseにした場合、必ず全てのクライアントで同じ回数呼び出すようにしてください。 - */ + * Get a random position in the bounding + * If useLocalRandom is set to false, be sure to call it the same number of times for all clients. + * + * 部屋の範囲内のランダムな位置を取得します + * useLocalRandomをfalseにした場合、必ず全てのクライアントで同じ回数呼び出すようにしてください。 + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") bool RandomPoint(FVector& result, const float offsetHeight = 0.f, const bool useLocalRandom = true) const; /** - Get random transforms in bounding - If useLocalRandom is set to false, be sure to call it the same number of times for all clients. - - 部屋の範囲内のランダムなトランスフォームを取得します - useLocalRandomをfalseにした場合、必ず全てのクライアントで同じ回数呼び出すようにしてください。 - */ + * Get random transforms in bounding + * If useLocalRandom is set to false, be sure to call it the same number of times for all clients. + * + * 部屋の範囲内のランダムなトランスフォームを取得します + * useLocalRandomをfalseにした場合、必ず全てのクライアントで同じ回数呼び出すようにしてください。 + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") bool RandomTransform(FTransform& result, const float offsetHeight = 0.f, const bool useLocalRandom = true) const; /** - Get floor height position - 部屋の高さ取得します - */ + * Get floor height position + * 部屋の高さ取得します + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") bool GetFloorHeightPosition(FVector& result, FVector startPosition, const float offsetHeight = 0.f) const; /** - Utility function to spawn an actor. - Makes the spawned actor's own owner-actor and adds a dungeon generator to the tag. - アクターをスポーンするユーティリティ関数です。 - スポーンされたアクターの自身をオーナーアクターにして、タグにダンジョンジェネレータを追加します。 - */ + * Utility function to spawn an actor. + * Makes the spawned actor's own owner-actor and adds a dungeon generator to the tag. + * アクターをスポーンするユーティリティ関数です。 + * スポーンされたアクターの自身をオーナーアクターにして、タグにダンジョンジェネレータを追加します。 + */ UFUNCTION(BlueprintCallable, Category = "DungeonGenerator") AActor* SpawnActorFromClass(TSubclassOf actorClass, const FTransform transform, const ESpawnActorCollisionHandlingMethod spawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, APawn* instigator_ = nullptr, const bool transient = false); /** - Calculate the depth ratio from the start - スタート部屋からゴール部屋の部屋数からこの部屋の深さの割合を計算します - */ + * Calculate the depth ratio from the start + * スタート部屋からゴール部屋の部屋数からこの部屋の深さの割合を計算します + */ UFUNCTION(BlueprintCallable, BlueprintPure, Category = "DungeonGenerator") float GetDepthRatioFromStart() const; /** - Gets the probability (0%-100%) of adding a door. Settings after OnInitialize are invalid. - ドアを追加する確率(0%~100%)を取得します。 OnInitialize以降の設定は無効です。 - */ + * Gets the probability (0%-100%) of adding a door. Settings after OnInitialize are invalid. + * ドアを追加する確率(0%~100%)を取得します。 OnInitialize以降の設定は無効です。 + */ uint8 GetDoorAddingProbability() const noexcept; /** - Sets the probability (0% to 100%) that a door will be added. Settings after OnInitialize are invalid. - ドアを追加する確率(0%~100%)を設定します。 OnInitialize以降の設定は無効です。 - */ + * Sets the probability (0% to 100%) that a door will be added. Settings after OnInitialize are invalid. + * ドアを追加する確率(0%~100%)を設定します。 OnInitialize以降の設定は無効です。 + */ void SetDoorAddingProbability(const uint8 doorAddingProbability) noexcept; /** - Add room door - 部屋にドアを追加します - */ + * Add room door + * 部屋にドアを追加します + */ void AddDungeonDoor(ADungeonDoorBase* dungeonDoorBase); /** - Update room doors - 部屋のドアを更新します - */ + * Update room doors + * 部屋のドアを更新します + */ template void EachDungeonDoors(Function&& function) const noexcept { @@ -192,22 +192,22 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct } /** - Does the room have a locked door? - 部屋に鍵付きドアがあるか? - */ + * Does the room have a locked door? + * 部屋に鍵付きドアがあるか? + */ UFUNCTION(BlueprintCallable, BlueprintPure, Category = "DungeonGenerator") bool HasLockedDoor() const; /** - Add torchlight in a room - 部屋に燭台を追加します - */ + * Add torchlight in a room + * 部屋に燭台を追加します + */ void AddDungeonTorch(AActor* actor); /** - Update the torchlight in the room. - 部屋の燭台を更新します - */ + * Update the torchlight in the room. + * 部屋の燭台を更新します + */ template void EachDungeonTorch(Function&& function) const noexcept { @@ -218,49 +218,49 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct } /** - Gets the tag of the interior of the room to be generated. - For example, if the creator returns the tag `kitchen`, the interior with the kitchen tag will be selected. - If multiple tags are set, actors containing all tags will be selected as spawn candidates. - - 生成する部屋のインテリアのタグを取得します。 - 例えば、クリエイターが `kitchen` というタグを返した場合、キッチンのタグを持つインテリアが選択されます。 - 複数のタグが設定されている場合、すべてのタグを含むアクターがスポーン候補として選択されます。 - */ + * Gets the tag of the interior of the room to be generated. + * For example, if the creator returns the tag `kitchen`, the interior with the kitchen tag will be selected. + * If multiple tags are set, actors containing all tags will be selected as spawn candidates. + * + * 生成する部屋のインテリアのタグを取得します。 + * 例えば、クリエイターが `kitchen` というタグを返した場合、キッチンのタグを持つインテリアが選択されます。 + * 複数のタグが設定されている場合、すべてのタグを含むアクターがスポーン候補として選択されます。 + */ UFUNCTION(BlueprintImplementableEvent, Category = "DungeonGenerator") TArray GetInquireInteriorTags() const; /** - Get the DungeonGenerator tag name. - DungeonGeneratorのタグを取得します - */ + * Get the DungeonGenerator tag name. + * DungeonGeneratorのタグを取得します + */ UFUNCTION(BlueprintCallable, BlueprintPure, Category = "DungeonGenerator") static const FName& GetDungeonGeneratorTag(); /** - Get the DungeonGenerator tag name. - DungeonGeneratorのタグを取得します - */ + * Get the DungeonGenerator tag name. + * DungeonGeneratorのタグを取得します + */ UFUNCTION(BlueprintCallable, BlueprintPure, Category = "DungeonGenerator") static const TArray& GetDungeonGeneratorTags(); /** - Get a random object for synchronization - Make sure that the remote and client get the same number of random numbers. - If the counts are different, synchronization of dungeon creation will fail. - - 同期用のランダムオブジェクトを取得します - 必ずリモートとクライアントが同じ回数乱数を取得するようにしてください。 - 回数が違った場合はダンジョンの生成の同期に失敗します。 - */ + * Get a random object for synchronization + * Make sure that the remote and client get the same number of random numbers. + * If the counts are different, synchronization of dungeon creation will fail. + * + * 同期用のランダムオブジェクトを取得します + * 必ずリモートとクライアントが同じ回数乱数を取得するようにしてください。 + * 回数が違った場合はダンジョンの生成の同期に失敗します。 + */ CDungeonRandom& GetSynchronizedRandom(); /** - Get a random object that can be used locally - Use when using random numbers only remotely. - - ローカルで使用できるランダムオブジェクトを取得します - リモートのみで乱数を使用する時に使用して下さい。 - */ + * Get a random object that can be used locally + * Use when using random numbers only remotely. + * + * ローカルで使用できるランダムオブジェクトを取得します + * リモートのみで乱数を使用する時に使用して下さい。 + */ CDungeonRandom& GetLocalRandom(); // overrides @@ -276,33 +276,33 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct protected: /** - 遅延スポーン直後の初期化準備関数 - Prepareが成功するとInitializeが呼び出され、失敗するDungeonRoomSensorBaseは破棄されます。 - */ + * 遅延スポーン直後の初期化準備関数 + * Prepareが成功するとInitializeが呼び出され、失敗するDungeonRoomSensorBaseは破棄されます。 + */ virtual bool OnNativePrepare(const FVector& center); /** - Functions for initialization after object creation - オブジェクト生成後の初期化用関数 - */ + * Functions for initialization after object creation + * オブジェクト生成後の初期化用関数 + */ virtual void OnNativeInitialize(); /** - Function called before object destruction - オブジェクト破棄前の終了用関数 - */ + * Function called before object destruction + * オブジェクト破棄前の終了用関数 + */ virtual void OnNativeFinalize(const bool finish); /** - Reset room sensor - ルームセンサーのリセット - */ + * Reset room sensor + * ルームセンサーのリセット + */ virtual void OnNativeReset(const bool fallToAbyss); /** - Reset room sensor - ルームセンサーの再開 - */ + * Reset room sensor + * ルームセンサーの再開 + */ virtual void OnNativeResume(); private: @@ -335,58 +335,58 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct protected: /** - Room Bounding Box - 部屋のバウンディングボックスセンサーコンポーネント - */ + * Room Bounding Box + * 部屋のバウンディングボックスセンサーコンポーネント + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "DungeonGenerator") TObjectPtr Bounding; /** - Room Size - 部屋の大きさ - */ + * Room Size + * 部屋の大きさ + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Bounding") FBox RoomSize; /** - Horizontal margin of room bounding box sensor - 部屋のバウンディングボックスセンサーの水平マージン - */ + * Horizontal margin of room bounding box sensor + * 部屋のバウンディングボックスセンサーの水平マージン + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Bounding", meta = (ClampMin = "0")) float HorizontalMargin = 0.f; /** - Vertical margin of room bounding box sensor - 部屋のバウンディングボックスセンサーの垂直マージン - */ + * Vertical margin of room bounding box sensor + * 部屋のバウンディングボックスセンサーの垂直マージン + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Bounding", meta = (ClampMin = "0")) float VerticalMargin = 0.f; /** - Room Identifier - 部屋の識別子 - */ + * Room Identifier + * 部屋の識別子 + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Debug") int32 Identifier = -1; /** - Type of room parts (start, goal, hall, etc.) - 部屋パーツの種類(スタート、ゴール、ホール等) - */ + * Type of room parts (start, goal, hall, etc.) + * 部屋パーツの種類(スタート、ゴール、ホール等) + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Debug") EDungeonRoomParts Parts = EDungeonRoomParts::Any; /** - Types of items that should be placed in the room - 部屋に配置すべきアイテムの種類 - */ + * Types of items that should be placed in the room + * 部屋に配置すべきアイテムの種類 + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Debug") EDungeonRoomItem Item = EDungeonRoomItem::Empty; /** - ミッショングラフが生成したブランチ識別子 - Branch identifier generated by the mission graph - */ + * ミッショングラフが生成したブランチ識別子 + * Branch identifier generated by the mission graph + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Debug") uint8 BranchId = 0; @@ -406,51 +406,51 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct * * スタート部屋から最も深い部屋の深さ * 奥に行くほどBGMが変化するなどに利用できます - */ + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Debug") uint8 DeepestDepthFromStart = 0; /** - Automatically calls OnReset when the player leaves - プレイヤーが離れたら自動的にOnResetを呼ぶ - */ + * Automatically calls OnReset when the player leaves + * プレイヤーが離れたら自動的にOnResetを呼ぶ + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Bounding") bool AutoReset = true; #if WITH_EDITORONLY_DATA /** - Display debugging information - デバッグ情報を表示 - */ + * Display debugging information + * デバッグ情報を表示 + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Transient, Category = "DungeonGenerator|Debug") bool ShowDebugInformation = false; #endif /** - Notification when exiting from the bottom of the sensor (falling into the abyss) - センサーの底面から出た時の通知(奈落落下) - */ + * Notification when exiting from the bottom of the sensor (falling into the abyss) + * センサーの底面から出た時の通知(奈落落下) + */ UPROPERTY(BlueprintAssignable, Category = "Event") FDungeonRoomSensorBaseEventSignature OnFallToAbyss; /** - the probability (0%-100%) of adding a door - ドアを追加する確率(0%~100%) - */ + * the probability (0%-100%) of adding a door + * ドアを追加する確率(0%~100%) + */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "DungeonGenerator", meta = (ClampMin = "0", ClampMax = "100")) uint8 DoorAddingProbability = 100; /** - Room door - 部屋のドア - */ + * Room door + * 部屋のドア + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Debug") TArray> DungeonDoors; /** - Torchlight in a room - 部屋の燭台 - */ + * Torchlight in a room + * 部屋の燭台 + */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DungeonGenerator|Debug") TArray> DungeonTorches; @@ -458,7 +458,7 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct /** * Number of people per area to find the ideal number of people to spawn in a room. * If the SpawnActors array is empty, it will not spawn. - * + * * 部屋にスポーンする理想的な人数を求めるための面積毎の人数 * SpawnActors配列が空の場合はスポーンしません */ @@ -468,7 +468,7 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct /** * Maximum number of people to find the ideal number of people to spawn in a room * If the SpawnActors array is empty, it will not spawn. - * + * * 部屋にスポーンする理想的な人数を求めるための最大人数 * SpawnActors配列が空の場合はスポーンしません */ @@ -501,7 +501,7 @@ class DUNGEONGENERATOR_API ADungeonRoomSensorBase : public ADungeonVerifiableAct * Unique key actor in the mission graph. * Spawns at a random location in the room if specified. * If you want the key to be obtained from a treasure chest or when an enemy is defeated, implement it independently. - * + * * ミッショングラフのユニーク鍵アクター * 指定した場合は部屋のランダムな位置にスポーンします。 * 宝箱や敵を倒した時に鍵を入手させたい場合は独自に実装して下さい。 diff --git a/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorDatabase.h b/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorDatabase.h index ddb218c..067debe 100644 --- a/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorDatabase.h +++ b/Source/DungeonGenerator/Public/SubActor/DungeonRoomSensorDatabase.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "Parameter/DungeonMeshSetSelectionMethod.h" @@ -20,17 +20,17 @@ namespace dungeon /** * Database class that manages dungeon room intrusion detection sensors - * + * * UDungeonRoomSensorDatabase is a database class that holds and manages multiple UDungeonRoomSensor * Database class that holds and manages multiple UDungeonRoomSensors. * draws lots and selects available sensors based on set conditions. * * ダンジョンの部屋侵入検知センサーを管理するデータベースクラス - * + * * UDungeonRoomSensorDatabase は、複数の UDungeonRoomSensor を保持・管理する * データベースクラスです。 * 設定された条件を元に、利用可能なセンサーを抽選し選択します。 -*/ + */ UCLASS(ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API UDungeonRoomSensorDatabase : public UObject { @@ -49,7 +49,7 @@ class DUNGEONGENERATOR_API UDungeonRoomSensorDatabase : public UObject /** * Select the DungeonRoomSensor class that matches the condition of the argument - * + * * 引数の条件にあったDungeonRoomSensorのクラスを選択します */ UClass* Select(const uint16_t identifier, const uint8_t depthRatioFromStart, const std::shared_ptr& random) const; diff --git a/Source/DungeonGenerator/Public/SubActor/DungeonVerifiableActor.h b/Source/DungeonGenerator/Public/SubActor/DungeonVerifiableActor.h index 2d8027f..79b2837 100644 --- a/Source/DungeonGenerator/Public/SubActor/DungeonVerifiableActor.h +++ b/Source/DungeonGenerator/Public/SubActor/DungeonVerifiableActor.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include @@ -10,9 +10,9 @@ All Rights Reserved. #include "DungeonVerifiableActor.generated.h" /** -Verifiable Actor Class -検証可能なアクタークラス -*/ + * Verifiable Actor Class + * 検証可能なアクタークラス + */ UCLASS(Abstract, ClassGroup = "DungeonGenerator") class DUNGEONGENERATOR_API ADungeonVerifiableActor : public AActor { @@ -20,58 +20,58 @@ class DUNGEONGENERATOR_API ADungeonVerifiableActor : public AActor protected: /** - constructor - コンストラクタ - */ + * constructor + * コンストラクタ + */ explicit ADungeonVerifiableActor(const FObjectInitializer& initializer); /** - destructor - デストラクタ - */ + * destructor + * デストラクタ + */ virtual ~ADungeonVerifiableActor() override = default; public: /** - Calculate CRC32 - CRC32を計算します - */ + * Calculate CRC32 + * CRC32を計算します + */ virtual uint32_t GenerateCrc32(uint32_t crc = 0xffffffffU) const noexcept; public: /** - Calculates the CRC32 of the actor - アクターのCRC32を計算します - */ + * Calculates the CRC32 of the actor + * アクターのCRC32を計算します + */ static uint32_t GenerateCrc32(const AActor* actor, uint32_t crc = 0xffffffffU) noexcept; /** - Calculates the CRC32 of the FBox - FBoxのCRC32を計算します - */ + * Calculates the CRC32 of the FBox + * FBoxのCRC32を計算します + */ static uint32_t GenerateCrc32(const FBox& box, uint32_t crc = 0xffffffffU) noexcept; /** - Calculate CRC32 of FRotator - FRotatorのCRC32を計算します - */ + * Calculate CRC32 of FRotator + * FRotatorのCRC32を計算します + */ static uint32_t GenerateCrc32(const FRotator& rotator, uint32_t crc = 0xffffffffU) noexcept; /** - Calculate CRC32 of FQuat - FQuatのCRC32を計算します - */ + * Calculate CRC32 of FQuat + * FQuatのCRC32を計算します + */ static uint32_t GenerateCrc32(const FQuat& rotator, uint32_t crc = 0xffffffffU) noexcept; /** - Calculate CRC32 of FTransform - FTransformのCRC32を計算します - */ + * Calculate CRC32 of FTransform + * FTransformのCRC32を計算します + */ static uint32_t GenerateCrc32(const FTransform& transform, uint32_t crc = 0xffffffffU) noexcept; /** - Calculate CRC32 of FVector - FVectorのCRC32を計算します - */ + * Calculate CRC32 of FVector + * FVectorのCRC32を計算します + */ static uint32_t GenerateCrc32(const FVector& vector, uint32_t crc = 0xffffffffU) noexcept; }; diff --git a/Source/DungeonGeneratorEditor/DungeonGeneratorEditor.Build.cs b/Source/DungeonGeneratorEditor/DungeonGeneratorEditor.Build.cs index 052bc0a..7d7d5d6 100644 --- a/Source/DungeonGeneratorEditor/DungeonGeneratorEditor.Build.cs +++ b/Source/DungeonGeneratorEditor/DungeonGeneratorEditor.Build.cs @@ -28,17 +28,21 @@ public DungeonGeneratorEditor(ReadOnlyTargetRules Target) : base(Target) new string[] { "Projects", - "InputCore", + "DeveloperSettings", + "EditorSubsystem", + "InputCore", "ToolMenus", "CoreUObject", "Engine", "Slate", "SlateCore", - "DesktopWidgets", - "PropertyEditor", - "Foliage", - "DungeonGenerator", - } + "DesktopWidgets", + "PropertyEditor", + "Foliage", + "DungeonGenerator", + "HTTP", + "Json", + } ); if (Target.bBuildEditor) diff --git a/Source/DungeonGeneratorEditor/Private/BuildInfomation.h b/Source/DungeonGeneratorEditor/Private/BuildInformation.h similarity index 85% rename from Source/DungeonGeneratorEditor/Private/BuildInfomation.h rename to Source/DungeonGeneratorEditor/Private/BuildInformation.h index 83c9441..4d5e4e2 100644 --- a/Source/DungeonGeneratorEditor/Private/BuildInfomation.h +++ b/Source/DungeonGeneratorEditor/Private/BuildInformation.h @@ -1,8 +1,8 @@ /* This is automatically generated file. DO NOT EDIT THIS FILE. -@author Shun Moriya -@copyright 2023- Shun Moriya +\author Shun Moriya +\copyright 2023- Shun Moriya All Rights Reserved. */ #pragma once @@ -16,7 +16,7 @@ All Rights Reserved. #define JENKINS_JOB_TAG "UNDEFINED JOB TAG" #define JENKINS_GIT_BRANCH "UNDEFINED BRANCH" #define JENKINS_GIT_COMMIT "UNDEFINED COMMIT" -#define JENKINS_UUID "3da61b40-1fba-7757-b07f-110de2a901e3" +#define JENKINS_UUID "1b3ed840-e1e3-f8c9-804a-8fc4985dc211" #define JENKINS_LICENSE "GPL v3" #define JENKINS_FOR_DEVELOP 1 #define JENKINS_FOR_RELEASE 0 diff --git a/Source/DungeonGeneratorEditor/Private/Debug/Debug.cpp b/Source/DungeonGeneratorEditor/Private/Debug/Debug.cpp new file mode 100644 index 0000000..a32c729 --- /dev/null +++ b/Source/DungeonGeneratorEditor/Private/Debug/Debug.cpp @@ -0,0 +1,9 @@ +/** + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ + +#include "Debug.h" + +DEFINE_LOG_CATEGORY(DungeonGeneratorEditorLogger); diff --git a/Source/DungeonGeneratorEditor/Private/Debug/Debug.h b/Source/DungeonGeneratorEditor/Private/Debug/Debug.h new file mode 100644 index 0000000..10f8ae1 --- /dev/null +++ b/Source/DungeonGeneratorEditor/Private/Debug/Debug.h @@ -0,0 +1,15 @@ +/** + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ + + #pragma once + +#include +DECLARE_LOG_CATEGORY_EXTERN(DungeonGeneratorEditorLogger, Log, All); +#define DUNGEON_GENERATOR_EDITOR_ERROR(Format, ...) UE_LOG(DungeonGeneratorEditorLogger, Error, Format, ##__VA_ARGS__) +#define DUNGEON_GENERATOR_EDITOR_WARNING(Format, ...) UE_LOG(DungeonGeneratorEditorLogger, Warning, Format, ##__VA_ARGS__) +#define DUNGEON_GENERATOR_EDITOR_DISPLAY(Format, ...) UE_LOG(DungeonGeneratorEditorLogger, Display, Format, ##__VA_ARGS__) +#define DUNGEON_GENERATOR_EDITOR_LOG(Format, ...) UE_LOG(DungeonGeneratorEditorLogger, Log, Format, ##__VA_ARGS__) +#define DUNGEON_GENERATOR_EDITOR_VERBOSE(Format, ...) UE_LOG(DungeonGeneratorEditorLogger, Verbose, Format, ##__VA_ARGS__) diff --git a/Source/DungeonGeneratorEditor/Private/DungeonGeneratorCommands.cpp b/Source/DungeonGeneratorEditor/Private/DungeonGeneratorCommands.cpp index 1c977fe..c127985 100644 --- a/Source/DungeonGeneratorEditor/Private/DungeonGeneratorCommands.cpp +++ b/Source/DungeonGeneratorEditor/Private/DungeonGeneratorCommands.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "DungeonGeneratorCommands.h" #include "DungeonGeneratorStyle.h" diff --git a/Source/DungeonGeneratorEditor/Private/DungeonGeneratorEditorModule.cpp b/Source/DungeonGeneratorEditor/Private/DungeonGeneratorEditorModule.cpp index c11c9e4..51456ac 100644 --- a/Source/DungeonGeneratorEditor/Private/DungeonGeneratorEditorModule.cpp +++ b/Source/DungeonGeneratorEditor/Private/DungeonGeneratorEditorModule.cpp @@ -1,21 +1,22 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "DungeonGeneratorEditorModule.h" #include "DungeonGeneratorStyle.h" #include "DungeonGeneratorCommands.h" +#include "BuildInformation.h" +#include "DungeonGeneratedActor.h" +#include "Helper/DungeonFinalizer.h" +#include "Debug/Debug.h" #include "SubActor/DungeonRoomSensorDatabaseTypeActions.h" #include "Parameter/DungeonMeshSetDatabaseTypeActions.h" #include "Parameter/DungeonGenerateParameterTypeActions.h" -#include "BuildInfomation.h" - -#include "DungeonGeneratedActor.h" -#include "Helper/DungeonFinalizer.h" #include "Parameter/DungeonGenerateParameter.h" + #include #include #include @@ -34,14 +35,6 @@ static const FName DungeonGeneratorTabName("DungeonGenerator"); #define LOCTEXT_NAMESPACE "FDungeonGenerateEditorModule" -DECLARE_LOG_CATEGORY_EXTERN(DungeonGeneratorLogger, Log, All); -#define DUNGEON_GENERATOR_ERROR(Format, ...) UE_LOG(DungeonGeneratorLogger, Error, Format, ##__VA_ARGS__) -#define DUNGEON_GENERATOR_WARNING(Format, ...) UE_LOG(DungeonGeneratorLogger, Warning, Format, ##__VA_ARGS__) -#define DUNGEON_GENERATOR_DISPLAY(Format, ...) UE_LOG(DungeonGeneratorLogger, Display, Format, ##__VA_ARGS__) -#define DUNGEON_GENERATOR_LOG(Format, ...) UE_LOG(DungeonGeneratorLogger, Log, Format, ##__VA_ARGS__) -#define DUNGEON_GENERATOR_VERBOSE(Format, ...) UE_LOG(DungeonGeneratorLogger, Verbose, Format, ##__VA_ARGS__) -DEFINE_LOG_CATEGORY(DungeonGeneratorLogger); - void FDungeonGenerateEditorModule::StartupModule() { FDungeonGeneratorStyle::Initialize(); diff --git a/Source/DungeonGeneratorEditor/Private/DungeonGeneratorStyle.cpp b/Source/DungeonGeneratorEditor/Private/DungeonGeneratorStyle.cpp index 790f7be..8ba5ee8 100644 --- a/Source/DungeonGeneratorEditor/Private/DungeonGeneratorStyle.cpp +++ b/Source/DungeonGeneratorEditor/Private/DungeonGeneratorStyle.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "DungeonGeneratorStyle.h" #include diff --git a/Source/DungeonGeneratorEditor/Private/Helper/DungeonFinalizer.h b/Source/DungeonGeneratorEditor/Private/Helper/DungeonFinalizer.h index 8fbf757..31e4206 100644 --- a/Source/DungeonGeneratorEditor/Private/Helper/DungeonFinalizer.h +++ b/Source/DungeonGeneratorEditor/Private/Helper/DungeonFinalizer.h @@ -1,8 +1,8 @@ -/*! -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ +/** + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include "DungeonNonCopyable.h" diff --git a/Source/DungeonGeneratorEditor/Private/Helper/DungeonNonCopyable.h b/Source/DungeonGeneratorEditor/Private/Helper/DungeonNonCopyable.h index 5c108c1..1a79810 100644 --- a/Source/DungeonGeneratorEditor/Private/Helper/DungeonNonCopyable.h +++ b/Source/DungeonGeneratorEditor/Private/Helper/DungeonNonCopyable.h @@ -1,15 +1,15 @@ -/*! -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ +/** + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once -/*! -Copy prohibited Mix-in -Be sure to inherit by private inheritance. -*/ +/** + * Copy prohibited Mix-in + * Be sure to inherit by private inheritance. + */ class DungeonNonCopyable { protected: diff --git a/Source/DungeonGeneratorEditor/Private/OnlineNotices/PluginNoticeSettings.cpp b/Source/DungeonGeneratorEditor/Private/OnlineNotices/PluginNoticeSettings.cpp new file mode 100644 index 0000000..a0b90fe --- /dev/null +++ b/Source/DungeonGeneratorEditor/Private/OnlineNotices/PluginNoticeSettings.cpp @@ -0,0 +1,22 @@ +/** + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ + +#include "OnlineNotices/PluginNoticeSettings.h" + +UPluginNoticeSettings::UPluginNoticeSettings() + : bEnableOnlineNotices(true) + , NoticesUrl(TEXT("https://happy-game-dev.undo.jp/plugins/DungeonGenerator/dungeon-generator-notices.json")) + , FetchIntervalHours(24) + , HttpTimeoutSeconds(5) + , bPerUserState(true) + , bRestrictLinksToSameDomain(true) +{ +} + +FName UPluginNoticeSettings::GetCategoryName() const +{ + return TEXT("Plugins"); +} diff --git a/Source/DungeonGeneratorEditor/Private/OnlineNotices/PluginNoticeSubsystem.cpp b/Source/DungeonGeneratorEditor/Private/OnlineNotices/PluginNoticeSubsystem.cpp new file mode 100644 index 0000000..1c3dded --- /dev/null +++ b/Source/DungeonGeneratorEditor/Private/OnlineNotices/PluginNoticeSubsystem.cpp @@ -0,0 +1,555 @@ +/** + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ + +#include "OnlineNotices/PluginNoticeSubsystem.h" +#include "OnlineNotices/PluginNoticeSettings.h" +#include "Debug/Debug.h" +#include "../PluginInformation.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if DUNGEON_GENERATOR_PLUGIN_BETA_VERSION == true +#define ENABLE_LOCAL_DEBUG +#endif + +namespace +{ + const TCHAR* kStateSection = TEXT("DungeonGeneratorOnlineNotices"); + const TCHAR* kSeenIdsKey = TEXT("SeenIds"); + const TCHAR* kLastFetchUtcKey = TEXT("LastFetchUtc"); + const TCHAR* kLastEtagKey = TEXT("LastEtag"); + const TCHAR* kMessagesField = TEXT("messages"); + const TCHAR* kSeverityWarning = TEXT("warning"); + const TCHAR* kSeverityCritical = TEXT("critical"); +} + +void UPluginNoticeSubsystem::Initialize(FSubsystemCollectionBase& Collection) +{ + Super::Initialize(Collection); + + if (IsRunningCommandlet()) + { + return; + } + + LoadState(); + MaybeFetchAsync(); +} + +void UPluginNoticeSubsystem::Deinitialize() +{ + SaveState(); + Super::Deinitialize(); +} + +UPluginNoticeSubsystem::FPluginSemVersion UPluginNoticeSubsystem::FPluginSemVersion::Parse(const FString& VersionString) +{ + FPluginSemVersion Result; + TArray Tokens; + VersionString.ParseIntoArray(Tokens, TEXT("."), true); + if (Tokens.Num() == 0) + { + return Result; + } + + for (const FString& Token : Tokens) + { + int32 Value = 0; + if (!Token.IsNumeric()) + { + return Result; + } + Value = FCString::Atoi(*Token); + Result.Parts.Add(Value); + } + + Result.bValid = Result.Parts.Num() > 0; + return Result; +} + +int32 UPluginNoticeSubsystem::FPluginSemVersion::Compare(const FPluginSemVersion& Other) const +{ + const int32 MaxParts = FMath::Max(Parts.Num(), Other.Parts.Num()); + for (int32 Index = 0; Index < MaxParts; ++Index) + { + const int32 Left = Parts.IsValidIndex(Index) ? Parts[Index] : 0; + const int32 Right = Other.Parts.IsValidIndex(Index) ? Other.Parts[Index] : 0; + if (Left != Right) + { + return Left < Right ? -1 : 1; + } + } + return 0; +} + +void UPluginNoticeSubsystem::LoadState() +{ + State = FPluginNoticeState(); + + FString SeenIdsJson; + const FString ConfigFile = GetStateConfigFile(); + GConfig->GetString(kStateSection, kSeenIdsKey, SeenIdsJson, ConfigFile); + if (!SeenIdsJson.IsEmpty()) + { + TSharedRef> Reader = TJsonReaderFactory<>::Create(SeenIdsJson); + TArray> SeenArray; + if (FJsonSerializer::Deserialize(Reader, SeenArray)) + { + for (const TSharedPtr& Value : SeenArray) + { + FString IdString; + if (Value.IsValid() && Value->TryGetString(IdString)) + { + State.SeenIds.Add(IdString); + } + } + } + } + + FString LastFetchIso; + if (GConfig->GetString(kStateSection, kLastFetchUtcKey, LastFetchIso, ConfigFile)) + { + FDateTime Parsed; + if (TryParseIso8601(LastFetchIso, Parsed)) + { + State.LastFetchUtc = Parsed; + } + } + + GConfig->GetString(kStateSection, kLastEtagKey, State.LastEtag, ConfigFile); +} + +void UPluginNoticeSubsystem::SaveState() const +{ + const FString ConfigFile = GetStateConfigFile(); + + TArray> SeenValues; + SeenValues.Reserve(State.SeenIds.Num()); + for (const FString& Id : State.SeenIds) + { + SeenValues.Add(MakeShared(Id)); + } + + FString SeenIdsJson; + TSharedRef> Writer = TJsonWriterFactory<>::Create(&SeenIdsJson); + FJsonSerializer::Serialize(SeenValues, Writer); + + GConfig->SetString(kStateSection, kSeenIdsKey, *SeenIdsJson, ConfigFile); + + if (State.LastFetchUtc != FDateTime()) + { + GConfig->SetString(kStateSection, kLastFetchUtcKey, *State.LastFetchUtc.ToIso8601(), ConfigFile); + } + else + { + GConfig->RemoveKey(kStateSection, kLastFetchUtcKey, ConfigFile); + } + + if (!State.LastEtag.IsEmpty()) + { + GConfig->SetString(kStateSection, kLastEtagKey, *State.LastEtag, ConfigFile); + } + else + { + GConfig->RemoveKey(kStateSection, kLastEtagKey, ConfigFile); + } + + GConfig->Flush(false, ConfigFile); +} + +FString UPluginNoticeSubsystem::GetStateConfigFile() +{ + const UPluginNoticeSettings* Settings = GetDefault(); + return (Settings && Settings->bPerUserState) ? GEditorPerProjectIni : GGameIni; +} + +bool UPluginNoticeSubsystem::ShouldFetchNow() const +{ + const UPluginNoticeSettings* Settings = GetDefault(); + if (!Settings || !Settings->bEnableOnlineNotices) + { + return false; + } + + if (Settings->NoticesUrl.IsEmpty()) + { + return false; + } + + if (State.LastFetchUtc == FDateTime()) + { + return true; + } + + const FTimespan Interval = FTimespan::FromHours(Settings->FetchIntervalHours); + const FDateTime Now = FDateTime::UtcNow(); + return (Now - State.LastFetchUtc) >= Interval; +} + +void UPluginNoticeSubsystem::MaybeFetchAsync() +{ + if (bRequestInFlight) + { + return; + } +#if !defined(ENABLE_LOCAL_DEBUG) + if (!ShouldFetchNow()) + { + return; + } +#endif + StartHttpRequest(); +} + +void UPluginNoticeSubsystem::StartHttpRequest() +{ + const UPluginNoticeSettings* Settings = GetDefault(); + if (!Settings) + { + return; + } + + FHttpModule& HttpModule = FHttpModule::Get(); + TSharedRef Request = HttpModule.CreateRequest(); + Request->SetURL(Settings->NoticesUrl); + Request->SetVerb(TEXT("GET")); + Request->SetTimeout(Settings->HttpTimeoutSeconds); +#if !defined(ENABLE_LOCAL_DEBUG) + if (!State.LastEtag.IsEmpty()) + { + Request->SetHeader(TEXT("If-None-Match"), State.LastEtag); + } +#endif + Request->OnProcessRequestComplete().BindUObject(this, &UPluginNoticeSubsystem::OnHttpCompleted); + + bRequestInFlight = true; + Request->ProcessRequest(); +} + +void UPluginNoticeSubsystem::OnHttpCompleted(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful) +{ + bRequestInFlight = false; + State.LastFetchUtc = FDateTime::UtcNow(); + + if (!bWasSuccessful || !Response.IsValid()) + { + SaveState(); + return; + } + + const int32 ResponseCode = Response->GetResponseCode(); + if (ResponseCode == 304) + { +#if !defined(ENABLE_LOCAL_DEBUG) + const FString NewEtag = Response->GetHeader(TEXT("ETag")); + if (!NewEtag.IsEmpty()) + { + State.LastEtag = NewEtag; + } + SaveState(); + return; +#endif + } + + if (ResponseCode < 200 || ResponseCode >= 300) + { + SaveState(); + return; + } + + const FString ResponseString = Response->GetContentAsString(); + TArray Messages; + if (!ParseResponseMessages(ResponseString, Messages)) + { + DUNGEON_GENERATOR_EDITOR_LOG(TEXT("Failed to parse notices response.")); + SaveState(); + return; + } + + const FString NewEtag = Response->GetHeader(TEXT("ETag")); + if (!NewEtag.IsEmpty()) + { + State.LastEtag = NewEtag; + } + + for (const FPluginNoticeMessage& Message : Messages) + { + if (ShouldShowMessage(Message)) + { + ShowNotice(Message); + MarkSeen(Message.Id); + } + } + + SaveState(); +} + +bool UPluginNoticeSubsystem::ParseResponseMessages(const FString& ResponseString, TArray& OutMessages) +{ + TSharedPtr RootObject; + TSharedRef> Reader = TJsonReaderFactory<>::Create(ResponseString); + if (!FJsonSerializer::Deserialize(Reader, RootObject) || !RootObject.IsValid()) + { + return false; + } + + const TArray>* MessagesArray = nullptr; + if (!RootObject->TryGetArrayField(kMessagesField, MessagesArray) || !MessagesArray) + { + return false; + } + + for (const TSharedPtr& Value : *MessagesArray) + { + const TSharedPtr MessageObject = Value ? Value->AsObject() : nullptr; + if (!MessageObject.IsValid()) + { + continue; + } + + FPluginNoticeMessage Message; + MessageObject->TryGetStringField(TEXT("id"), Message.Id); + MessageObject->TryGetStringField(TEXT("severity"), Message.Severity); + MessageObject->TryGetStringField(TEXT("title"), Message.Title); + MessageObject->TryGetStringField(TEXT("body"), Message.Body); + MessageObject->TryGetStringField(TEXT("url"), Message.Url); + MessageObject->TryGetStringField(TEXT("min_engine_version"), Message.MinEngineVersion); + MessageObject->TryGetStringField(TEXT("max_engine_version"), Message.MaxEngineVersion); + MessageObject->TryGetStringField(TEXT("min_plugin_version"), Message.MinPluginVersion); + MessageObject->TryGetStringField(TEXT("max_plugin_version"), Message.MaxPluginVersion); + MessageObject->TryGetStringField(TEXT("since_utc"), Message.SinceUtc); + MessageObject->TryGetStringField(TEXT("until_utc"), Message.UntilUtc); + + if (Message.Id.IsEmpty() || Message.Severity.IsEmpty() || Message.Title.IsEmpty() || Message.Body.IsEmpty()) + { + continue; + } + + OutMessages.Add(MoveTemp(Message)); + } + + return true; +} + +bool UPluginNoticeSubsystem::ShouldShowMessage(const FPluginNoticeMessage& Message) const +{ +#if !defined(ENABLE_LOCAL_DEBUG) + if (State.SeenIds.Contains(Message.Id)) + { + return false; + } +#endif + + if (!Message.Severity.Equals(kSeverityWarning, ESearchCase::IgnoreCase) + && !Message.Severity.Equals(kSeverityCritical, ESearchCase::IgnoreCase)) + { + return false; + } + + const FDateTime Now = FDateTime::UtcNow(); + if (!Message.SinceUtc.IsEmpty()) + { + FDateTime SinceTime; + if (TryParseIso8601(Message.SinceUtc, SinceTime) && Now < SinceTime) + { + return false; + } + } + + if (!Message.UntilUtc.IsEmpty()) + { + FDateTime UntilTime; + if (TryParseIso8601(Message.UntilUtc, UntilTime) && Now > UntilTime) + { + return false; + } + } + + const FEngineVersion CurrentEngineVersion = FEngineVersion::Current(); + if (!Message.MinEngineVersion.IsEmpty()) + { + FEngineVersion MinVersion; + if (FEngineVersion::Parse(Message.MinEngineVersion, MinVersion) + && CompareEngineVersions(CurrentEngineVersion, MinVersion) < 0) + { + return false; + } + } + + if (!Message.MaxEngineVersion.IsEmpty()) + { + FEngineVersion MaxVersion; + if (FEngineVersion::Parse(Message.MaxEngineVersion, MaxVersion) + && CompareEngineVersions(CurrentEngineVersion, MaxVersion) > 0) + { + return false; + } + } + + const TSharedPtr Plugin = IPluginManager::Get().FindPlugin(TEXT("DungeonGenerator")); + const FString PluginVersionString = Plugin.IsValid() ? Plugin->GetDescriptor().VersionName : FString(); + const FPluginSemVersion CurrentVersion = FPluginSemVersion::Parse(PluginVersionString); + if (CurrentVersion.bValid) + { + if (!Message.MinPluginVersion.IsEmpty()) + { + const FPluginSemVersion MinVersion = FPluginSemVersion::Parse(Message.MinPluginVersion); + if (MinVersion.bValid && CurrentVersion.Compare(MinVersion) < 0) + { + return false; + } + } + + if (!Message.MaxPluginVersion.IsEmpty()) + { + const FPluginSemVersion MaxVersion = FPluginSemVersion::Parse(Message.MaxPluginVersion); + if (MaxVersion.bValid && CurrentVersion.Compare(MaxVersion) > 0) + { + return false; + } + } + } + + return true; +} + +void UPluginNoticeSubsystem::ShowNotice(const FPluginNoticeMessage& Message) +{ + FNotificationInfo Info(FText::FromString(Message.Title)); + Info.SubText = FText::FromString(Message.Body); + Info.bFireAndForget = false; + Info.FadeInDuration = 0.1f; + Info.FadeOutDuration = 0.2f; + Info.ExpireDuration = 0.0f; + + const UPluginNoticeSettings* Settings = GetDefault(); + const bool bHasUrl = Settings && !Message.Url.IsEmpty(); + const bool bUrlIsHttp = bHasUrl && (Message.Url.StartsWith(TEXT("https://")) || Message.Url.StartsWith(TEXT("http://"))); + const bool bShowUrlButton = bUrlIsHttp && (!Settings->bRestrictLinksToSameDomain || IsSameDomain(Settings->NoticesUrl, Message.Url)); + + if (bShowUrlButton) + { + Info.ButtonDetails.Add(FNotificationButtonInfo( + FText::FromString(TEXT("詳細を見る")), + FText::FromString(TEXT("Open notice details")), + FSimpleDelegate::CreateLambda([Url = Message.Url]() + { + FPlatformProcess::LaunchURL(*Url, nullptr, nullptr); + }) + )); + } + + TSharedRef> NotificationHandle = MakeShared>(); + Info.ButtonDetails.Add(FNotificationButtonInfo( + FText::FromString(TEXT("閉じる")), + FText::FromString(TEXT("Close")), + FSimpleDelegate::CreateLambda([NotificationHandle]() + { + if (TSharedPtr Notification = NotificationHandle->Pin()) + { + Notification->SetCompletionState(SNotificationItem::CS_None); + Notification->ExpireAndFadeout(); + } + }) + )); + + *NotificationHandle = FSlateNotificationManager::Get().AddNotification(Info); + if (TSharedPtr Notification = NotificationHandle->Pin()) + { + Notification->SetCompletionState(SNotificationItem::CS_Pending); + } +} + +void UPluginNoticeSubsystem::MarkSeen(const FString& MessageId) +{ + if (!MessageId.IsEmpty()) + { + State.SeenIds.Add(MessageId); + } +} + +bool UPluginNoticeSubsystem::IsSameDomain(const FString& BaseUrl, const FString& TargetUrl) +{ + auto ExtractDomain = [](const FString& Url) -> FString + { + FString WorkingUrl = Url; + WorkingUrl.TrimStartAndEndInline(); + + int32 SchemeIndex = INDEX_NONE; + if (WorkingUrl.FindChar(TEXT(':'), SchemeIndex)) + { + WorkingUrl = WorkingUrl.Mid(SchemeIndex + 1); + WorkingUrl.TrimStartAndEndInline(); + if (WorkingUrl.StartsWith(TEXT("//"))) + { + WorkingUrl.RightChopInline(2); + } + } + + int32 SlashIndex = INDEX_NONE; + if (WorkingUrl.FindChar(TEXT('/'), SlashIndex)) + { + WorkingUrl = WorkingUrl.Left(SlashIndex); + } + + int32 PortIndex = INDEX_NONE; + if (WorkingUrl.FindChar(TEXT(':'), PortIndex)) + { + WorkingUrl = WorkingUrl.Left(PortIndex); + } + + WorkingUrl.TrimStartAndEndInline(); + return WorkingUrl.ToLower(); + }; + + const FString BaseDomain = ExtractDomain(BaseUrl); + const FString TargetDomain = ExtractDomain(TargetUrl); + if (BaseDomain.IsEmpty() || TargetDomain.IsEmpty()) + { + return false; + } + + return BaseDomain.Equals(TargetDomain, ESearchCase::IgnoreCase); +} + +bool UPluginNoticeSubsystem::TryParseIso8601(const FString& IsoString, FDateTime& OutDateTime) +{ + return FDateTime::ParseIso8601(*IsoString, OutDateTime); +} + +int32 UPluginNoticeSubsystem::CompareEngineVersions(const FEngineVersion& Left, const FEngineVersion& Right) +{ + if (Left.GetMajor() != Right.GetMajor()) + { + return Left.GetMajor() < Right.GetMajor() ? -1 : 1; + } + + if (Left.GetMinor() != Right.GetMinor()) + { + return Left.GetMinor() < Right.GetMinor() ? -1 : 1; + } + + if (Left.GetPatch() != Right.GetPatch()) + { + return Left.GetPatch() < Right.GetPatch() ? -1 : 1; + } + + if (Left.GetChangelist() != Right.GetChangelist()) + { + return Left.GetChangelist() < Right.GetChangelist() ? -1 : 1; + } + + return 0; +} diff --git a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterFactory.cpp b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterFactory.cpp index 73d3ddb..898327a 100644 --- a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterFactory.cpp +++ b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterFactory.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonGenerateParameterFactory.h" #include "Parameter/DungeonGenerateParameter.h" diff --git a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterTypeActions.cpp b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterTypeActions.cpp index 64ba5df..c6c25e4 100644 --- a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterTypeActions.cpp +++ b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonGenerateParameterTypeActions.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonGenerateParameterTypeActions.h" #include "Parameter/DungeonGenerateParameter.h" diff --git a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseFactory.cpp b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseFactory.cpp index 4e27b8a..5960b54 100644 --- a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseFactory.cpp +++ b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseFactory.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonMeshSetDatabaseFactory.h" #include "Parameter/DungeonMeshSetDatabase.h" diff --git a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseTypeActions.cpp b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseTypeActions.cpp index ad43070..c50419c 100644 --- a/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseTypeActions.cpp +++ b/Source/DungeonGeneratorEditor/Private/Parameter/DungeonMeshSetDatabaseTypeActions.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #include "Parameter/DungeonMeshSetDatabaseTypeActions.h" #include "Parameter/DungeonMeshSetDatabase.h" diff --git a/Source/DungeonGeneratorEditor/Private/PluginInfomation.h b/Source/DungeonGeneratorEditor/Private/PluginInfomation.h deleted file mode 100644 index e23598f..0000000 --- a/Source/DungeonGeneratorEditor/Private/PluginInfomation.h +++ /dev/null @@ -1,19 +0,0 @@ -/*! -This is automatically generated file. -DO NOT EDIT THIS FILE. -\author Shun Moriya -\copyright 2023- Shun Moriya -All Rights Reserved. -*/ -#pragma once -#if !defined(DUNGENERATOR_PLUGIN_INFOMATION_DETECTED) -#define DUNGENERATOR_PLUGIN_INFOMATION_DETECTED -#define DUNGENERATOR_PLUGIN_FILE_VERSION 3 -#define DUNGENERATOR_PLUGIN_VERSION 0 -#define DUNGENERATOR_PLUGIN_VERSION_NAME "1.0.0" -#define DUNGENERATOR_PLUGIN_FRIENDLY_NAME "Procedural 3D Dungeon Generator" -#define DUNGENERATOR_PLUGIN_DESCRIPTION "Procedural 3D dungeon generator plugin. Easy generation of levels, mini-maps and missions." -#define DUNGENERATOR_PLUGIN_DOCS_URL "https://github.com/shun126/UE5-DungeonGeneratorDemo/wiki" -#define DUNGENERATOR_PLUGIN_SUPPORT_URL "https://github.com/shun126/UE5-DungeonGeneratorDemo/discussions/" -#define DUNGENERATOR_PLUGIN_BETA_VERSION true -#endif diff --git a/Source/DungeonGeneratorEditor/Private/PluginInformation.h b/Source/DungeonGeneratorEditor/Private/PluginInformation.h new file mode 100644 index 0000000..45c48ac --- /dev/null +++ b/Source/DungeonGeneratorEditor/Private/PluginInformation.h @@ -0,0 +1,19 @@ +/*! +This is automatically generated file. +DO NOT EDIT THIS FILE. +\author Shun Moriya +\copyright 2023- Shun Moriya +All Rights Reserved. +*/ +#pragma once +#if !defined(DUNGEON_GENERATOR_PLUGIN_INFORMATION_DETECTED) +#define DUNGEON_GENERATOR_PLUGIN_INFORMATION_DETECTED +#define DUNGEON_GENERATOR_PLUGIN_FILE_VERSION 3 +#define DUNGEON_GENERATOR_PLUGIN_VERSION 63 +#define DUNGEON_GENERATOR_PLUGIN_VERSION_NAME "1.8.0" +#define DUNGEON_GENERATOR_PLUGIN_FRIENDLY_NAME "Dungeon Generator" +#define DUNGEON_GENERATOR_PLUGIN_DESCRIPTION "Procedural 3d dungeon generator plugin. Easy generation of levels, mini-maps and missions." +#define DUNGEON_GENERATOR_PLUGIN_DOCS_URL "https://github.com/shun126/UE5-DungeonGeneratorDemo/wiki" +#define DUNGEON_GENERATOR_PLUGIN_SUPPORT_URL "https://github.com/shun126/DungeonGenerator/discussions" +#define DUNGEON_GENERATOR_PLUGIN_BETA_VERSION true +#endif diff --git a/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseFactory.cpp b/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseFactory.cpp index cc17953..e64eb45 100644 --- a/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseFactory.cpp +++ b/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseFactory.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ #include "SubActor/DungeonRoomSensorDatabaseFactory.h" #include "SubActor/DungeonRoomSensorDatabase.h" diff --git a/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseTypeActions.cpp b/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseTypeActions.cpp index 1973967..3f53dbd 100644 --- a/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseTypeActions.cpp +++ b/Source/DungeonGeneratorEditor/Private/SubActor/DungeonRoomSensorDatabaseTypeActions.cpp @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2025- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2025- Shun Moriya + * All Rights Reserved. + */ #include "SubActor/DungeonRoomSensorDatabaseTypeActions.h" #include "SubActor/DungeonRoomSensorDatabase.h" diff --git a/Source/DungeonGeneratorEditor/Public/DungeonAssetTypeActionsBase.h b/Source/DungeonGeneratorEditor/Public/DungeonAssetTypeActionsBase.h index aa9e93f..5176299 100644 --- a/Source/DungeonGeneratorEditor/Public/DungeonAssetTypeActionsBase.h +++ b/Source/DungeonGeneratorEditor/Public/DungeonAssetTypeActionsBase.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2024- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2024- Shun Moriya + * All Rights Reserved. + */ #pragma once #include diff --git a/Source/DungeonGeneratorEditor/Public/DungeonGeneratorCommands.h b/Source/DungeonGeneratorEditor/Public/DungeonGeneratorCommands.h index 5b84131..7d4f29d 100644 --- a/Source/DungeonGeneratorEditor/Public/DungeonGeneratorCommands.h +++ b/Source/DungeonGeneratorEditor/Public/DungeonGeneratorCommands.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once diff --git a/Source/DungeonGeneratorEditor/Public/DungeonGeneratorEditorModule.h b/Source/DungeonGeneratorEditor/Public/DungeonGeneratorEditorModule.h index afd888b..e5e4461 100644 --- a/Source/DungeonGeneratorEditor/Public/DungeonGeneratorEditorModule.h +++ b/Source/DungeonGeneratorEditor/Public/DungeonGeneratorEditorModule.h @@ -1,8 +1,8 @@ /** -@author Shun Moriya -@copyright 2023- Shun Moriya -All Rights Reserved. -*/ + * @author Shun Moriya + * @copyright 2023- Shun Moriya + * All Rights Reserved. + */ #pragma once #include