Reputation: 384
Allright, I'm working on a small game here in Java, and I am using this Simplex Noise generator I found online. The problem that I am facing, is this: I'm generating the world of my game like so:
int width = 100;
int height = 100;
world = new int[width * height];
SimplexNoise noise = new SimplexNoise();
for (int i = 0; i < world.length; i++) {
int x = i % width; // what are the coordinates from i ?
int y = i / width ;
int frequency = 15;
float h = (float) noise.noise((float) x / frequency, (float) y / frequency);
if (h >= -1 && h <= 0) {
world[x + y * width] = 0; // air tile
}
else if (h > 0 && h <= 1) {
world[x + y * width] = 1; // test tile
}
}
which quite obviously gives me 2D noise. The end result looks like this:
As far as I understand noise, 2D noise is for top-down games. The one I'm working on, is a side-scroller (like Terraria, Starbound, Crea and others), though. So I'd need a terragen to give me the topmost layer of the terrain, google tells me that is 1D noise, so here's the question: How to convert this 2D noise into a terrain-looking 1D noise?
Upvotes: 2
Views: 1476