Hi Everyone!
Recently I had an idea to work on a top down, survival game. It was something to test myself and try things I hadn't done before.
One of those things was procedural generation.
The vision in my head was to generate a random island, using a 3D array. The x,y coords of the array are the x,y coords of the physical game tiles and the z axis is the game data; tile type, object type, mob etc etc.
After a bit of reading I came across the following article:
http://noelberry.ca/2011/04/procedural- ... -the-caves
Which focuses on caves.
However a side on cave is really just the same as a top down island (If you use some imagination <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> ).
TL:DR of that article is it uses a Miner algorithm to generate the land.
1: Set everything to wall
2: Spawn some miners at the center
For each miner
3: Pick a random direction
4: If solid move there
5: Set location to clear
6: If completely surround, delete miner
Which on the surface seemed simple. Two days later proved it was not!
HOWEVER! I am happy to say I managed to implement the algorithm(or 90%, see below), and a demo of it can be found here: http://373737.co.nf/WorldGenerator/index.html
Also view my other games on the home page <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">
Here are some examples of different generations. As you can see some are more Cave like and others more island like, all depends on the parameters set by the user.
Things still to do:
1: Implement a Clean Up system (removes 1x1, 2x1, 3x1 and 2x2)
2: Add edge support (if near edge turn a different way)
Then if I want to expand into my survival kind of game idea I need a way to generate multiple tile types. Implement a shoreline (sand tile) system. And then obviously actual game mechanics buts thats a whole other thing.
Anyway, let me know your thoughts on it so far, and if anyone wants a CapX or even a tutorial please let me know!
Will keep everyone updated with my progress.
thanks!
Keeghan