wip
This commit is contained in:
parent
cedb02e77e
commit
b9573deb75
5 changed files with 198 additions and 0 deletions
24
map.py
Normal file
24
map.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import noise
|
||||
|
||||
|
||||
def generate_map(width, height):
|
||||
scale = 20.0
|
||||
octaves = 3
|
||||
persistence = 0.5
|
||||
lacunarity = 2.0
|
||||
map_data = []
|
||||
for i in range(width):
|
||||
column = []
|
||||
for j in range(height):
|
||||
noise_value = 0
|
||||
frequency = 1.0
|
||||
amplitude = 1.0
|
||||
for k in range(octaves):
|
||||
noise_value += amplitude * noise.snoise2(
|
||||
i / scale * frequency, j / scale * frequency
|
||||
)
|
||||
frequency *= lacunarity
|
||||
amplitude *= persistence
|
||||
column.append(noise_value)
|
||||
map_data.append(column)
|
||||
return map_data
|
||||
Loading…
Add table
Add a link
Reference in a new issue