# Small map generator

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I need to generate a random small map. The size of the map is only 30x30 squares. While the edges of the map have walls, so the actual free space is only 28x28. I need to generate only rooms and coridors (maze like coridors). The rooms need to be rectangular. How would I generate several diverse random map with these specifications? Thanks in advance. [Edited by - The C modest god on September 9, 2005 8:52:03 AM]

##### Share on other sites
Well, there is NeHe Lesson 42 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=42), where they feature multiple viewports, but in the midle of the lesson, there is a maze generator bein used. It's a very simple one, and I believe that it won't guarantee you that the maze has a solution, but you can modify it to do that.

EDIT: Actually, I was taking another look at the maze generated, and it looks like it will actually aways generate a maze with a solution.

##### Share on other sites
Quote:
 Original post by algumacoisaqualquerWell, there is NeHe Lesson 42 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=42), where they feature multiple viewports, but in the midle of the lesson, there is a maze generator bein used. It's a very simple one, and I believe that it won't guarantee you that the maze has a solution, but you can modify it to do that.EDIT: Actually, I was taking another look at the maze generated, and it looks like it will actually aways generate a maze with a solution.

The maze I want to create does not have a solution.
Most of the space needs to be connected, but there is no entrance to the maze (just a starting point), and the exit may be somewhere inside the maze (a teleport).
I am not sure this will create big enough rectangular rooms.
I need the maze to be mostly big rectangular rooms, and some few cooridors.
Anyway, this algorithem gave some ideas, how to do a random maze.
More tutorials like this might be helpful.

##### Share on other sites
http://www.aarg.net/~minam/dungeon.cgi

That might give you some idea on how to do it..
I figure I'd start with the rooms, how many rooms do I want and how big can they be? and then place them in the map. Then I would try to fill in the gaps with hallways from one room to another.

Anyways I don't know if you need to create them on the fly or if you just wanted a generator.

##### Share on other sites
Quote:
 Original post by Turt99http://www.aarg.net/~minam/dungeon.cgiThat might give you some idea on how to do it..I figure I'd start with the rooms, how many rooms do I want and how big can they be? and then place them in the map. Then I would try to fill in the gaps with hallways from one room to another.Anyways I don't know if you need to create them on the fly or if you just wanted a generator.

No I want to create it on the fly, but thanks anyway.

##### Share on other sites
Quote:
Original post by The C modest god
Quote:
 Original post by Turt99http://www.aarg.net/~minam/dungeon.cgiThat might give you some idea on how to do it..I figure I'd start with the rooms, how many rooms do I want and how big can they be? and then place them in the map. Then I would try to fill in the gaps with hallways from one room to another.Anyways I don't know if you need to create them on the fly or if you just wanted a generator.

No I want to create it on the fly, but thanks anyway.

The page shown above has a link to the theory of how the dungeons are made. Using those ideas you can write a generator yourself. It's pretty easy.

##### Share on other sites

you can start with a perfect maze, just like explained in the tutorial mentioned
(this one is v.good http://www.mazeworks.com/mazegen/mazetut/)

then draw rooms over the maze... ie close all walls on the boarder and erase all walls inside, then choose randomly a cell on the room's wall to open it. no you got a room that is connected to the maze... do it again for other rooms

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634134
• Total Posts
3015743
×