Posted November 18, 2024 by Limekys
Added dungeons generator
New files in source code:
New files in demo:
This system now has an oDungeonGenerator object and a createDungeon function that allow you to generate multi-room structures.
This object creates a structure in the world not immediately in one game frame, but spreads the load over several frames depending on the size of the structure.
My example of generating “abandoned mines” has been added to the project.
1. You create your own function in which you can describe the generator of your structure according to my example:
* You create struct BlockStructure in which you describe the generation of one room or one large structure.
* Next you create an object of the generator of this structure using the function createDungeon where you pass the structure with your world, coordinates and previously created BlockStructure.
* Then you create objects if necessary (In the future the system of object creation will be improved).
2. You can create a generator of both a single structure and a structure with several rooms:
* In case your generator function describes the generation of a single room, you can create a room generator object according to my example. And add the creation of the room generator object to the biome generator functions.
* In case your function describes generation of one structure, you can use this function in the biome generator directly.