Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411469 Posts in 69368 Topics- by 58422 Members - Latest Member: daffodil_dev

April 23, 2024, 05:12:08 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsBraving Procedural Generation
Pages: 1 ... 3 4 [5] 6 7 ... 23
Print
Author Topic: Braving Procedural Generation  (Read 213399 times)
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #80 on: July 30, 2009, 01:46:37 AM »

Alright, I've finished cleaning up and properly commenting the source files for the ActionScript version of my Cave Generator algorithm.

Here's another shot of a cave created with the same algorithm, just different settings:



And here's the source files!

http://properundead.com/flash/caveas3.zip

It has the SWF, and two actionscript files, Main.as and Map.as. These can be opened with notepad or Notepad++, or whatever you want if you don't have Flash, Flex or FlashDevelop. The algorithm and the rest of the cave-gen functions are in the Map class. I commented it pretty thorougly, but if you don't understand it, I might be able to answer some questions Smiley


EDIT:

I've also written a new article on the site.

Latest Procedural Generation Article

It sums up everything that's been shown off here so far Smiley.

seems like you got a bug, if you press enter few times, after a while the sample freezes, i think there's something on the map generation that makes it go in an infinite loop or something, unluckly even if i took a look at the code i wasn't able to debug it, as flex builder doesn't work well on vista 64 :\

anyway try to press enter (even slowly) for a min an soon or after the sample will freeze
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
cyprien
Guest
« Reply #81 on: July 30, 2009, 08:03:35 AM »

Alright, I've finished cleaning up and properly commenting the source files for the ActionScript version of my Cave Generator algorithm.

Here's another shot of a cave created with the same algorithm, just different settings:



And here's the source files!

http://properundead.com/flash/caveas3.zip

It has the SWF, and two actionscript files, Main.as and Map.as. These can be opened with notepad or Notepad++, or whatever you want if you don't have Flash, Flex or FlashDevelop. The algorithm and the rest of the cave-gen functions are in the Map class. I commented it pretty thorougly, but if you don't understand it, I might be able to answer some questions Smiley


EDIT:

I've also written a new article on the site.

Latest Procedural Generation Article

It sums up everything that's been shown off here so far Smiley.

There wouldn't happen to be a way to use this to generate a cave of my liking and then export that cave pattern into an array for use elsewhere would there?
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #82 on: July 30, 2009, 08:16:50 AM »

sure there is, instead of drawing a pixel at x,y you need to set a value on an array[y]
  • .
You don't need to export anything, you can generate the map directly on the array and then renderize it using tiles for example
« Last Edit: July 31, 2009, 01:20:50 AM by Eclipse » Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
Triplefox
Level 9
****



View Profile WWW
« Reply #83 on: July 30, 2009, 05:25:09 PM »

I did this years ago and then abandoned it:
http://openexplore.sourceforge.net/

It has a massively complicated terrain generation algorithm, and as I recall it became hard to distinguish the parts that actually did something useful from the parts that didn't.
Logged

cyprien
Guest
« Reply #84 on: July 30, 2009, 05:46:53 PM »

sure there is, instead of drawing a pixel at x,y you need to set a value on an array[y]
  • .
You don't need to export anything, you can generate the map directly on the array and then renderize it using tiles for example

I have no idea what you said there, I'm still really new to this stuff. Just learning how to build stuff using arrays.
Logged
Kadoba
Level 3
***



View Profile
« Reply #85 on: July 30, 2009, 08:41:00 PM »

He's saying instead of drawing to pixels you simply make your code store the information inside of an array.

so instead of:

Code:
for x in map
   for y in map
      draw_pixel(x,y);

you'd do something like:

Code:
for x in map
   for y in map
       array[x][y] = true;
Logged
hagel
Level 0
**



View Profile
« Reply #86 on: July 31, 2009, 01:04:19 AM »

I remember having problems with 2D arrays in python. I think they don't have them.

Also, thanks to Chevy for putting our stuff on your site, pretty awesome article.
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #87 on: July 31, 2009, 01:22:09 AM »

