mirror of
https://gitlab.com/gaelysam/mapgen_rivers.git
synced 2024-12-28 20:00:41 +01:00
terrain_rivers.py: mapsize
is now the number of intervals
instead of the number of nodes.
This commit is contained in:
parent
cd90a21df4
commit
cd4b517585
@ -23,7 +23,7 @@ Run the script `terrain_rivers.py` via command line. You can optionally append t
|
||||
```
|
||||
./terrain_rivers.py 1000
|
||||
```
|
||||
For a default 401x401 map, it should take between 1 and 2 minutes. It will generate 5 files directly in the mod folder, containing the map data.
|
||||
For a default 400x400 map, it should take between 1 and 2 minutes. It will generate 5 files directly in the mod folder, containing the map data.
|
||||
|
||||
## Map generation
|
||||
Just create a Minetest world with `singlenode` mapgen, enable this mod and start the world. The data files are immediately copied in the world folder so you can re-generate them afterwards, it won't affect the old worlds.
|
||||
|
@ -15,14 +15,14 @@ argc = len(sys.argv)
|
||||
if argc > 1:
|
||||
mapsize = int(sys.argv[1])
|
||||
else:
|
||||
mapsize = 401
|
||||
mapsize = 400
|
||||
|
||||
scale = (mapsize-1) / 2
|
||||
n = np.zeros((mapsize, mapsize))
|
||||
scale = mapsize / 2
|
||||
n = np.zeros((mapsize+1, mapsize+1))
|
||||
|
||||
# Set noise parameters
|
||||
params = {
|
||||
"octaves" : int(np.ceil(np.log2(mapsize-1)))+1,
|
||||
"octaves" : int(np.ceil(np.log2(mapsize)))+1,
|
||||
"persistence" : 0.5,
|
||||
"lacunarity" : 2.,
|
||||
}
|
||||
@ -32,8 +32,8 @@ xbase = np.random.randint(65536)
|
||||
ybase = np.random.randint(65536)
|
||||
|
||||
# Generate the noise
|
||||
for x in range(mapsize):
|
||||
for y in range(mapsize):
|
||||
for x in range(mapsize+1):
|
||||
for y in range(mapsize+1):
|
||||
n[x,y] = noise.snoise2(x/scale + xbase, y/scale + ybase, **params)
|
||||
|
||||
nn = n*mapsize/5 + mapsize/20
|
||||
@ -87,7 +87,7 @@ save(model.dirs, 'dirs', dtype='u1')
|
||||
save(model.rivers, 'rivers', dtype='>u4')
|
||||
|
||||
with open('size', 'w') as sfile:
|
||||
sfile.write('{:d}\n{:d}'.format(mapsize, mapsize))
|
||||
sfile.write('{:d}\n{:d}'.format(mapsize+1, mapsize+1))
|
||||
|
||||
# Display the map if matplotlib is found
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user