I spent far too long this evening looking for noise on the web. I know, the signal-to-noise ratio of the web is often much higher on the noise than signal side of things, so it seems like looking at noise would be easy. But that's not what I mean. I'm talking about a noise algorithm, such as the Perlin noise algorithm invented by Ken Perlin, its successor simplex noise, or other viable noise functions that can serve as the basis function for fractals.
Why? Because I'm looking to replace the existing square-diamond fractal algorithm used by the Plate Tectonics simulator, in order to allow more flexibility in map dimensions. Alas, this turned out to be a bit more complicated than expected. The simulator's written in C++, so C++ or C code would be ideal. I already have such functionality in C#, but I'd have to port that to C++.
I could incorporate the Perlin noise reference implementation that's written in C (for which Professor Perlin received an Academy Award), but it is written in very old school C and could use some work to adapt to a more modern paradigm. LibNoise offers a nice implementation, but that's more dependencies than I'd like to add, and I think it might not be license-compatible. (I went back and checked. It is licensed under LGPL, so license is not a problem; still a bit leery of the dependency or adding so much additional code.)
Then there's simplex noise, also invented by Ken Perlin, but there's a patent on the using his particular flavor of the algorithm for generating a texture, which I'd worry applies to terrain as well, which is often treated as a texture. There's a great implementation C++ in battlestar-tux but it is GPL licensed and likely covered by that patent. There's a nice MIT-licensed implementation in C++ that but may be covered by the patent. There's the OpenSimplex approach, which deliberately implements simplex noise somewhat differently to avoid the patent issue, but I've only seen Java implementations, so porting would be required.
In short, everything has its pros and cons, and I need to sleep on it, make a call, put in the work, and get Plate Tectonics finished up and make it available online. My inclination at this time is to either take the partial OpenSimplex implementation and port it from Java to C++ or else update a copy of the reference implementation.
No comments:
Post a Comment