Live data from Hacker News

Building an Infinite Procedurally-Generated World

spin.atomicobject.com

11–20 of 41 posts

Re: Building an Infinite Procedurally-Generated World

#11

How can we make realistic-looking continents? This project (and Minecraft, which looks similar, in virtue of using Perlin noise the same way) result in interesting and varied terrain for an RPG, but the terrain looks otherworldly or artificial if you zoom all the way out. The same variety that keeps the game from being boring when you're a human-sized observer makes it chaotic and noisy when you have a satellite's vi…

What goes wrong if you just use Perlin noise for a height map and pick a "sea level" threshold? That also has the advantage of giving you an interesting seabed, if you have the ability to see underwater. You'd still want various kinds of local mutation to create interesting features, though. For inspiration, you might look at how games like Angband and Crawl combine procedurally-generated overall level design with pr…

Using Perlin noise with a sea level threshold is exactly what the OP and Minecraft both do. It makes the terrain more interesting and varied than what we see in real life, but the world as a whole doesn't have big oceans or continents - just little worms and snakes of land and water twisting around each other.

I had tried to avoid this by doing Perlin noise + distance from the center of the map, which makes an approximately-circular "continent" with an okay coastline. Amit Patel's article says "we can draw the coastline any number of ways," which is true - I'm just wondering what those ways are.

Re: Building an Infinite Procedurally-Generated World

#12

How can we make realistic-looking continents? This project (and Minecraft, which looks similar, in virtue of using Perlin noise the same way) result in interesting and varied terrain for an RPG, but the terrain looks otherworldly or artificial if you zoom all the way out. The same variety that keeps the game from being boring when you're a human-sized observer makes it chaotic and noisy when you have a satellite's vi…

The last time I made a world generation algorithm for a voxel engine prototype I got reasonable results through the judicious combination of different types of noise, (specifically simplex, ridged and turbulence noise) and transforming the result using cubic hermite splines for added control, provided you are okay with generally only having one or two main continents (three and four do occur, but are much less common).

This image shows 16 possible world maps (I found it useful to just have them appear next to each other in the world so I could quickly get an overview of the consequences of tweaking parameters): http://imgur.com/dthr7O2

