I am planning on making a roguelike dungeon generator using tilemaps. My plan is to have a tilemap as its own scene and instantiate that into a bunch of "room" scenes. And then the code will go through the "rooms" folder to find rooms that will be instantiated into the main scene. However im struggling to find a good way of keeping track of where the doors are and how to even generate the rooms because a map will be needed so they need to make sense in phhysical space. I cant just load a random room when you go through a door because you need to be able to loop around to connecting rooms.
#RogueLike Dungeon Generation
77 messages · Page 1 of 1 (latest)
Im new to godot, so i dont know all the resources i have at my disposal. Thats why im confused
This is my plan for the rooms, and marking the doors
My plan was to name the room scenes left_down_3 For a room with a left door, a down door, and a weight of 3.
Is there a better way of doing this?
Are you generating prebuilt rooms or are you planning to generate the entire room
Prebuilt, that the whole point of the "room" scenes
I just dont know how to keep track of the room info, such as what doors it has, its chance of spawning. I also dont know how to generate the map with continuity
Only one room will be loaded at a time
But i need to keep track of where the rooms are for a literal map that the player caqn view
If you are generating prebuilt scenes it would make more sense to just store the Vector2i coords of your door tile on a dictionary or something to match with the room
See, im new to godot and didnt even know that was possible or what you mean lol
Iv got a good amount of Java experience but never done game development
So the idea of working with nodes and game objects is foreign to me lol
How would i do this
wait what are you trying to do, why make a tilemap and insantiate it into a bunch of room scenes? do you mean have a tileset that generates into a bunch of room scenes or grid layouts?
No, i have a tilemap that Im using to prebuild the rooms in their own scenes, i thought it would be better than copy pasting the same tilemap into a bunch of scenes
I origionally wanted to use patterns for the rooms but couldnt keep track of where the doors were
so youre trying to generate multiple tilemap scenes that have a prebuilt layout into your main scene?
yes
hmm I never tried that it might work a bit weirdly
i would usually have a single tilemap in your scene
and generate the entire tilemap of your scene through random patterns of your room layouts
Yeah, i dont knkow if theres a better way
The problem with that, is i dont know how to keep track of where the doors are
Do most people just not use tilemaps? This feels too complicated
yea to be fair it took me a while to figure out tilemaps at first aswell
are you planning to add animations to each door?
wdym?
The player should just be teleported via a loading screen
Every room is gonna exist on its own
But i need them to be kept track of in physical space, if that makes sense
For the map, like they need to have a physical position?
well you could setup custom data for your door tiles, and on collision, check for the custom data. if it matches with the door teleport your player on your player script
That makes sense
But i still need to track the direction of where the door is for generation purposes
the most straightforward way i think is just to manually export a dictionary var and identify your rooms with a key, and have the value as a Vector2i coord of your door. then you can acess its coordinates from the dictionary if it corresponds with the room
How do i do that lol
Completely new to godot
Wdym a dictionary
Is that a type of node
I have no reference
Do you mean make an empty node with a script attatched and keep track of variables in the script
wdym by keeping track of the direction of the door for generation purposes?
Like, if im generating the rooms. I need to know if the room has a door to the left, so i can generate that
so like if theres a door to the left you generate a prebuilt tilemap room in the left of the scene?
yeah? i think thats correct
But only one room is gonna be rendered at a time
But the whole map is gonna be generated at the beginning
So i can keep track of the rooms
Cause i dont want the player to backtrack and then tada its a new room
Also theres gonna be a minimap that needs to be consistant with the physical rooms
I realize i might be trying to figure too much out all at once
But idk what to start with
Becauyse i dont wanna have to redo stuff because of a change later down the road
why generate the entire map in a single scene then if youre just going to be teleporting the player into another rooom? are you trying to make it so that the player can see other rooms from their fov?
No, im not saying i need to generate them into a single scene. Im saying i need to generate a layout of the map, and then teleport the player to the rooms based on the layout.
But idk how to do that
how many doors will you have in each room?
Well, i want it to vary. but i know i can add that later since its complicated
I want the size of the rooms to vary, the position of the doors, and the amount of doors
Cause if i have a room thats the size of 2 rooms, it can have 2 doors that lead down
Im thinking of making the rooms have door positions, and then generating doors where i need them
So like if a room has 4 doors, up left, down, right. But theres only a room to the left, and down. Then that room will only have a left and down door
And ill, figure out a way to fill in the other doors with walls
Ik its complicated you can see why i as a beginner am confused
okay heres how I would do it, like I would make a dictionary and store each tilemap as a value with a key as the vector2i. if the door is on the right the vector2i.x would +1 or if the door is on the bottom the vector2i.y would +1. then depending on the vector coords key I would load the tilemap scene from your dictionary
if you want the player to backtrack and go to previously cleared rooms you would also probably have to make a system that saves the rooms so when the player teleports to it it doesnt reset
like for example the room two rooms tp the right of the starting room would be Vector2i(0,3)