I’m creating a randomly generating map (more so like a dungeon, as its in a grid) and I wanted to randomize the rooms using math.random. However the generation is client side, so players won’t see the same things when their together.
I need some way to convert X and Z to a random repeatable number, that way all players see the same things. I’ve tried using Perlin Noise but no matter how much I’ve messed with settings the results are far too smooth to get any true randomness from it.
math.random works great its just not repeatable on a coordinate plane. And thus won’t reliably give back the same numbers. I’ve also tried Random.new:NextNumber and inputting the coordinates as the seed, but I got some pretty strange results.
Is there any mathematical functions or equations that I could use to do this?
I think you are on the right track with math.noise as it’s your criteria of using a set input to generate a constant output no matter how many times you call the function but there’s a lot more you can do with it.
Have you checked out weighted sums, amplitudes, frequencies, squaring, multiplying, octaves? Even putting randomness into noise?
Tried using perlin noise again and got some weird results where if the X Axis was positive, while the Z Axis was negative (or vise versa) the entire equation would just boil down to the same number.
Worst part is it only showed in-game, and not in studio. So for now I’m just detecting if that happens, and multiplying the numbers by something random like 27, and then inverting them back to positive. So far that seems to work fine, but its still strange.
I’ll keep the topic up just in case I stumble across another error (which is likely from my crude solution!)