Hey, I’m making a small horror game for fun, in which the concept is about doing a task to flee a small sewer map.
I have a few things ready for it, but the thing is I want to know how to make a Map Generation Algorithm with some models of the map prepared at ServerStorage. Pretty much the map doesn’t need to be big, instead it’ll be a medium sized map.
Since I am not really good at scripting, I’d like to know how to create a Script about this.
I’ll be hearing and trying every solution!
EDIT: I got home a while ago and I had no time to attach the picture of the models, but here they are. What should I do?
Do you want the map to be built with the modular parts that you have?
Please give more info, as there are lot of ways to do what you want!
Now that i think of it, a way to achieve the thing you want is having some “template rooms” grouped as models in ReplicatedStorage or ServerStorage (Doesn’t really matters as it will be replicated from a server script)
With your template rooms, you will need an “anchor part” to try anochoring it at an entry from a room. Something like this:
You can have a starter room, then you can start making rooms only to the left. Or left and right, or the four ways too.
The template rooms will need an anchor part, and the “group” of the template room will have it’s PrimaryPart set to the anchor part. You can add an invisible part to the template rooms that cover everything in the room, so you can check if a new room is overlaping another if the new room’s “Hitbox” is colliding with another room’s hitbox.
Hope this helps. If i have spare time, i will come back with an example roblox studio place.
I’ll be hearing and trying every solution!
Here is an example Place:
[PLEASE DONT USE THIS, AS THIS IS OUTDATED. I POSTED A NEW VERSION WITH NEW FEATURES BELOW IN A NEW POST]
[DONT USE THIS!!!]
Test Room Generator [OUTDATED V1].rbxl[/spoiler] (49.7 KB)
This place takes a room from a folder in ReplicatedStorage called “StarterRooms”, and from there, it generates new rooms from a folder called “TemplateRooms”, and will generate rooms as many times as specified in the configuration.
Then, it takes the new generated room’s anchor point to position the room in the “parent” room’s access.
As you can see in the video, the red parts are the anchor points, and the green parts are the room access of the room
(Hope it’s clear what I’m saying, i think I’m not explaining it well)
There’s more detail that i skipped in the Place’s main server script
Hope this is helpful for anyone, it took me some time!
I’m going check it out and see if it works with the rooms I have, I’ll let you know if it worked perfectly!
So I’m currently giving it a shot with all the maps I have (Which for now their designs are not the greatest but it’s a prototype for testing purposes).
The problem is when I run the game / script, it only places the starter room and it didn’t start placing the template rooms, I’ve tried checking the code and making sure everything is right on the models and everything else.
Should I send the models so we can check what’s going on?
Yes! I will be glad to help you, send the models and i will check what’s going on.
In any case, i hope you checked the configuration to see if a configuration is messing up something
aquí están los modelos! perdon por la gran demora, ya que estoy muy ocupado en mis vacaciones
LolXD.rbxm (28.2 KB)
Finally, i fixed it! Also, i added a feature to add “EndingRooms”
Test Room Generator v2.rbxl (49.7 KB)
Also, don’t use your old models, use the models that are in this place, because for some reason, the “RoomAccess” parts were flipped and caused errors when generating.
Your rooms were not generating because there was a missing part when generating that was called “Floor”. This check is now removed, and now the scripts checks for a part called “Hitbox”, that has to cover a smaller area of the room.
I recommend you to start opening the “Output”, the roblox tools that prints errors and helps you debug any script you have. The first thing that i saw to identify why the script was not generating any room was the error in the output. Please start using this feature, as it is essential for a roblox developer!
Hope this is useful for you and for anyone else, as i dedicated many hours to this solution!