Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411275 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 09:39:45 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsBraving Procedural Generation
Pages: 1 2 [3] 4 5 ... 23
Print
Author Topic: Braving Procedural Generation  (Read 212675 times)
Glaiel-Gamer
Guest
« Reply #40 on: June 02, 2009, 04:25:16 AM »

Isn't that method similar to doing, generate grayscale perlin noise, then any pixel over 50% gray = land and any under 50% = water?
Logged
Fifth
Level 10
*****



View Profile
« Reply #41 on: June 02, 2009, 08:13:44 AM »

Heh, Perlin noise is fun.

I'm glad this topic resurfaced, though.  I love that cave method you made, ChevyRay.  I tried re-creating it (for a platformer, which is why I made it carve out passages 3 tiles high), but I was doing so from memory and didn't quite remember how it went.  The result is a bit different, but I still like the idea behind the method.

Logged
Fifth
Level 10
*****



View Profile
« Reply #42 on: June 02, 2009, 01:15:00 PM »

Okay, I gave it a slight inclination to spin sounter-clockwise around the center.  Is it too obvious?
Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #43 on: June 02, 2009, 05:33:17 PM »

I originally tried to add crawling, but forcing taller passages is probably much easier to implement and much more fun to play.
Logged
ChevyRay
Guest
« Reply #44 on: June 02, 2009, 05:53:46 PM »

Okay, I gave it a slight inclination to spin sounter-clockwise around the center.  Is it too obvious?

What I would do is something like classifying the different formulae for each of the significantly different cave results, then randomly picking between these classifications when generating the dungeons. You can have things like "small spiral", "big spiral", "large passages", or "narrow passages", etc. etc. etc. for as much as you want. Based on how far the player is in the game, or what type of dungeon it is, you might want to exclude some of these choices, or add others in. This way, it won't be too obvious because every cave generated isn't generated in quite the same manner, and even repeated combinations of certain classifications will result in such significantly different caves that it can hardly matter.

Looking great, though, Fifth! I'm glad you like the method, as I sort of stumbled upon it accidentally. It's odd how actually "digging" the trail with a programmed mole has such neat, natural-looking results. I like that it can be manipulated quite easily to change the size of the cave, as well as make it more open/narrow, etc. If you wanted more round-ish caves, though, it's not the best solution.

I'm assuming the number at the top-right is the amount of floor tiles?

Anyhow, how long did those two caves take to generate? Is your adaptation pretty much always instant, or is there a bit of a wait?
Logged
Epitaph64
Level 1
*



View Profile WWW
« Reply #45 on: June 02, 2009, 11:18:34 PM »

Ah, I did a similar map generation algorithm for a small roguelike I was starting to work on before getting bored of it ^_^

Here's some screenshots though: http://validopinion.wordpress.com/2009/03/12/firefire-roguelike-fire-ant/

The method I showed first wasn't really like perlin noise, since it basically "spawns" water areas, and those grow at random with a recursive function, and then are smoothed over a few times to make the terrain look more worn. That is to get the balance of water and land. To get the mountainous areas, I grew higher land, and then applied a perlin-noise style smoothing over the mountains, and applied a little more noise to vary it up a bit.

Here's the screenshot of after that was applied

« Last Edit: June 02, 2009, 11:24:03 PM by Epitaph64 » Logged

Fifth
Level 10
*****



View Profile
« Reply #46 on: June 03, 2009, 07:54:11 PM »

Hmm... the advantage of basing the water off of the Perlin noise is that you'll always get the mountains sloping down to the water, and going along with the contours of the land.  Adding the noise afterward looks like it might end up troublesome...

Anyway...

What I would do is something like classifying the different formulae for each of the significantly different cave results, then randomly picking between these classifications when generating the dungeons. You can have things like "small spiral", "big spiral", "large passages", or "narrow passages", etc. etc. etc. for as much as you want. Based on how far the player is in the game, or what type of dungeon it is, you might want to exclude some of these choices, or add others in. This way, it won't be too obvious because every cave generated isn't generated in quite the same manner, and even repeated combinations of certain classifications will result in such significantly different caves that it can hardly matter.

Looking great, though, Fifth! I'm glad you like the method, as I sort of stumbled upon it accidentally. It's odd how actually "digging" the trail with a programmed mole has such neat, natural-looking results. I like that it can be manipulated quite easily to change the size of the cave, as well as make it more open/narrow, etc. If you wanted more round-ish caves, though, it's not the best solution.

I'm assuming the number at the top-right is the amount of floor tiles?

Anyhow, how long did those two caves take to generate? Is your adaptation pretty much always instant, or is there a bit of a wait?

Thanks!  I'm really having fun with this, teaching the computer to dig out caves.

The varying formulae for cave types is a pretty god idea.  It kinda makes me wish I had kept notes when toying around with things in the first place.

As it is, I managed to deal with the overt spiral-based feeling of certain maps by having the counter-clockwise "inclination" toggle to clockwise every 800 steps.  I still get some interesting meandering passages, but no longer have them all going in the same direction.

And yes, the number there is the number of floor tiles (or empty tiles, in a platforming sense) dug out.  And the process is always instantaneous.
Logged
ChevyRay
Guest
« Reply #47 on: June 03, 2009, 11:06:33 PM »

Quote
And the process is always instantaneous.
Rad, that's what I wanted to hear Smiley

Keep posting as you change up stuff. I don't want to miss out on any tricks if you stumble into any.
Logged
ChevyRay
Guest
« Reply #48 on: June 04, 2009, 07:20:55 AM »

New tutorial/experimentation is up. Smiley

This time it's creating heightmaps and applying mathematical curves to optimize them!

Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #49 on: June 04, 2009, 07:19:54 PM »

