Less dense forests, make map sections square, better documentation.
This commit is contained in:
parent
c0f9ebbdb8
commit
bbd3c089d9
11
mapgen.lua
11
mapgen.lua
|
@ -1,8 +1,8 @@
|
||||||
--- Procedural generation methods
|
--- Procedural generation methods
|
||||||
|
|
||||||
function init_mapgen()
|
function init_mapgen()
|
||||||
uid_seed = 1229 -- arbitrarily chosen number
|
uid_seed = 2229 -- arbitrarily chosen number
|
||||||
block_size = 128
|
block_size = 64
|
||||||
|
|
||||||
-- Sprite ratios for different biomes, of the form { "biome_name": {frequency, sprite index} ... } }
|
-- Sprite ratios for different biomes, of the form { "biome_name": {frequency, sprite index} ... } }
|
||||||
-- frequencies don't have to add up to 100, but they should by convention
|
-- frequencies don't have to add up to 100, but they should by convention
|
||||||
|
@ -15,12 +15,12 @@ function init_mapgen()
|
||||||
-- * 6 - pink flowers
|
-- * 6 - pink flowers
|
||||||
-- * 7 - mushrooms
|
-- * 7 - mushrooms
|
||||||
biomes = { grassland = { {40, 2}, {28, 5}, {28, 6}, {3, 3}, {1, 4} },
|
biomes = { grassland = { {40, 2}, {28, 5}, {28, 6}, {3, 3}, {1, 4} },
|
||||||
forest = { {40, 2}, {50, 4}, {5, 3}, {4, 5}, {1, 7} } }
|
forest = { {50, 2}, {40, 4}, {5, 3}, {4, 5}, {1, 7} } }
|
||||||
|
|
||||||
build_biome("forest")
|
build_biome("forest")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- use biome1
|
-- use biome1 if mix == false
|
||||||
function build_biome(biome1, biome2, mix)
|
function build_biome(biome1, biome2, mix)
|
||||||
if mix == true then
|
if mix == true then
|
||||||
else
|
else
|
||||||
|
@ -28,6 +28,9 @@ function build_biome(biome1, biome2, mix)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- global variable used for lookup during mapgen
|
-- global variable used for lookup during mapgen
|
||||||
|
-- build_biome() writes the biome_lookup table such
|
||||||
|
-- that biome_lookup[uid] returns a sprite index,
|
||||||
|
-- weighted by the frequency information for current biome.
|
||||||
biome_lookup = {}
|
biome_lookup = {}
|
||||||
for i=1,#frequencies do
|
for i=1,#frequencies do
|
||||||
local tuple=frequencies[i]
|
local tuple=frequencies[i]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user