Wednesday, March 5, 2014

Continent Masks

In many cases it is desireable to be able to generate the shape of a continent or island for a game. Many methods for this exist, but few of them produce results that look similar to the quasi-randomness of real life coastlines. In this post I will introduce my favorite algorithm from DungeonLeague.com that produces very nice results.


Saturday, March 1, 2014

Midpoint Displacement Noise Generation

If you have done anything with Fractal Noise, you know that while it produces some of the best quality noise, it is insanely slow compared to its base functions. This is because it has to calculate a base array for every single octave. But then comes Midpoint Displacement Noise. It gives the same general look but at lightning speeds. Here's a benchmarch table from my machine:

  • Fractal Interp Cubic: 670 ms
  • Fractal Interp Linear: 245 ms (unacceptible quality)
  • Fractal Perlin: 125 ms
  • Fractal Lookup Simplex: 100 ms
  • Midpoint Displacement: 24 ms

It is so fast, it is on par with the non-fractal noise functions. This is the holy grail of fractal look-alikes.

Thursday, February 27, 2014

Noise Generation Multi-Threading

Multi-threading is an extremely powerful tool at a coder's disposal, but it is devilishly hard to understand and control. Before multiple cores became common on computers, multi-threading was a way for multiple programs to run "simultaneously". In reality, the programs just took turns on the processor. But with the advent of multi-core cpus, on which actual simultaneous processing is possible, multi-threading actually gives you a significant speed increase if used correctly. In this tutorial, we will look at using multi-threading to increase the speed of noise generation. This speed boost can be significant. With noise, since almost all of the calculations can be done concurrently, you will get a speed boost similar to the number of cores you have. (I get an average of for all types of noise of 1.8 times faster on my dual-core machine)

Tuesday, February 25, 2014

Advanced Voronoi Noise Generation

The method for generating Voronoi noise in Simple Voronoi Noise Generation can only be used for groups of points. But Voronoi noise works with so much more than just points. In fact, Voronoi noise generated from other shapes can lead to some really cool effects, like these ghostly rings:

Saturday, February 22, 2014

Simple Voronoi Noise Generation

Voronoi noise is a very broad type of noise. It can look like many different things that don't seem to be related to one another. It can make the image below or (with some tweaking) it can make the background image of this website. It can make a beehive, or it can be a explosion dust cloud. It can even be used for things besides just noise. As you are probably beginning to realize, it is a very powerful tool in your noise generation arsenel.



Friday, February 21, 2014

Perlin Noise Generation

Perlin noise (named for its inventor, Ken Perlin) is very similar in appearance to interpolated noise. But in the code, it couldn't be more different. It is a lot more complicated; it has gradient maps, dot products, stuff that will make your head spin. So why not use interpolated noise, if it is so much easier? Speed. Perlin noise is a pretty good amount faster than interpolated noise. So strap on your mental seatbelts, because we're in for a wild ride.

Tuesday, February 18, 2014

Fractal Noise Generation

Fractal noise (also called fractional Brownian noise or fBm) is probably the most popular method of generating noise, and with good reason. It gives very natural and beautiful looking results, while still allowing the coder to control many aspects of it's generation. Speedwise, it is pretty average, not the fastest, but by no means the slowest either.
Here is what it looks like: