Tuesday, March 15, 2016

java - How do I create tileable solid noise for map generation?


Hey guys, I'm trying to figure out how to generate tileable fractals in code (for game maps, but that's irrelevant) I've been trying to modify the Solid Noise plug-in shipped with GIMP (with my extremely limited understanding of how the code works) but I cant get mine to work correctly.


My modified code so far (Java)



GIMP's solid noise module that I'm basing my code off of (C)


Here is what I'm trying to achieve but This is what I'm getting


So if anybody can see what I've done wrong, or has a suggestion how I could go about doing it differently, I'd greatly appreciate it. Thanks in advance. And if I'm asking way to much or if just a huge failure at life, I apologize.



Answer



It seems as though my original pastebin expired somehow, so I have no way to compare my nonworking code, but on my current game I went through and translated the GIMP code into java again and it seems to work fine now.


If anyone plans on using this code, I'd recommend modifying the constructor to modify the setting parameters (detail and size) so you can make it work how you'd like. EDIT: I realized my original question was about making it tileable, so remember to set tilable to true!


Code: http://pastebin.com/KsfZ99Xa


Example: perlin generator example


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...