# Tag Info

11

I don't recommend using the "increase the dimensions and orbit in a cylinder" trick here. It has several disadvantages: More expensive to compute: Perlin noise needs to select and interpolate $d^2$ gradient vectors per evaluation, so going from 2 dimensions to 5 means doing 8x more work. More distortion: by evaluating it on a membrane in higher-...

9

You will need to learn how the terms Octave, Persistence, Frequency, and Lacunarity are used. What you have is a good first step, it looks just like noise should. The basic idea is that you need to combine multiple noise sources into one result to achieve the final look. This combination can be something simple like addition, but you can take many ...

9

Other answers here suggest using a texture. Here's a technique that doesn't use textures. You want the boundaries between hexagons to be interesting. It's easier to make interesting boundaries when you move them into the center of what you're drawing. Instead of drawing the tiles directly, you draw the “dual” of the tile. This technique is called “corner ...

6

I don't entirely understand why, but I shouldn't have been doing 1-normX/Y. Instead, I looked at the question posted here and our approaches were similar enough that I could make It work. Changing from 1-x to x-1 seemed to do the trick.

6

Before Diamond-Square begins, you'll have to make sure the outermost boundaries (and the maximum number of potential midpoints generated therein) are set equal on either side of the map (in x and y). Only then can you begin full generation of the centre with something approaching a seamless wrap. What they meant by "consistent" is "all outermost corners and ...

4

Assuming you have translated this from the original Java code it looks like you have been a bit careless in adding brackets in a few places. For example the original code has: double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0; while you have: Dim t0 As Double = (0.6 - ((x0 * x0) - ((y0 * y0) - (z0 * z0)))) which if you remove the brackets is actually: Dim ...

4

The choice of formats for OpenGL ES is very limited, so you have to choose between GL_R16F and GL_R8. Both formats are available for desktop. GL_R16F is probably enough for your purposes.. or is it? Values won't be normalized and it will require you to generate data on the CPU. The reason behind CPU-only restriction is because GL_R16F is not a color-...

4

