Better Random Terrain via Midpoint Displacement

  • <img src="http://i.imgur.com/z7kv1.png" border="0">

    Rewrote it in C2. It's way better now, I think. The first one

    I made in C1 was pretty convoluted and confusing, this one is more

    straightforward.

    Just make sure if you're changing stuff, make sure that you always seed

    those first 3 values, or it'll bork.

    The HTML

    The CAPX

    UPDATE!

       -Better performance

       -Made it prettier

       -Some minor changes to the generation

    It runs much faster now, and the whole level is displayed.

    Made in the free edition, in case anyone is curious.

    Any problems, questions or comments, let me know.

  • Thanks for the example.

    Added to the How do I FAQ.

  • Thankyou so much for this example, it explains alot to me as i'm learning about arrays in C2 aswell.

    Also combined it with Kyatric map generator to get it to create random blocks, so more than one image can be used.

  • Also pretty cool :D

  • Woah. That's rather good!

  • Hmm, didn't know this was still generating interest! I'll put some optimizations in, get it going faster.

    Also, you can destroy tiles by left clicking them. Don't know why that wasn't mentioned.

  • Okay, gave it a performance boost, should run fine even with the bigger levels.

    Added some pretties such as grass and bitsolved tiling. If you wanted to,

    adding caves to this would be a piece of cake.

    If you were willing, this could be stretched into a terraria-lite in the

    browser. Browser performance might not be there yet, but it will be soon.

  • very nice! reminds the Terraria game =D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Very impressive WOW. It's amazing what people can do with Construct 2.

    You must have a good logic too to be able to design that kind of stuff.

  • Here I gave it a try and optimized code and perfs

    terrainGenerator.capx

    Didn't know this midpoint algo

  • Holy crap ! I love your map generations. Unfortunately, I keep looking at the code and command, and I feel I don't know array enough to understand the process.

    All the loops and the array.... anywhere to point me to, to understand it properly ?

    Thanks guys

  • I really like it ^^

    Ever played King Arthur's Gold? -->http://kag2d.com/en/

    Would be cool to re-create it with something like this.. I didn't know my browser could handle 5000 objects^^

  • This is so cool, though I look at the events and try to find out what's happening, and I don't really understand what's going on. So, um what's going on? I'm trying to make a random cave generator.

  • Combining this with the level editor in the FAQs would make this game perfect :*

  • Thanks very much for this. I used it to learn how to use arrays in Construct2 (they made my head hurt initially), and i've now turned it into a decent terraria lite demo.

    I've got multiple block types (gold etc), placeable ladders, placeable blocks, grass that regrows over time based on certain rules, realtime lighting, etc. I got very inspired lol. Learned so much from your code. Wasn't aware of the bit technique for tile selection, thanks again. :)

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