Skip to main content
Version: Next

Post-processing

After a level is generated, you may often want to run some additional logic like spawning enemies, etc. This can be achieved by providing your own post-processing logic that will be called after the level is generated, and will be provided with information about the level.

To better understand how the generator works, I will first describe which post-processing is done by the generator itself and then provide ways to extend this behaviour and provide your own logic. You can skip right to Custom post-processing if that is what you are looking for.

Built-in post-processing steps​

1. Center level​

In this step, the whole level is moved in a way that its centre ends up at (0,0). This step is only used to make it easier to go through multiple generated levels without having to move the camera around.

2. Process connectors and blockers​

In this step, the generator goes through the door handlers of individual room templates and spawns blockers on tiles where no door was added, and adds connectors on tiles where a door was added.

Custom post-processing​

Note: This part of the guide lives in the 2D section of the documentation: here

The concepts are the same in the 2D version, you just have to replace the Grid2D class name suffix with Grid3D. For example, DungeonGeneratorPostProcessingGrid2D -> DungeonGeneratorPostProcessingGrid3D.

2D vs 3D docs: In order to keep the docs maintainable and up-to-date, I decided to have parts of the documentation only available for the 2D version of Edgar. This happens only when the concepts are very similar in both versions.

As a rule of thumb, if you see a class with the Grid2D suffix, there is a high chance that you can replace the suffix with Grid3D to get a class withs a very similar API.

If you have any questions regarding the 3D version od Edgar, come to our Discord or contact me directly via email (ondra@nepozitek.cz).