He's saying instead of drawing to pixels you simply make your code store the information inside of an array.

so instead of:

Code:
for x in map
   for y in map
      draw_pixel(x,y);

you'd do something like:

Code:
for x in map
   for y in map
       array[x][y] = true;

exactly Wink
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
ChevyRay
Guest
« Reply #88 on: July 31, 2009, 02:56:14 AM »

I remember having problems with 2D arrays in python. I think they don't have them.

Also, thanks to Chevy for putting our stuff on your site, pretty awesome article.
You can do a 2D array with any 1D array easily. The size is more limited, though than, say, having an array for each row etc. It looks like this, anyhow:

array[x + (y * width)]

Where width is how many columns the table has. You can test that equation against this table, even:

012
345
678

The width of the table is 3, and the top-left cell is (0, 0). So, for example, position (1, 2) would be 1 + 2 * 3 = 7.
Logged
Epitaph64
Level 1
*



View Profile WWW
« Reply #89 on: August 08, 2009, 09:42:12 AM »

This reminds me of a random map generator I made awhile back for a roguelike I never finished:

Logged

Kneecaps
Level 3
***



View Profile
« Reply #90 on: August 12, 2009, 07:16:21 PM »

Here's another terrain generation thingy I made, with ideas stolen (and poorly implemented Tongue) from the Dwarf Fortress interview at Gamasutra.  Maybe it can turn into a Zelda-like someday?



The first square is a height map, second is a temperature map, third is the actual map, fourth is rainfall, fifth is drainage, and the sixth is an imperfect maze (intentional).

Try it out here.

Click to regenerate.  Oh yeah, and the purple is marshes.  There were too many greens. :/
Logged
Afinostux
Level 2
**

Forgotten Beats


View Profile
« Reply #91 on: August 31, 2009, 06:31:37 PM »

I thought I should mention, I'm using a modified version of this concept for the world generation on my pyweek entry.

The idea was to make a version that would design a metroidvania world. Here's a screenshot:


Two things I changed:
instead of using a binary value for every square, each square has an 8-bit number to store connectivity, so two squares can be adjacent without being connected.

Also, I added some controls for making the behavior of the 'turtle' change over time. This one uses the rule that it starts with a high probability to turn and no probability to split, and ends with no probability to turn and a moderate probability to split. I'll post the source with my pygame entry when its done.
Logged

nicknicknicknick
Level 0
***


idkfa


View Profile WWW
« Reply #92 on: October 03, 2009, 06:59:06 PM »

Well, I'll join the party. Apologies for self-promoting on my first post Addicted

I ripped off was inspired by Chevy's blog from a while back, and used the repeated subdivision terrain generation algorithm to make a wee little game of my own: NIGHTMARE in the Overbourn Marshes.

[edit]Oh yeah, and read the README.txt before you do anything Wink [/edit]





The algorithm worked fantastically, and I'm rather happy with the result. As it stands though, the actual terrain generated has fairly little influence on the dynamics of the game itself. Next step---one which I think is important for PG in general---will be working that into a proper game mechanic.
« Last Edit: October 04, 2009, 05:25:43 PM by newton64 » Logged

8-Bit Personality, 16-Bit Looks
http://nicknicknicknick.net
hackedhead
Level 0
**


View Profile
« Reply #93 on: October 04, 2009, 05:14:44 PM »

Overbourn is really cool. I'm liking where this could go. I like that the art is pretty much all 'representative' a-la nethack and yet, on a higher level the colors and shades really give the feeling of the marsh.

Kudos for running on Linux too.
Logged
nicknicknicknick
Level 0
***


idkfa


View Profile WWW
« Reply #94 on: October 04, 2009, 05:31:10 PM »

Glad you enjoyed Smiley

It really was just a short little bit of nonsense to see what I could do with Chevy's algorithm.

As you say, there's a lot more potential for procedural generation. I believe it was best said here...which is actually the blog post which brought me to this thread in the first place. How ironic.
Logged

