Procedural world map generation - 80%

0 favourites
  • 11 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • 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

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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

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

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

  • Can't you do,

    For each miner

    repete digCountMax number of times

    Do the mining thing

  • 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

  • Just curious if you worked on this/there are updates?

  • This is brilliant stuff! Is there any chance you could provide a .capx? It'd be awesome to test out a game with it

  • I want to follow the progress of this project.

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

    Thanks

  • Yeah, commenting so I can follow the progress of this. I've always been interested in dabbling with Procedural Animation. MANY useful links here

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)