# RPG game map generator

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

## Recommended Posts

##### Share on other sites
If you haven't already, check out Dungeondweller - it's a roguelike development site that has articles on their development. There are several algorithm articles as well as a community, perhaps you could find something useful for your generator.

##### Share on other sites
Take a look at procedural textures and perlin noise.

You can use these methods with different sets of parameters to make different effects, from smooth rolling landscapes to caves and caverns. I'm sure, with a bit of ingenuity you can make something to fit your requirements.

##### Share on other sites
You could use a "puzzle piece" approach, kinda' like the PS2 .hack games. Have a set of rooms that the computer can choose from, perhaps assign random sizes to each room (for instance, have an X by Y square room where X and Y have a defined range, Hallways of X length and Y Width, etc.) and that will get you started making the rooms. Each part of your map would need a coordinate. The program would start at 0,0 (top left corner of the map) and put in a room. Then you could define random objects that are in that room (there is a X/1000 that [this object] will appear in the room). The program then randomly places doors in the room and records the present X and Y coordinates of the room. Using a loop, the program can put a room next to the one you just made at each end and expand in a kind of triangular pattern:

1 2 4
2 3 5
4 5 6

etc., setting each room so that it touches the rooms it is adjacent to and has a door with at least one of them.

Example code:

//place treasure in the room with coordinates 60, 30 to 90, 80//minx and miny are the farthest left and north coordinates (60 and 30)//maxx and maxy are the farthest right and south coordinates (90 and 80)//put all the stuff you need to generate random numbers using the time heretreasurechance=random()*100;if treasurechance>95 PlaceTreasure(minx, miny, maxx, maxy);PlaceTreasure(minx, miny, maxx, maxy){   TreasureX=random()*(maxx-minx)+minx;   TreasureY=random()*(maxy-miny)+miny;   //stuff that puts down a treasure at TreasureX,TreasureY}

Generating rooms will be harder, because you'll have to decide each type of room that you want, set up functions that create each kind of room, etc.

##### Share on other sites
Give the dungeon generator from here a shot. I've used it before and it works just wonderfully. [smile]

##### Share on other sites
Quote:
 Original post by NowSayPillowGive the dungeon generator from here a shot. I've used it before and it works just wonderfully. [smile]

I second this. I have checked out that project before and it always makes me want to make a rouge-like. :)

While it may be designed for dungeons, you could easily apply it to outside worlds where the halls are pathways and the rooms can be points of interest (camps, large rocks, water, hills, etc). You can then go through the map a second time after generating the landscape, placing vegetation randomly based on the location of the tile (wouldn't want trees on pathways... probably), surrounding area (smaller, greener vegetation could be near water while large tree clusters hang out farther away from everything), how thick you want the vegetation, etc. You probably won't need anything more advanced than that for the vegetation since, like with real life, it is quite random. Though if the details are really important, you could also implement "rules" for vegetation, such as flowers that need a lot of light will be removed if put under a large tree, then loop through the vegetation generation, placing randomly and removing appropriately to fit the rules, until desired density has been achieved.

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5

• 10
• 21
• 9
• 31
• 16
• ### Forum Statistics

• Total Topics
632618
• Total Posts
3007464

×