Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Scaling of noise function

  1. Jun 14, 2014 #1
    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)

    Code (Text):
    def noise(x, y):
        n=x*331+y*337
        n=(n<<13)^n
        nn=(n*(n*n*41333 +53307781)+1376312589)&0x7fffffff
        return int(((1.0-(nn/1073741824.0))+1)/2.0)
     
  2. jcsd
  3. Jun 15, 2014 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Scaling of noise function
  1. Probability functions (Replies: 5)

  2. Bump functions (Replies: 4)

Loading...