A basic Godot addon to generate dungeons by using BSP algorithm.
- Download or clone this repository.
- Copy the folder addons/bsp_dungeon_generator to your addons path.
- Enable the plugin.
More information about addons at Godot - Installing Plugins
Instance a BSPDungeonGenerator object and generate the dungeon:
var dungeon_generator := BSPDungeonGenerator.new()
var dungeon := dungeon_generator.generate()
Optionally, you can modify the generation by creating a Parameters object.
# Create your own custom parameters
var parameters := BSPDungeonGenerator.Parameters.new()
parameters.seed = 123456789
parameters.size = Vector2i(25, 25)
var dungeon := dungeon_generator.generate(parameters)
Once the dungeon has been created, you can add your custom data by using add_data
function:
# Avoid create data touching walls.
var data_parameters := BSPDungeonGenerator.DataParameters.new()
data_parameters.avoid_walls = true
# Generate two "objects"
dungeon_generator.add_data(dungeon, 0, { "type": "start" }, data_parameters)
dungeon_generator.add_data(dungeon, 1, { "type": "exit" }, data_parameters)
Assets used in sample were made by Kenney - 1 Bit Pack.
Addon under GPLv3 license.