- #1
JohnLuck
- 21
- 0
First I want to mention that I am not super good at maths and that I wasn't even sure if this was the right sub forum to post in (please move this to another one if that's the case).
I am working on a 2D game in python where the player plays on an infinite map. Of course that means that the map is generated by a function such that only the "tiles" on the screen have to be calculated and in memory at any time. The function I have been using is a Perlin noise type function that I found somewhere a while back, but I am unable to figure out how to scale the distance between the troughs and valleys of the function, so the features of the map are too small and look kind of cramped. I have really tried to figure out how to "stretch" the "distance" between these troughs and valleys, but I haven't had any luck so far. This is the code from my program:
(looks a bit messy)
I am working on a 2D game in python where the player plays on an infinite map. Of course that means that the map is generated by a function such that only the "tiles" on the screen have to be calculated and in memory at any time. The function I have been using is a Perlin noise type function that I found somewhere a while back, but I am unable to figure out how to scale the distance between the troughs and valleys of the function, so the features of the map are too small and look kind of cramped. I have really tried to figure out how to "stretch" the "distance" between these troughs and valleys, but I haven't had any luck so far. This is the code from my program:
(looks a bit messy)
Code:
def noise(x, y):
n=x*331+y*337
n=(n<<13)^n
nn=(n*(n*n*41333 +53307781)+1376312589)&0x7blackf
return int(((1.0-(nn/1073741824.0))+1)/2.0)