btastocks.blogg.se

Random dungeon map generator algorithm
Random dungeon map generator algorithm













Let’s start by creating a class which we’ll use to create our rooms. Let’s create a new file, called procgen.py, which will house our procedural generator. The better approach is to put our new code in a separate file, and utilize GameMap there. It puts a lot of code in GameMap where it doesn’t necessarily belong, and the class will grow to huge proportions if you ever decide to add an alternate dungeon generator. But, as HexDecimal (author of the TCOD library) pointed out in a pull request, that’s not very extensible. In fact, this was my plan for this tutorial as well. The original version of this tutorial put all of the dungeon generation in the GameMap class. Self.tiles = np.full((width, height), fill_value=tile_types.floor, order="F") self.tiles = np.full((width, height), fill_value=tile_types.wall, order="F") self.tiles = tile_types.wall Def _init_(self, width: int, height: int):















Random dungeon map generator algorithm