Hi, So I've been working on a game that uses procedural generation to procedurally generate procedural worlds. For a while, The game had some code that would find a tile for the player to spawn on by looping through whatever tiles had already spawned until it found a suitable one. But that code was written stupidly so i decided to rewrite it. In that process i set it up to always spawn the player at tile 0x0, And proceeded to try a bunch of different world seeds to find one where 0x0 is not suitable for the player to spawn. To my surprise, After trying about a 100 different seeds i wasn't able to find one. The 0x0 tile always seems to be a ground tile.
Is there any reason this should be the case? I looked over my world generation code and couldn't come up with any reason why that should be the case.
The game decides where ground tiles go via this function
Code: Select all
function generateNoise(x, y, scaleBase, scaleDetail, thresh, ratio1, ratio2, seedOffset)
scaleBase = scaleBase * noiseScale
scaleDetail = scaleDetail * noiseScale
return noise(x * scaleBase, y * scaleBase, seed + seedOffset) * ratio1 + noise(x * scaleDetail, y * scaleDetail, seed + seedOffset) * ratio2 > thresh and true or false
end
where x and y are the tiles grid coordinates, scaleBase and scaleDetail scale the two layers of noise, thresh is the threshold for it returning true, ratio1 and ratio2 are the ratios of the two noise layers and seedOffset is a value added to the base seed, Which is used as the third argument in love.math.noise.
The full world gen code is
here(github). Along with all the other code.
The code on github still does the whole finding suitable tile dance. The .love below does not.