This is the algorithm that generated the world (written in C#). permutation is a random ordering of the numbers 0 to 255, repeated twice. HermitePoints take an x and y coordinate and a slope. Noise functions take an x and y coordinate, a number of octaves, a frequency and a permutation. Turbulence and ridged noise output results in the domain [0, 1], simplex noise in the domain [-1, 1].

  private static Chunk GenerateChunk(short chunkX, short chunkZ, int seed, byte[] permutation)
  {
      var chunk = new Chunk(chunkX, chunkZ);

      int worldMapSize = 256;
      short maxHeight = (short)Math.Min(worldMapSize >> 2, Chunk.CHUNK_HEIGHT);

      float[] worley = new float[2];

      HermiteSpline continentCurve = new HermiteSpline(new[]
      {
          new HermitePoint(0f, 0f, 0f), new HermitePoint(0.07f, 0.03f, 1f), new HermitePoint(0.12f, 0.1f, 0.7f),
          new HermitePoint(0.21f, 0.18f, 1f), new HermitePoint(0.24f, 0.2455f, 0f), new HermitePoint(0.26f, 0.26f, 1f), new HermitePoint(1f, 1f, 1f)
      });
      HermiteSpline continentMask = new HermiteSpline(new[]
      {
          new HermitePoint(0f, 0f, 0f), new HermitePoint(0.25f, 0f, 0f), new HermitePoint(0.4f, 1f, 0f), new HermitePoint(1f, 1f, 0f)
      });
      HermiteSpline plateMountainCurve = new HermiteSpline(new[]
      {
          new HermitePoint(0f, 0f, 0f), new HermitePoint(1f, 1f, 3.5f)
      });

      for (short x = 0; x 

Re: Building an Infinite Procedurally-Generated World

#13
post #7

Earlier quoted context omitted.

In infinite generation, it's tricky to meaningfully do it. If you can constrain your space, I've had good luck with Voronoi generation and using those as continental plates. A little edge randomness, and I figure out what subducts, what separates, which plates are water and which plates aren't, and so on. Couple this with an iterative erosion mechanic and you can do some neat stuff. ("Look, this is Perlin noise" made…

Voronoi polygons as plates is probably going to be the best way for me to go - rather than adding a circle, we can just add the distance from the nearest "land" polygon, and sum the noise with that. It doesn't get us interesting geology (which it sounds like you're doing brilliantly) but it will avoid the thousands of little rivers without oceans that we see with straight Perlin noise.

Oh, that was for an old project I'm not working on anymore. I'm experimenting a similar thing to create a "modern world generator" thing for a survival roguelike (a heavy tendency toward squared polys in many places, breaking up much more in suburban and rural areas).

Re: Building an Infinite Procedurally-Generated World

#14

How can we make realistic-looking continents? This project (and Minecraft, which looks similar, in virtue of using Perlin noise the same way) result in interesting and varied terrain for an RPG, but the terrain looks otherworldly or artificial if you zoom all the way out. The same variety that keeps the game from being boring when you're a human-sized observer makes it chaotic and noisy when you have a satellite's vi…

This isn't directly relevant, but a while ago (nearly 2 years, apparently ._.) I wrote a thing that generates islands based on height contour lines and heightmaps based on them...

https://dl.dropboxusercontent.com/u/1094010/island_compiled....

Re: Building an Infinite Procedurally-Generated World

#15

How can we make realistic-looking continents? This project (and Minecraft, which looks similar, in virtue of using Perlin noise the same way) result in interesting and varied terrain for an RPG, but the terrain looks otherworldly or artificial if you zoom all the way out. The same variety that keeps the game from being boring when you're a human-sized observer makes it chaotic and noisy when you have a satellite's vi…

I made a generator for non-infinite worlds(specifically, Ace of Spades 0.x, which is a 512x512x63 colored-cube space) that created "faucets" for land and water, flood filled a low-res "biome" tilemap from them, and then applied some noise and interpolation to the tilemap, plus some heightmap modification to make a river. The larger number of passes creates a very "hand-generated" result, although a careful observer will discern that the edges are all slightly rectangular. One of the major benefits of the biome approach is that I could define the average height and deviations of the heightmap, making it easy to position mountains adjacent to flat open fields.

I've never seen the Perlin approach as being sufficient for making terrain that is _realistic_, since real terrain is shaped through iterative processes, not analytic ones.

[0] Example: http://imgur.com/txVfRYV

Re: Building an Infinite Procedurally-Generated World

#16
Perlin Noise is a cheap way to get repeatable and smooth randomness but should just be one tool in a world generation toolbox. I think most infinite worlds quite quickly collapse in 'interestingness' because after travelling for a short while in any direction you quickly see that there is nothing new out there.

So, instead of creating infinite worlds I'd like to see a lot more focus on procedurally-generating very interesting finite worlds. For games with a simple 2d tile-based grid, we then don't have to limit ourselves to just crafting noise-based functions -- as we can create the entire world at once. Games like Dwarf Fortress, Spelunky, Nethack, Terraria, etc., all follow this approach, and I'm trying to do the same in my own game, Moonman. So get our your IDEs and start creating house, face, forest, creature, item, and cloud generators. :)

Re: Building an Infinite Procedurally-Generated World

#18
post #17

Really wish people using Oryx sprites would credit Oryx. And the ultimately irony is when people claim that the sprites are ripping off Realm Of The Mad God, which of course, itself, was initially based on... Oryx sprites.

Unintentional, that's what happens when you write a toy not intending to publish it. Article has been updated with credit.

Re: Building an Infinite Procedurally-Generated World

#19

How can we make realistic-looking continents? This project (and Minecraft, which looks similar, in virtue of using Perlin noise the same way) result in interesting and varied terrain for an RPG, but the terrain looks otherworldly or artificial if you zoom all the way out. The same variety that keeps the game from being boring when you're a human-sized observer makes it chaotic and noisy when you have a satellite's vi…

The last time I made a world generation algorithm for a voxel engine prototype I got reasonable results through the judicious combination of different types of noise, (specifically simplex, ridged and turbulence noise) and transforming the result using cubic hermite splines for added control, provided you are okay with generally only having one or two main continents (three and four do occur, but are much less common…

The downside of Simplex noise is that anything greater than 2D is patented: http://en.wikipedia.org/wiki/Simplex_noise There is another project called OpenSimplex that has similar results.

Re: Building an Infinite Procedurally-Generated World

#20

Earlier quoted context omitted.

What goes wrong if you just use Perlin noise for a height map and pick a "sea level" threshold? That also has the advantage of giving you an interesting seabed, if you have the ability to see underwater. You'd still want various kinds of local mutation to create interesting features, though. For inspiration, you might look at how games like Angband and Crawl combine procedurally-generated overall level design with pr…

Using Perlin noise with a sea level threshold is exactly what the OP and Minecraft both do. It makes the terrain more interesting and varied than what we see in real life, but the world as a whole doesn't have big oceans or continents - just little worms and snakes of land and water twisting around each other. I had tried to avoid this by doing Perlin noise + distance from the center of the map, which makes an approx…

Sorry about that. What I meant by "any number of ways" is that the way I generate elevations works on any shape of coastline. In the demo, the default is to generate the coastline the way you describe — Perlin noise minus distance from the center of the map. I also have a "Radial" option that draws a bunch of sine waves in polar coordinates, and a "Blob" option that draws my blob logo. It would work just as well if you hand-draw it or use a pizza box or scatter macaroni. I should probably add an explanation to the article.
Post reply on HN