Random Tile Placement + Surroundings

Hi everyone. I am trying to implement a random dungeon generator. What im curious about , is if theres a established routine for verifying the important adjacent tiles as the new tile is placed. I have drawn out a diagram, and as far as i can tell , if i iterate through a 8 x 8 array from [0, 0] up, *exlcuding all the outer walls tiles, there is only ever 2 tiles that i need to actually check, when placing a tile…

For eg, if i have a tile being placed at [2, 3], the only two tiles that need to be checked would be [2, 2] and [1, 3]. Any other tiles are either not adjacent , or havent been created / placed yet.

Now , i could be way out to lunch, and have no clue what im doing, but so far i have managed to get a 8 x 8 grid populated with my random dungeon tiles, but i have only been able to enforce outer wall peices , and the first [x, ] dimension of the array to locate properly. All my other peices are quite the headache.

I have created all the possible combinations of N, E, S, W , SW, NW, NE etc , mini room prefabs. So, all the right peices to make proper connetinos should be there.

Please understand , that im not interested in being pointed to a downloadable project full of things i woud have to sift through trying to extort the relevant information, but more so , im interested in just quick pointers , maybe thoughts , something i have missed. I know im close to achieving this, and i do indeed want to fuly understand all the code i have created / use for this to happen.

Thanks for any tips , pointers.

Bump, cmon peoples , helpa guy out , many of you have created mini random tile gens, i just need some help with mine please :stuck_out_tongue:

Just some notes of mine:

If they help let me know.

Hey thanks for those links.

I did manage to get my dungeon randomly working now. Now i have one other problem though. This one seems simple in comparison, but for some reason , i cant get it working. When i create the dungeon , i have an integer returned referencing the total gridTiles being used, and if it doesnt == a certain total, i would like to force it to reroll again. I have tried using this , but it seems to completely lock up my computer :(. CTRL ALT DEL to kill unity.

function CreateDungeon(){
	var dGenerator : DungeonGenerator = GetComponent(DungeonGenerator);
		while(dGenerator.CreateRandomDungeon() != dGenerator.maxX * dGenerator.maxY){
		
	}
}

Hmm , ok , i sorted out the loop, seems a yield statement inside a do while loop worked out just fine.