Procedural world map generation - 80%

Show us your works in progress and request feedback

Post » Sun Dec 27, 2015 4:14 am

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 ;) ;) ).

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 ;)

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.
Image

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
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
14
S
2
Posts: 61
Reputation: 927

Post » Sun Dec 27, 2015 3:23 pm

Cool work. I love this stuff. I remember reading the same article along with many others when i playing around with island creation. https://dl.dropboxusercontent.com/u/159885981/islandgenV1/index.html refresh browser to recreate.
B
43
S
23
G
20
Posts: 735
Reputation: 12,027

Post » Sun Dec 27, 2015 5:19 pm

That looks awesome! How do you get it to all display at once, instead of growing like mine? I feel like its something simple but I just cant get it right.
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
14
S
2
Posts: 61
Reputation: 927

Post » Mon Dec 28, 2015 10:44 am

It's all done in various loops, so it appears to happen at once. You could do the same with yours. Put the mining code into a repeat or while condition.

I made it a long time ago and it was never finished or improved, i'm not sure where the .capx is now, and it was before tilemap support, but here are a couple of the articles you might find interesting.

https://gillesleblanc.wordpress.com/2012/10/16/creating-a-random-2d-game-world-map/

http://www.nolithius.com/game-development/world-generation-breakdown

Basically i created my own height map and set each height as a different layer of terrain, so the lowest height would be water, then sand, then land, then mountains etc.
Maybe you can do a better job. It something i'd like to revisit and have another go at eventually.
B
43
S
23
G
20
Posts: 735
Reputation: 12,027

Post » Mon Dec 28, 2015 8:02 pm

Ethan wrote:It's all done in various loops, so it appears to happen at once. You could do the same with yours. Put the mining code into a repeat or while condition.

Im using a combination of
For Each Miner
While digCount < digCountMax
Do the mining thing

I'm guessing its the the For Each thats causing the issue. But I cant think of another way to do it.
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
14
S
2
Posts: 61
Reputation: 927

Post » Tue Dec 29, 2015 3:53 pm

Can't you do,

For each miner
repete digCountMax number of times
Do the mining thing
B
43
S
23
G
20
Posts: 735
Reputation: 12,027

Post » Tue Dec 29, 2015 6:52 pm

I used to have that but I found the Repeat function never stopped. I'm back working for a few days so don't have time to fiddle. But when I'm back and have time will give it a go.

Will also try get some of the features implemented that I want
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
14
S
2
Posts: 61
Reputation: 927

Post » Mon Apr 18, 2016 1:09 pm

Just curious if you worked on this/there are updates?
B
24
S
14
G
9
Posts: 118
Reputation: 6,799

Post » Tue Apr 19, 2016 12:12 pm

This is brilliant stuff! Is there any chance you could provide a .capx? It'd be awesome to test out a game with it :)
Image
B
34
S
9
G
3
Posts: 18
Reputation: 4,434

Post » Sun Sep 04, 2016 8:50 pm

I want to follow the progress of this project.

I have studied procedural generation, I would like, if possible, receive this "capx" by email.
[email protected]

Thanks
B
97
S
41
G
28
Posts: 108
Reputation: 22,052

Next

Return to Works in Progress/Feedback Requests

Who is online

Users browsing this forum: No registered users and 9 guests