Because of the Park-Miller Normal Distribution described earlier, there will only be a small amount of rooms in comparison to the number of cells, with lots of space between. We determine which of the cells in the grid are rooms - any cell with a width and height above a certain threshold is made into a room. The result is that we end up with a square grid of differently sized cells, all perfectly packed together.ĥ. We fill in any gaps with 1x1 sized cells. This technique ensures that the cells are not overlapping, yet in general remain as tightly packed together as possible.Ĥ. Next we use simple separation steering behaviour to separate out all of the rectangles so that none are overlapping. At this point we have 150 random cells in a small area, most are overlapping. In addition to this I ensure that the ratio between the width and length of each cell is not too large, we don't want perfectly square rooms but neither do we want really skinny ones, but somewhere in between.ģ. The reason for this will be explained later! This skews the size of the cells so that they are more likely to be of a small size (more smaller cells, less larger cells). Instead of using uniformly distributed random numbers (the default Math.random generator in most languages), I'm using Park-Miller Normal Distribution. Again the radius doesn't matter too much, but it should probably be proportionate to the number of cells. For each "cell" I spawn a Rectangle of random width and length within some radius. This is an arbitrary amount really, but the higher the number the larger the dungeon and in general more complexity.Ģ. First I set the number of cells I want to generate, say 150. It's pretty over-engineered, but hopefully will give anyone interested some ideas on generating dungeon layouts for their own games.ġ. So today I'm going to be a little different and talk about one technical aspect of my game TinyKeep, that is random procedural dungeon generation. Feedback Friday Screenshot Saturday Soundtrack Sunday Marketing Monday WIP Wednesday Daily Discussion Quarterly Showcase Related communities 1 For questions, get in touch with mods, we're happy to help you. Free assets OK, be sure to specify license. If you need to use screenshots, that's ok so long as is illustrates your issues.ĭo not solicit employment. Use discord, /r/indiegames, /r/playmygame or /r/gamedevscreens.īe specific about your question. Feedback, praise, WIP, screenshots, kickstarters, blogs, memes, "play my game", twitch streams.
0 Comments
Leave a Reply. |