How would I make a random border?

Hello! I was making a Map where the user can generate their own grid map. I want to know how would you make a custom border for each of these maps.

pictures:

2 Likes

Honestly, this is quite challenging. I don’t know how you system works, so my answer is more like brainstorming. Since we are talking about grid system, we know that the map consists of small squares, that are of same size. Individually, they all cover the same area.
Maybe you can detect to how many other squares does one square border. If the watched square borders to 4 other squares, it doesn’t represent the border. If the watched square borders to 3 or less other squares, it represents the border of your map. You could loop through all squares (since you probably have them stored somewhere in Workspace) and check these conditions. Of course you can optimize this, because it could visibly affect performance. Function that updates border is fired on every map change.
When you have a list of outer squares, you can attach a new part to the “free”, unconnected sides of each. The parts have their transparency changed on their creation and have custom height, perhaps reach the height at which they touch the “ceiling” border (the cover, don’t forget about it), which prevents exploiters from flying out of your map. By the way, around this border should be another border that teleports exploiter back to the map and prevents noclip.
This is a basic concept. There are likely other solutions.

If you need any further help, I’ll try to answer as much as possible. Many aspects are still to think about here.

2 Likes

I think I know what you are talking about. I have all the place values stored in a table and the positions stored in another table.

1 Like

That’s good.
I’m trying to imagine how your system works. You obviously don’t have to explain the details as someone could potentially copy your idea, but it’s on you to decide anyway whether you want to allow that or not. I just have question about map expanding part. Even though there are numerous ways to expand the map, I’ve drawn three approaches. The first one is also associated with the most difficult way of border construction (you would have to cover all three unconnected sides, and it would be most performance draining, although the solution is feasible). The second approach is different. Currently I’ll assume that the player can only add one block at a time, so when they create one square in the same row multiple invisible squares form and expand the border, but the player can stand on them and not fall (I marked them with grey color in the picture below). The third approach would be diagonal adding, so with each row new layer forms. Again, I’ll pretend that grey blocks are invisible and can hold the player, but expand border at the same time. Another two ways, which are not displayed below, are similar to approaches two and three. The same thing would happen, but player can only create row at a time and not individual square (color them later and select type of surface). Building border when these approaches are used would be a little less demanding as well as less performance draining.

Check this out and please familiarize me with your approach so we can think further:

3 Likes

Hm, I was thinking about seeing where each grid block is placed. If the grid block is placed on square 40 and the grid was 40 I would clone it out that direction and I would do that to each border block.

2 Likes

I did a little bit of calculating with for loops. I got the result I want :slightly_smiling_face:

3 Likes

Here is an epic transformation, Thank you for all of your help. You made me think to use for loops to make the border happen.

Here is the final border picture:

2 Likes