You could generate, analyse and discard random noise fields. Just generate thousands of them, and keep the ones that have a fully enclosing wall on the outside. For generation, I would use Simplex Noise. Here is my implementation in C for it. After generating a 2D field with values in range [-1,1], you pick a threshold value (let's assume 0.0) and define ...

3

I think you will get similar results if you do it like this. Start with some points in a circle around your cave area. Jitter the points by moving each one randomly from it's starting position. Trace the lines in between each point using an algorithm to generate thickness. You could do this last part by checking point-to-line-segment distance on each ...

3

If you really want the terrain to look blocky you can use value noise which is blockier than perlin noise (image source — attributed to Inigo Quilez)

3

Try using nearest neighbor scaling. Here's my reference 100x100 noise texture & the same noise texture after posterizing to 4 levels: Now here's the same noise, starting at lower 10x10 resolution. Next, scale the texture up using nearest neighbor & then posterize to 4 levels. The key here is to use the blockiness of nearest neighbor to your ...

3

Here: perlin.lerp(v, perlin.lerp(u, perlin.grad(self[AB + 2], x , y , z - 1), This should have AA + 2 instead.

2

To get noise in a shader you can: a) Just calculate the noise in the shader b) Simpler, use a (precalculated) noise texture. Just add another sampler and use it as you want.

2

The best you can do is using a texture to get the noise from, note that this is not the same as sampling a noise texture, you are just getting the random values from the texture so you can animate it as a normal noise function. This makes it really fast. If you input the same parameters you will return the same output, and the change in the input value goes ...

2

You are going outside the 0..255 range. That's why you see these color bands, since you are goint the whole range of values between 0..255 for every integer. You are multiplying by 255 twice. This has nothing to do with perlin noise.

2

That 41 is an arbitrary prime number value that happens to look good. You want to values to be perceived as repeating as little as possible coming out of the hash function. One good way to do that is to use some prime numbers (or numbers with very few common denominators) as a scaling factor so they don't often reach a common multiple or denominator. It's ...

2

Here's what you do: Take standard output from a Perlin Noise function, this should be a float in the range (0-1)1 Multiply by 5. This will range from (0-5) Round to nearest integer All those values that were slightly in between your integer values will get clamped to one or the other, resulting in squared off results If you want it to be blocky on the ...

2

Generate a cave map using an algorithm based on cellular automata. For example http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels 1.1. To make the cave fully connected you can for example do an iterative method based on (1). First generate the cave map from randomly filled area. Identify connected ...

2

I don't recommend using code like this for terrain generation, for several reasons: You don't want to be re-processing your terrain in every Update. If your terrain parameters can change on the fly, call a Regenerate() function to do this work only when such a change occurs. You don't want a separate object for every cell of your world. I know it looks ...

2

To ensure all castles 1-100 are present, simply shuffle an array containing all the numbers 1-100. You can either do this once when you first generate the map and then hold onto it, or you can use a seeded random number generator to assist with the shuffle so that you get consistent results each time. Here is an example in Python. If you're using another ...

1

You can just play with the code to get a feel for how this term affects the output. Here I've made a Shadertoy using a piece of Inigo Quilez's code with two extra parameters added to the terrain function: float terrainH( in vec2 x, int o, float e) { vec2 p = x*0.003/SC; float a = 0.0; float b = 1.0; vec2 d = vec2(0.0); for( int i=...

1

Perlin noise's gradient vectors are exactly what you describe: the vector derivative of the continuous noise function. Specifically, each gradient is the derivative of the noise function at one corner of the underlying integer grid. Perlin noise is set up so that at each integer point in its domain, it is "locally flat," like a straight line or plane with ...

1

and the server is not authoritative in this type of game Server should always be authoritative and handle all physics and interactions. Clients can run same logic on their side and then just do small corrections if they receive different state from server but server has last say what's correct. Really good article on that topic is Source Multiplayer ...

1

The best way would be to mess with the perlin layers, and the actual functions that generate the layers. But there's an easier way: Draw the squares and chunks you want, then overlay the perlin noise on top of them.

1

Using an image editor, I was able to get close as follows: layer the image on the right over the top of the image on the left reduce the opacity of the top layer to ~66% merge layers auto level resulting image I think the equivalent operation would be something like normalize((A + (0.66*B)). The contrast was a bit too sharp, so I suspect a full ...

1

It's due to you scaling the map by your map multiplier. If the difference between the min and max values is different you will scale one sector higher and one lower causing the same noise value to end up as a different actual value. Instead you should have a global scaling factor that ensures you only ever map stuff to the 0..255 range.

1

There is a bug in the final normalisation code, fortunately it’s easy to fix. You only need to change: map2[x][y] = map2[x][y] * mapMultiplier into: map2[x][y] = (map2[x][y] - mapMin) * mapMultiplier

1

I can't comment yet, but it's probably the i++ in the first line of: for (int i = 0; i < Gdx.graphics.getWidth(); i++) { float y = PerlinNoise1D(i, 5f, 3); //other stuff } Since gradient noise is smooth at small intervals and abrupt at big intervals try and scale the value. Something like: float y = PerlinNoise1D(i * 0.1, 5f, 3);

1

I didn't get the entire gist of all the functions you provided, but it seems to me that you are looking for something like a random walk or martingale algorithm, where you have an equal probability of the terrain height step to go up or down in comparison to the terrain one step ago. Doing this, your terrain remains random but essentially smooth and without ...

1

I've thought about this, that is, creating matching heightmaps using diamond-square. I don't know how well this will work, as I've never tried implementing it, but here's my theoretical postulation: For every point along an edge, if the adjacent map portion exists, make the point equal to the adjacent edge point. What it looks like right now is that you'...

Only top voted, non community-wiki answers of a minimum length are eligible