- Home /
Generating grid with specified number of connections between nodes
Hey guys!
I wanted to include a map generator to my game, that could make something like that:
So, a diagonal grid of specified size, with starting point at the center, a specified number of nodes with one connection or two connections and some amount of filler nodes.
I'm not asking about code, but rather how would you structure the scripts to make it efficient, but feel free to post code or pseudocode.
To give you more information about the problem. This generator will be used as a dungeon floor generator, where rooms will lead to up to 4 other rooms, but I want treasure rooms or boss rooms to have only one entrance. Then, I could create a mini quest in a nearby room, where...F.E. a scrap of paper will tell you to "go north to get treasure" (I don't want those mini quests to drag player across whole dungeon, I'll just use some Pathfinding-based system to spawn quest givers after dungeon generation)
The question is not that specific so I'll just give some ideas.
The grid system doesn't have to be "diagonal". That's just how you present it to the player, so the "diagonality" can be done by just tilting the camera when all else is done.
Just make a grid of "Room" objects (an array) and have each Room contain information about which directions you can move to from that room and what kind of loot that room has.
Your answer
Follow this Question
Related Questions
Texture grid displayed oddly when width =/= height 1 Answer
How do you save a seed? 1 Answer
Terrain hill generating by code 2 Answers
Tileset, large maps and game object 0 Answers
game grid generating whle in camera view ? 3d game scene) android 3 Answers