I've started playing around with my cave platformer prototype again, and after I remove the fancy graphics stuff, it generates caves instantly. The current prototype is here (WASD and mouse). I have not yet shamelessly stolen implemented Fifth's tall passages. This algorithm has a lot of potential.
Logged
ChevyRay
Guest
« Reply #50 on: June 05, 2009, 01:19:07 AM »

Smiley

I can't run that, though. Apparently I need an SDL.dll for it to operate?
Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #51 on: June 05, 2009, 05:48:32 AM »

Apparently I need an SDL.dll for it to operate?
That's a good point. It should work now.
Logged
hagel
Level 0
**



View Profile
« Reply #52 on: June 05, 2009, 07:29:00 AM »

Found this thread last week and spent the next two days experimenting with my own algorithms. If anyone wants them they're HERE. They're written in FreeBASIC but you can open the code with any texteditor. They were made to simulate a platformer cave.
Here's a picture. The numbers signify a file in the rar.

(in "rnd gen2.exe" you can use 0-9 to vary the amount of "creeps")
(also, use space to generate a new dungeon)
The red dot is where a creep has "died" and the green is where he began his life. It can be the opposite but it's not important.

EDIT: I just noticed that generator2 uses swapped colors.
EDIT2: Please excuse the language used in the code/app, I was very tired when i made them.
« Last Edit: June 05, 2009, 07:39:12 AM by hagel » Logged
ChevyRay
Guest
« Reply #53 on: June 05, 2009, 11:38:33 AM »

That ones on the left are excellent, hagel. Save for an abundance of remote areas and some artifacts along the edges, it looks really natural and smooth. The only problem seems to be that it has a bit of trouble rounding off all the edges sometimes, leaving some odd-looking square corners in several spots.

Possible for you to share your approach for 1 and 3? I'd much rather hear a summarized explanation than go digging through your source, if you're up to it.
Logged
hagel
Level 0
**



View Profile
« Reply #54 on: June 06, 2009, 01:59:06 AM »

The first one:
First I fill the map array, randomly, with 1 or 2. 1 is for the actual cavity and 2 is for the walls.
Now phase 2 will start, the actual fidgeting with the values. The loop goes through the map array
looking for my conditions. They are:
1. Look for 3/4 corners around the cell is of one value, if they are set the middle to the same value.
 For explanation(1 is the ones checked):
Code:
101
000
100
2. Look for the cell above and the cell under is the same kind, the set the middle to the same.
3. Look for the cell to the left and to the right of the cell, if they're the same, change the middle one.
4. Look for stray pixels, i.e pixels with no neighbors with the same value.
5. Look for a "grabbing shape". What I mean is the whole left side/right side + the above and under cell.
I looks like a "C" from the left. And switched for the right one.
That's it for generator1


The third one:
I know there are some choppy areas. It seems that the map is very diagonal from upper left to lower right?
Anyway. It starts off in the same way. Randomize the map array with 1 and 2.
In this one I draw a border, the border comes with the artifacts.
This generator is not as "advanced" as the other, but I noticed that I commented away some code.
1. I look for the 3/4 corners again.
2. I look for the right and left cells, and then the above and under.
That's it. This is the one I'm currently working on.
Logged
ChevyRay
Guest
« Reply #55 on: June 06, 2009, 09:26:10 AM »

Oh man, perfect. I'm gonna give that one a shot here in a bit, see how fast I can get it to run in GML. Smiley Thanks.
Logged
Epitaph64
Level 1
*



View Profile WWW
« Reply #56 on: June 07, 2009, 07:59:52 PM »

Yeah, what I might do is have the terrain disperse from the water, and grow recursively outward from the water to form mountains, etc. I think using perlin noise is probably the most aethetic way to generate terrain, but it's been done over and over again, and I was making this more for usage rather than the aesthetics.
Logged

kavs
Level 2
**


Brad Kavanagh


View Profile WWW
« Reply #57 on: June 16, 2009, 01:17:03 PM »

Found this thread last week and spent the next two days experimenting with my own algorithms. If anyone wants them they're HERE. They're written in FreeBASIC but you can open the code with any texteditor. They were made to simulate a platformer cave.
Here's a picture. The numbers signify a file in the rar.

(in "rnd gen2.exe" you can use 0-9 to vary the amount of "creeps")
(also, use space to generate a new dungeon)
The red dot is where a creep has "died" and the green is where he began his life. It can be the opposite but it's not important.

EDIT: I just noticed that generator2 uses swapped colors.
EDIT2: Please excuse the language used in the code/app, I was very tired when i made them.

I am in love with 1 and 3. <3
Logged

jojoh
Level 0
*


View Profile
« Reply #58 on: June 16, 2009, 03:32:42 PM »

I did something similar some time ago
A study of generative systems for modeling natural phenomena
Sounds fancy maybe, but is just procedural gfx. Mind you was more than a decade ago I wrote this, but still somewhat valid.

Clouds, mountains, water plants and more.

Logged
EchoP
Level 0
**


View Profile
« Reply #59 on: June 28, 2009, 11:59:36 PM »

Have been wanting to make a terrain generator for a while, so set aside a couple of hours yesterday to have a go. I am still not happy with the spread, but it is definitely a start.

Random noise:


One run through with the program:


After two runs through:


I played around with it for a while, but I have not been able to get it to form into larger land masses. I suspect this may be as the method I am using is flawed (random noise, then checking the adjacent squares to increase probability of being land). I will have another go tomorrow, using some of ChevyRay's techniques. I am using XNA.
« Last Edit: June 29, 2009, 12:03:13 AM by EchoP » Logged
Pages: 1 2 [3] 4 5 ... 23
Print
Jump to:  

Theme orange-lt created by panic