#Tilemaplayer and patterns for room generation

1 messages · Page 1 of 1 (latest)

keen flume
#

I have a a dungeon generation script that lays out a bunch of PackedScene made of my Tilemaplayer, However I can't use Astar2d to connect the rooms because they are separate scenes. Knowing now that all rooms need to use the same Tilemaplayer not separate scenes with that layer is there a way to store the those rooms using the patterns instead. I've tried to look up if any one has done something similar to no luck and I am worried that if I do this how am I going have items or objects in those rooms when I instanciate them if they where a pattern and not a scene. The only other way I can think of this if some how you can connect tilemmaplayers that are in seperate scenes but I don't think that is possible

ember kestrel
#

I did something similar to this a few years ago

#

tilemaplayers have two arrays of atlas coordinates (index of the tile on the tileset) and grid coordinates (position of the tile in the world)

#

one solution can be to read these two arrays from the tilemaplayer scenes, instantiate a blank tilemaplayer with the correct tileset, and then fill the the new layer with the info in the arrays read from the scenes

#

you will need to account for the desired position of the room by adding an offset to the grid coordinates that corresponds to its location in the world

#

another option would be to run an astar2d on each room individually, then implement a pathing algorithm (astar or otherwise) that takes the result from each room and finds the best path

#

your dungeon generator should know how the rooms connect, so you can effectively use each room as a single point in the pathing algorithm for multi-room pathing