How do I make randomly generated terrain?

0 favourites
  • 6 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • I know this title looks like something that's been asked a thousand times and is in the how-to thread but the thing is with the other posts, they're all just vague solutions that say to download a capx file, but the links to those files are all dead, and usually die after only a year or so.

    So, what I'm trying to do is make randomly generated, not infinite but kind of big, terrain for a sandbox game I'm making. Maybe with Perlin Noise, but I have no idea if Construct 2 even supports that. Whatever works is fine, this is just an important part of my game and I have not a single clue on how to even achieve it.

    Tagged:

  • Construct 2 doesn't have Perlin noise built in, but it can be implemented with events. Could be quite difficult if you're not familiar with the concept of how it works and the math behind it, but if you are it is fairly straightforward. Here is a resource I like -

    rtouti.github.io/graphics/perlin-noise-algorithm

    Construct 3 has Perlin noise built in as part of the Advanced Random plugin. Quick tip - you can use the C3 demo to generate the noise as an array and export it. I'm pretty sure it would be compatible with Construct 2. But it would be fixed, and not randomly generated at runtime in your C2 program. You could export a bunch of different ones, include them as project files, and pick one at random in C2 though...

    Also you should try asking on the threads you mentioned to see if they can fix the link. A lot of people here (especially the ones that make examples) are really long time users and might still be lurking around. Dropbox had a change a few years ago that broke all public links from before then, but its pretty easy to fix and the file is most likely still there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a example. It's not true perlin noise but it is smoothed noise.

    smoothed noise can be done as simply as filling an array with random values and using bicubic interpolation to get in between values. Here I went a step further and just used a 1d array and used a hash to pick an index from any x,y.

    Anyways, the actual terrain generation in event 6 should be much the same no matter what noise function you get. Although you probably would want to use a tilemap instead of sprites.

    dropbox.com/s/54umwiypls46s0l/noise_gen.capx

  • Here's a example. It's not true perlin noise but it is smoothed noise.

    smoothed noise can be done as simply as filling an array with random values and using bicubic interpolation to get in between values. Here I went a step further and just used a 1d array and used a hash to pick an index from any x,y.

    Anyways, the actual terrain generation in event 6 should be much the same no matter what noise function you get. Although you probably would want to use a tilemap instead of sprites.

    https://www.dropbox.com/s/54umwiypls46s0l/noise_gen.capx?dl=1

    this is pretty cool but i honestly. really don't understand like any of it, and it generates stuff in the sky when I'm trying to make just simple sandbox terrain.

    if any of you know how to do something like. spawning stuff randomly in flat terrain or something that'd help too!! like ores and stuff! i can't edit my original post so im putting it here

  • You didn't specify if you were viewing from above (2d noise) or from the side (1d noise).

    For 1d noise, you can use the same formula/function, but use a constant y value. Any number will do.

    Plug in any X, and it will give you a value between -1 and 1, with smoothing applied relative to its neighbor. Divide X by a larger number to "zoom in", which will give you smoother terrain, or smaller number to "zoom out". You could use the returned value between -1 and 1 to determine the height of your ground at any given X location, for example.

    If this is hard to understand, I recommend searching and reading more articles about procedural generation online. Here's another one - redblobgames.com/maps/terrain-from-noise

    It also describes 2d generation, but most of it still applies. Like I mentioned above, rather than have a number generated for every x/y position, you would fix the y to a constant and just use x. This would effectively give you a "slice" of the noise map, or a side view basically.

  • rex noise plugin

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