Re: random map generation
Here's a fairly simple way to do it http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=135929&#Post135 929
This picks a predefined number of seed spots at runtime, and then "grows" them over several iterations, with random noise factored in. This method tends to produce nice landmasses.
Obviously in a real game this would use backdrop objects and a much finer resolution, this is just to illustrate the general technique.
Re: random map generation
Thanks, thats pretty close to what I am after. I will try to run through your code and make sense of it and see what I can come up with.
If anyone else has some examples or links, please send my way :P
Re: random map generation
Bigredron - in my current game, in order to make "Random" dungeon levels, I have about 100 grid patterns saved as arrays which I know work, and make playable levels. This stores the location of various building blocks for a level - e.g. corner pieces, open land and dead-ends.
Then, when a player needs a "random" dungeon creating, I just randomly select one of those 100 grids and load the building blocks as appropriate via the array.
It works an absolute treat, and it means you can even 'sway' the randomness by doing things such as 1-20 are easy levels, 21-40 are medium open spaced levels, 41-60 are hard ones, 61+ are all specific levels, etc...
It's only Pseudo-Random but still gives the illusion of randomness.
Re: random map generation
I'll run through and add comments to my example later today. Sorry I didnt do that to begin with, I had been up for like twenty six hours, so I was just trying to get it done and posted :whistle:
Re: random map generation
Quote:
Originally Posted by Asholay
Bigredron - in my current game, in order to make "Random" dungeon levels, I have about 100 grid patterns saved as arrays which I know work, and make playable levels. This stores the location of various building blocks for a level - e.g. corner pieces, open land and dead-ends.
Then, when a player needs a "random" dungeon creating, I just randomly select one of those 100 grids and load the building blocks as appropriate via the array.
It works an absolute treat, and it means you can even 'sway' the randomness by doing things such as 1-20 are easy levels, 21-40 are medium open spaced levels, 41-60 are hard ones, 61+ are all specific levels, etc...
It's only Pseudo-Random but still gives the illusion of randomness.
That's pretty cool. I'm pretty sure that's how Blizzard made Diablo as well. Because you'll notice that even though the dungeons are random, there are familiar pieces in them.
Re: random map generation
Quote:
Originally Posted by Asholay
Bigredron - in my current game, in order to make "Random" dungeon levels, I have about 100 grid patterns saved as arrays which I know work, and make playable levels. This stores the location of various building blocks for a level - e.g. corner pieces, open land and dead-ends.
Then, when a player needs a "random" dungeon creating, I just randomly select one of those 100 grids and load the building blocks as appropriate via the array.
It works an absolute treat, and it means you can even 'sway' the randomness by doing things such as 1-20 are easy levels, 21-40 are medium open spaced levels, 41-60 are hard ones, 61+ are all specific levels, etc...
It's only Pseudo-Random but still gives the illusion of randomness.
Are you saying that you had some pre-saved shapes or patterns, which you overlayed over eachother to create a random room? If so that could work I guess. I could overlap blobs of land over eachother is a random fashion to create islands and stuff - hmm good idea! Keep them coming guys
Re: random map generation
Quote:
Originally Posted by Shadoku
I'll run through and add comments to my example later today. Sorry I didnt do that to begin with, I had been up for like twenty six hours, so I was just trying to get it done and posted :whistle:
I ended up figuring it out I think. I was just too tired last night to put my mind to work but i think I got the most of it.
What you did was create random seeds and then loop through each cell to see if it was touching land and if so, randomly decide wether or not it turned into a land cell or not. Was this correct?
That was something I also thought of but failed miserably when trying to code it. The problem is I work on these things late at night when my mind just wants to sleep :D
Re: random map generation
Ron - not quite. For example, I have 100 or so arrays like this (on a much larger scale, and more complex):
1/2/2/3
4/5/5/6
4/5/6/6
7/8/8/9
1) corner piece with a downwards staircase
2) top wall of a dungeon
3) corner piece
4) left wall
5) open space
etc, etc
I have in total, 37 building blocks, and the arrays I have created, place these blocks in their set order which creates a nice dungeon level - with passageways, open caverns, etc, etc.
This way, I have one single screen, which loads a dungeon level. Then, when the player goes down a set of stairs, into a lower dungeon lever, it darkens the players torches to simulate them going down stairs, while secretly redrawing the building blocks into a new dungeon, and replacing all the game objects. Then finally, lights up the players torches, as they come down their new set of stairs, into a new dungeon. The effect is excellent.
You can also remember the 'random' seed pattern which was used as they descend into dungeons, and then replay it as the re-ascend to the surface, which adds to the realism.
Re: random map generation
@Asholay:
So, you manually set the array values to store the dungeon layouts? And just had a ton of different array sets to "build" the dungeons "randomly"? Or am I not undertanding correctly? :)
Re: random map generation
Exactly Shawn - and that's why I refer to it as Pseudo-random (because it's technically not random at all, it just appears so)
So whilest I've pre-designed and stored up a large batch of these dungeons, it appears to the players that they are random, because there are so many different configurations that could load up when they play a game.
I guess anyone you used a similar system could very easily implement a level editor into a game, by simply making an interface which lets you put the building blocks in, then just saving this into an array file using the appropriate identifiers.
Ash
Re: random map generation
Ash - So really you are just picking one of the 100 dungeon arrays?
This really defeats the purpose of what I am trying to do.
Re: random map generation
Yeah - but someone had already answered your post in the way you wanted... so I'm giving you a completely different perspective to look at things.
Re: random map generation
Im after a variety of answers. But the way Shadoku suggested is actually really good. It just needs to be optimized a lot better. Im sure you can do something similar to create dungeons aswell. I am going to attempt to make a few tutorials sometime over the next few weeks demostrating some of the ways this is all possible.
Re: random map generation
Hi bigredron. That sounds fantastic. Looking forward seeing the tutorials.
Marv