Skip to content

Commit

Permalink
Update layout-generation-instructions.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mpewsey authored Jun 3, 2024
1 parent 26e6d27 commit 3d7ff97
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions docs/pages/layout-generation-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ The procedural generator creates layouts by pulling from user-defined room templ
1. From an empty scene in Godot, create a `RoomNode2D` or `RoomNode3D` depending on whether you wish to develop in 2D or 3D. One of these node types must serve as the root of your room scene.
2. In the inspector, specify the number of cell rows and columns, along with the cell size to create the bounding shape of the room.
3. When the room node is selected, a toolbar will appear in the Godot main window (Circled in red in the screenshot below). The options on this toolbar may be used to edit the cell activities to further define the shape of the room. For instance, selecting the toggle edit mode button, then clicking or dragging over cells in the view will toggle the targeted cells on or off.
* **Note:** For `RoomNode3D`, you must be in the top view in order to edit cell activities. The top view can be navigated to by clicking the positive Y axis on the axis gizmo or selecting `Top View` from the 3D main window's perspective menu. The toolbar will show a check mark when the cells can be edited.

> [!NOTE]
> For `RoomNode3D`, you must be in the top view in order to edit cell activities. The top view can be navigated to by clicking the positive Y axis on the axis gizmo or selecting `Top View` from the 3D main window's perspective menu. The toolbar will show a check mark when the cells can be edited.
In the below screenshot, the cells for an angle shaped room have been created, with the active cells shown in blue and inactive cells shown in red and crossed-out. The active cells are the regions where we intend to build our scene.

Expand All @@ -21,12 +23,11 @@ In the below screenshot, the cells for an angle shaped room have been created, w

Doors define the locations where two rooms can be connected. At least one door must be added to a room.

1. Add a `DoorNode2D` or `DoorNode3D` as a child of the room based on your room type.
* To save time, you may wish to create your doors as separate scenes with any related nodes, such as sprites or collision, as children. These scenes can then be referenced in your room scene.
2. Position the door within the room and assign its direction and connection constraints.
3. To auto assign the closest cell and direction to the door, make sure the applicable flags are selected in the inspector and click the `Auto Assign` button on the room toolbar. The assigned door direction will be based on its location relative to the center of its assigned cell.
1. Add a `DoorNode2D` or `DoorNode3D` as a child of the room based on your room type. To save time, you may wish to create your doors as separate scenes with any related nodes, such as sprites or collision, as children. These scenes can then be referenced in your room scene.
3. Position the door within the room and assign its direction and connection constraints.
4. To auto assign the closest cell and direction to the door, make sure the applicable flags are selected in the inspector and click the `Auto Assign` button on the room toolbar. The assigned door direction will be based on its location relative to the center of its assigned cell.

**Note:** Additional room child nodes such as `CollectableSpot2D`, `Feature2D`, `RoomFlag2D`, or their respective 3D nodes can also be added to the room if you wish them to be included.
Additional room child nodes such as `CollectableSpot2D`, `Feature2D`, `RoomFlag2D`, or their respective 3D nodes can also be added to the room if you wish them to be included.

![Screenshot 2024-05-31 150604](https://github.com/mpewsey/ManiaMap.Godot/assets/23442063/f7bff083-d1a2-452f-9d57-c79f68b1b31e)

Expand All @@ -53,9 +54,10 @@ The procedural generator uses a `LayoutGraphResource` as a base for generating l
2. Double click on created resource and a `Graph Editor` tab will appear in Godot's bottom panel.
3. In the `Graph Editor` panel, right click to add nodes, which will serve as room locations, to the graph.
4. To add edges, serving as connections between rooms, to the graph, click and drag between the circular handles on the right and left sides of two nodes.
5. Selecting nodes and/or edges will allow you to edit their properties in the Godot inspector. Each node must have a `TemplateGroup` assigned; though it is optional for edges.

**Note:** Edits to the layout graph will be saved automatically when Godot or the graph editor panel are closed.
5. Selecting nodes and/or edges will allow you to edit their properties in the Godot inspector. Each node must have a `TemplateGroup` assigned; though it is optional for edges.

> [!NOTE]
> Edits to the layout graph will be saved automatically when Godot or the graph editor panel are closed.
![Screenshot 2024-05-31 193835](https://github.com/mpewsey/ManiaMap.Godot/assets/23442063/5e2daf51-6ae6-47f7-8ccb-981780de94ec)

Expand Down Expand Up @@ -93,4 +95,5 @@ public partial class ExampleGenerationPipelineRunner : Node
}
```

**Note:** Depending on your room templates and layout graph, it may not be possible to generate a layout for all (if any) random seeds. If you are encountering issues with successfully generating a layout, you may need to reconsider the constraints imposed on its generation. For example, you may need to add more doors to ensure that your rooms have a better chance of connecting. Even then, you may still encounter some isolated failures, in which case the generation pipeline `RunAttempsAsync` method can help by automatically falling back to other seeds.
> [!NOTE]
> Depending on your room templates and layout graph, it may not be possible to generate a layout for all (if any) random seeds. If you are encountering issues with successfully generating a layout, you may need to reconsider the constraints imposed on its generation. For example, you may need to add more doors to ensure that your rooms have a better chance of connecting. Even then, you may still encounter some isolated failures, in which case the generation pipeline `RunAttempsAsync` method can help by automatically falling back to other seeds.

0 comments on commit 3d7ff97

Please sign in to comment.