• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker [Help] Procedural Dungeon with premade rooms

RedP

Member
Hi, so recently I started to feel more confident in my programming skills and started to mess around with grids and lists, until I decided to try to do a random dungeon with premade rooms, and I can’t understand how it works, I mean, I understand the grid stuff and how each room corresponds to a cell in the grid, my problem is to understand what I have to write in codes so that my game knows which cell in the grid is adjacent to one that I already have a room??? And so on, how do I get the grid to choose a random direction from another room??

I'm using this tutorial that I found as a basis:
1590027677538.png

My problem is in item 5, how do I "choose a random adjacent cell for my grid to set to 1" ??

I'm going crazy trying to find a solution.

Thank u!!!
 

NightFrost

Member
That's not what item 5 on the list appears to say. But to choose an adjacent cell you randomly choose one of four alternatives: y-1, x+1, y+1 or x-1. Which is not all there is to it, as you have to mind not crossing grid edges. If above text is all that there's to the tutorial, it seems to omit mentioning that you must be tracking your current grid position. You can't "choose adjacent" if you don't know where you are.

(Incidentally, this random wander proc-gen method is usually called the Drunkard Walk.)
 
Top