8-Bit Personality, 16-Bit Looks
http://nicknicknicknick.net
ChevyRay
Guest
« Reply #95 on: October 04, 2009, 06:40:17 PM »

I believe it was best said here...which is actually the blog post which brought me to this thread in the first place. How ironic.

Interesting article.

Quote
For the first time, I'm starting to think that they're barking up the wrong tree. The space that they should be focused on generating is the space of obstacles, the topology of which is tied inextricably to the mechanics of the obstacles themselves.

 Huh? Yo man, we're not focusing on anything yet, nor should we be. The whole topic is supposed to just be an introduction to what procedural generation is, and some simple examples of what it means and how it can be applied. Not applying it to games' design in advanced and innovative ways. You can find THAT crap all over the internet, what you CAN'T find is something that spells it out in a language that most people can understand and eases you into it using something simple and understandable: maps.

This isn't an "official" Procedural Generation thread anyways. It's just a low-key topic I started so people can figure out what the heck this PG stuff is that all the bigwigs are talking about these days.

That's a good blog post, though Smiley I enjoyed reading it.
« Last Edit: October 04, 2009, 06:43:53 PM by ChevyRay » Logged
nicknicknicknick
Level 0
***


idkfa


View Profile WWW
« Reply #96 on: October 05, 2009, 03:42:18 AM »

^^ If nothing else, I think the blog post should be taken more as a suggestion of possible places to take PG. And I'm inclined to agree, given my experience with Overbourn and how next time, I'd like to make PG more of a gameplay mechanic rather than (really cool) window dressing.

Oh, and allow me to say it officially: thanks for the algorithms, Chevy. Smiley
Logged

8-Bit Personality, 16-Bit Looks
http://nicknicknicknick.net
ChevyRay
Guest
« Reply #97 on: October 05, 2009, 05:09:47 AM »

Your welcome.

Quote
If nothing else, I think the blog post should be taken more as a suggestion of possible places to take PG.

For surely. Actually, on that point, I think we should have an official topic in Technical or something to discuss that in particular. There probably was one or two back in the day, but I see no active topic nowadays, yet this is one of the most popular topics in the Tutorials forums.
Logged
nicknicknicknick
Level 0
***


idkfa


View Profile WWW
« Reply #98 on: October 05, 2009, 06:36:55 AM »

I found an older thread from May that seems to have potential. I suppose we can continue that discussion, and keep the nuts-and-bolts algorithms for this thread and the Technical forum...
Logged

8-Bit Personality, 16-Bit Looks
http://nicknicknicknick.net
Sam
Level 3
***



View Profile WWW
« Reply #99 on: October 06, 2009, 05:47:33 AM »

Threads I've found:

This one.  Which I see as being about algorithms for generating levels.  Primarily open landscape maps (mainly based on heightmaps) and cave maps.  Although there are mentions of other procedural generation possibilities (stories/histories like Dwarf Fortress'.)

One in the Design forum that newton64 just linked.  That's focused around an attempt by Mephs to prototype a game that procedurally generates objectives as well as general content (I think.)  Plenty of interesting talk about combining mechanics to get fun results, and the danger that too many random elements poses on difficulty.

Again in the Design forum.  This is concentrated on generating levels/maps, but also discusses the "tinker toy" approach, of slotting together pre-made parts (much like how Spelunky generates its levels.)  Sadly the thread stops just when 'full-on' procedural generation of platformer levels is brought up.

Then of course there's all of the PCG Compo.

--
On the issue of generating obstacles rather than generating pretty levels, I have something to contribute!  I'm working on generating the layout of a game world with basic lock-and-key obstacles.  You can read words, and watch a simple level being generated here.

My aim currently is to keep it as abstract as possible, so the key could be replaced by "ability to morph into a little ball" and the locked door with "a tunnel too small to walk down."  And suddenly it's generating the layout for a Metroid game.
Logged
Pages: 1 ... 3 4 [5] 6 7 ... 23
Print
Jump to:  

Theme orange-lt created by panic