Ocean Terrain Generator

ProcJam 2016 is over (though late submissions are always, always accepted). There are 164 entries listed at present, and one of them is mine.

The Ocean Terrain Generator is an outgrowth of one of my previous terrain-editing prototypes. The terrain and water is implemented as a stack of three layers of fluid simulations; each one can erode the layer beneath it and deposit it as sediment elsewhere. (In practice, I turned off the sand erosion for performance reasons; it wasn’t helping much.)

The sand uses the same fluid sim as the water, but with a high dampening factor. It’s not as realistic as it could be, but it works. The fluid sim itself uses a pipe-based flux grid to perform a shallow-water fluid simulation, loosely based on this paper, this presentation, and a bunch of other sources. It can, no doubt, be improved.

The production schedule was roughly: get the fluid simulation working; spend two days getting it to work on the GPU and then ripping it out again because of simulation stability issues; implement diamond square terrain generation; add erosion; make shaders and textures; add effects to visualize rain and evaporation; and finally: add flocking boid seagulls.

The initial terrain generation is pretty simple when compared to the fluid sim: just a combination of Perlin noise and the diamond square algorithm. Though that’s no reason to look down on it: finding the best settings reminded me of how many aesthetic choices go into making a good looking generator that makes sense.

One of my goals for this year was to have a polished presentation: I wanted there to be direct feedback for the underlying aspects of the simulation. Hence the rain clouds and water vapor. Each world you generate will have different settings for the rate of rainfall and evaporation. Having a visual representation of those settings makes the simulation much more accessible.

On that note, I think the most successful part of this generator is how the moving parts combine together. Because each major variable in the terrain generator can be treated as either an array of floating-point numbers or as a 2D texture, there are a lot of ways that the different systems can be plugged into each other. The connections I made only scratched the surface.

I can do a more technical write-up of the inner guts of the simulation if people are interested, but I’ve also got a ton of other people’s ProcJam projects to highlight and my NaNoGenMo novel generator to finish. November is a busy month!