Optimal method for semi-procedural map (tilesets)


I’m working on an orthographic dungeon crawler that semi-procedurally-generated maps to diversify player experience. I was inspired to use tilesets by popular games such as Warframe, where players will eventually grasp the ins-and-outs of certain tiles, rather than having a 100% generated map where they have to essentially re-learn map configurations for each play session.

As of now, I’m using 64x64 tiles that have x number of Attachment instances that represent each possible entrance/exit. I’m beginning with one ‘origin’ tile that acts as the beginning for all other paths to branch out. This is where I run into a problem; (attached is an annotated screenshot of two of the tiles i have built; the attachments are represented by the orange boxes)

  1. Let’s say that Tile 1 is the origin tile where players will spawn. When it is selected, it is cloned from ReplicatedStorage and into the workspace, and rotate its primary part between 0 and 360 degrees in 90-degree increments. When this is done, it will randomly select another tile, which is Tile 2. Although the paths line up, let’s say that Tile 1 is rotated 90 degrees counter-clockwise so that a connection cannot be made between the two tiles. How will I be able to position and orient Tile 2 so that a clear connection/path can be made between the two tiles?

In short, I want to know how I can translate and rotate a model/model’s PrimaryPart in relation to the CFrame of it’s attachment, and in turn snap that attachment to another attachment of another tile.

Sorry for my wording; I really don’t know how to articulate this question well.

If you change your Attachment points to invisible parts, you could rotate until they are touching. This may not be the best solution, but it should work. Just give them special names, and check for those names.

1 Like

I was actually just thinking of this, thank you very much. I realized that so long as I have all of the invisible parts facing inward/in the same direction, I can just use SetPrimaryPartCFrame to have them essentially snap towards each other without the additional mess.