Skip to content

ApmeM/MazeGenerators

Repository files navigation

MazeGenerators

MazeGenerators is a set of helper classes to generate different types of mazes.

Examples

Dynamic example can be found here: https://apmem.github.io/MazeGenerators/Godot.html

Here are a few examples of mazes that can be generated:

Maze that contains rooms.

Regular tree maze.

Game of life generator.

Usage

Fill in GeneratorSettings data with required values.

        // Call different maze generator algorithms in a required order:
        public GeneratorResult Generate(GeneratorSettings settings)
        {
            var result = new GeneratorResult();
            CommonAlgorithm.GenerateField(result, settings);
            RoomGeneratorAlgorithm.GenerateRooms(result, settings, 0, 4, true, 2, 5, 5);
            TreeMazeBuilderAlgorithm.GrowMaze(result, settings, 0);
            RegionConnectorAlgorithm.GenerateConnectors(result, settings, 0);
            DeadEndRemoverAlgorithm.RemoveDeadEnds(result, settings);
            WallSurroundingAlgorithm.BuildWalls(result, settings);
            return result;
        }

        // Or usimg fluent syntax
        public GeneratorResult GenerateFluent(GeneratorSettings settings)
        {
            
            return Fluent
                .Build(settings)
                .GenerateField()
                .GenerateRooms(0, 4, true, 2, 5, 5)
                .GrowMaze(0)
                .GenerateConnectors(0)
                .RemoveDeadEnds()
                .BuildWalls()
                .result;
        }

Algorithms

CustomDrawAlgorithm - Add custom shapes of any type (fillrect, rectngle, point)

DeadEndRemoverAlgorithm - Remove dead ends - path tiles that have less then two paths connected

FieldGeneratorAlgorithm - Create field and check input parameters for correctness.

LifeGameAlgorithm - Generator based on "game of life" to create

MirroringAlgorithm - Mirror existing maze Horizontally/Vertically/Both or rotate it around center

RegionConnectorAlgorithm - Generate connectors between rooms and paths through empty tiles (EmptyTileId)

RoomGeneratorAlgorithm - Generate unconnected rooms

StringParserAlgorithm - Print and parse maze to/from string

TreeMazeBuilderAlgorithm - Generate unconnected maze paths in free spaces

WallSurroundingAlgorithm - Build walls around all passages, junctions and rooms

Credits

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages