OndrejNepozitek / Edgar-Unity

Unity Procedural Level Generator
https://ondrejnepozitek.github.io/Edgar-Unity/docs/introduction
MIT License
817 stars 70 forks source link

Manual creation of Doors cause issues #79

Closed bravery3000 closed 3 years ago

bravery3000 commented 3 years ago

Hi,

I'm trying to build a simple room and corridor, where I have created one single square room and add only one door tile at each side of the room, and create another corridor template and specify one time at each end of the corridor.

Now when I run the level generator I got the below error, please advise how to fix this:

InvalidOperationException: Timeout was reached when generating level ProceduralLevelGenerator.Unity.Generators.DungeonGenerator.PipelineTasks.DungeonGeneratorTask1+<Process>d__2[TPayload].MoveNext () (at Assets/ProceduralLevelGenerator/Runtime/Generators/DungeonGenerator/PipelineTasks/DungeonGeneratorTask.cs:86) ProceduralLevelGenerator.Unity.Pipeline.PipelineRunner1+d1[TPayload].MoveNext () (at Assets/ProceduralLevelGenerator/Runtime/Pipeline/PipelineRunner.cs:29) ProceduralLevelGenerator.Unity.Pipeline.PipelineRunner1[TPayload].Run (System.Collections.Generic.IEnumerable1[T] pipelineTasks, TPayload payload) (at Assets/ProceduralLevelGenerator/Runtime/Pipeline/PipelineRunner.cs:16) ProceduralLevelGenerator.Unity.Generators.Common.LevelGeneratorBase`1[TPayload].Generate () (at Assets/ProceduralLevelGenerator/Runtime/Generators/Common/LevelGeneratorBase.cs:41) ProceduralLevelGenerator.Unity.Editor.LevelGenerators.DungeonGeneratorInspector.OnInspectorGUI () (at Assets/ProceduralLevelGenerator/Editor/LevelGenerators/DungeonGeneratorInspector.cs:65) UnityEditor.UIElements.InspectorElement+<>cDisplayClass55_0.b__0 () (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

OndrejNepozitek commented 3 years ago

Hey! The timeout error usually that there's something wrong with your room templates. For example, the generator might be unable to produce a level if there's no way to connect two neighbouring rooms. That can be caused for example if you accidentally use different lengths of doors.

Please do the following: There is an "Advanced" section in the Dungeon Generator component and there should be an "Export map description" button. Click the button and it should create a file called "exportedMapDescription.json" in the root folder of your project. Please send me this file - it contains information about the shapes of your rooms. (In order to attach the file to this issue, you have to convert it to a txt file). I'll look into that file so we can solve the issue.

I want to implement some input validation logic in order to solve these issues more easily in the future. So hopefully it'll be included in the next version of the asset.

bravery3000 commented 3 years ago

Hi Onder, and thanks for the quick reply, here is the content of the file:

exportedMapDescription.txt

OndrejNepozitek commented 3 years ago

From the file that you sent me, it seems to me that you only have a single corridor room template. If I'm reading the file properly, the corridor room template is vertical - it can connect two rooms if one of the rooms is above the other room. The problem is that your level graph seems to be a cycle which is impossible to generate using only vertical corridors. Please create a second corridor room template so you can connect rooms both horizontally and vertically.

Let me know if it helps!

bravery3000 commented 3 years ago

Yep that did the trick thank you :)