Compare commits

...

5 Commits

Author SHA1 Message Date
qwertymine3 eec02b9cb2 Add mod.conf 2017-02-18 22:10:06 +00:00
qwertymine3 105f0dadc6 Set mapgen type to singlenode automatically 2017-02-18 22:08:00 +00:00
qwertymine3 879e448227 Added more documantation to settings 2015-11-28 23:30:39 +00:00
qwertymine3 ab897492ca Removed references from vcnlib 2015-11-27 22:39:13 +00:00
qwertymine3 a56dc906bd Remove redundant documantation 2015-11-25 22:16:20 +00:00
5 changed files with 78 additions and 50 deletions

View File

@ -8,35 +8,23 @@ planetoids.layers = {}
-- 2 or 3
-- block_size
-- vector - norm 5^3 or nil
-- sector_lengths
-- vector - norm 300^3 or 2000^3
-- scale
-- integer - the sector lengths are multiplied by this, but the
-- noise produced has a lower resolution
-- biome_types
-- table of strings- random,multi-map,multi-tolerance-map,default-biome
-- biome_type_options
-- table - tolerances for heatmap
-- geometry
-- string - euclidean,manhattan,chebyshev
--
--Layer in mem
-- cache
-- table of tables
-- add_biome
-- function to add biomes to the layer
--
--
--Point in mem
-- pos
-- vector
-- biome
-- biome def table
--Returns the biome of the closest point from a table
--Must ensure that points cover the Moore environment of the sector
--[[
--TODO list
@ -222,11 +210,11 @@ local generate_points = function(sector,seed)
num = num - 1
end
--The random number generator is returned for use in adding other
--properties to the points - biomes
--properties to the points
return points , prand
end
--This is a wrapper around generate_points - this adds biomes and doesn't return the random
--This is a wrapper around generate_points - this adds the planet type and doesn't return the random
--number generator
local generate_decorated_points = function(sector,seed)
local hash = hash_pos(sector)
@ -480,7 +468,7 @@ end
--map is generated in blocks
--this allows for distance testing to reduce the number of points to test
local get_biome_map_3d_experimental = function(minp,maxp,seed,byot)
local get_planet_map = function(minp,maxp,seed,byot)
if not planetoids.perlin then
if planetoids.settings.mode == "perlin" then
init_maps(minp,maxp)
@ -538,7 +526,7 @@ local get_biome_map_3d_experimental = function(minp,maxp,seed,byot)
return map
end
planetoids.experimental_3d = get_biome_map_3d_experimental
planetoids.raw_map = get_planet_map
--This function can be used to scale any compliant 3d map generator
--This adds an extra overhead - but this is negligable
@ -613,17 +601,14 @@ end
local shared_scale_byot = {}
--This is a single function which can be called to produce a biomemap
--for any layer type
--Attempts to choose the most optimal type for a given layer
--All scale code is condtional, so is safe to add to any mapgen
--Wrapper to apply scale function if needed
planetoids.get_map_flat = function(minp,maxp,seed,byot)
local scale_byot = nil
if byot then
scale_byot = shared_scale_byot
end
local map_gen = get_biome_map_3d_experimental
local map_gen = get_planet_map
return scale_3d_map_flat(minp,maxp,seed,map_gen,byot,scale_byot)
end
@ -634,16 +619,6 @@ planetoids.configure = function()
--Default seed offset, to avoid errors layer where it is required
set.seed_offset = set.seed_offset or 0
--Number indexed table of biome names
set.biomes = {}
--Key indexed table of biomes - indexed by biome.name
set.biome_settings ={}
set.biome_number = 0
--Layer object member functions
set.get_biome_list = function(self,to_get)
return self.biomes
end
--setup random functions
local sum = 0
local point_dist = set.point_distribution
@ -706,13 +681,6 @@ planetoids.configure = function()
set.dist = planetoids.geometry[set.geometry]
set.get_dist = set.dist._3d
--variable to track wether the noise maps have been initialised
if set.biome_maps then
set.maps_init = false
else
set.maps_init = true
end
--setup layer cache to chache generated points
set.cache = setmetatable({},planetoids.meta_cache)
planetoids.cache = set.cache
@ -857,3 +825,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
vm:calc_lighting()
vm:write_to_map(data)
end)
minetest.register_on_mapgen_init(function(mgparams)
mgparams.mgname = "singlenode"
-- Avoid changing the mapgen seed
mgparams.seed = nil
mgparams.flags = mgparams.flags .. " , nolight "
minetest.set_mapgen_params(mgparams)
end)

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name=planetoids

View File

@ -1,9 +1,19 @@
planetoids.planets = {}
local p = planetoids.planets
local coal = {
--Relative frequency to other planets of this group
rarity = 30,
--The material of the outer crust of the planet
--If there is a crust_top_material - this is the material of the bottom
--Only required of there is a crust_top_material set
crust_material = "default:stone",
--The material of the top of the outer crust of the planet
--Not required
crust_top_material = nil,
--The thickness of the crust - this doesn't add to planet size
crust_thickness = 2,
--The material in the centre of the planet
--If no crust - this is the only material of the planet
filling_material = "default:stone_with_coal",
}
local lava = {
@ -50,7 +60,9 @@ local mossy_cobble = {
}
p.stone = {
--Relative frequency compared to other planet groups
rarity = 10,
--Planet definitions included in this type
coal,lava,iron,copper,diamond,mese,gravel,
mossy_cobble,
}

View File

@ -2,7 +2,10 @@ planetoids.populator = {}
local p = planetoids.populator
--basic populator tables
local red_flower = {
--The node to be placed
node = "flowers:rose",
--The relative frequency of this node being placed compared to other
--nodes populating this node
rarity = 1,
}
local blue_flower = {
@ -31,8 +34,11 @@ local long_grass = {
}
p.grass_pop = {
--Node that is populated
node = "default:dirt_with_grass",
--Chance of each node being populated
population_chance = 0.5,
--List of nodes which can populate this node
red_flower,blue_flower,yellow_flower,white_flower,
purple_flower,orange_flower,long_grass,
}

View File

@ -7,15 +7,21 @@ planetoids.settings = {
--if not a factor of 80, there may be some artifacting at the edge
--of voxel manip blocks
scale = nil,
--This sets the size of the blocks that it generates, performance
--TECHNICAL SETTING - Each voxelmanip is sub-divided into smaller
--areas for generation - this is used for a custom optimisation
--improves with size only for smaller sizes: 1^3 < small > 80^3
blocksize = {x=5,y=5,z=5},
--This is the distribution of how many points are generated in each
--sector
--The index is the number of points - these MUST be continuous
--The number value is the minimum random number required for that value
--to be chosen
--Used to choose "normal" planetoids, or "perlin" planetoids
--normal are just raw-distance - perlin uses a perlin map to add
--further shape
mode = "normal",
--Sets the relative frequency of points
--Each size of point must be included from maximum - 1
--0 is supported, but doesn't need inclusion if not used
--default is used if there is any issue finding a no. points
--^ this should never happen however - so you set to nil
point_distribution = {
default = 1,
[1] = 60,
@ -23,35 +29,56 @@ planetoids.settings = {
[3] = 40,
[4] = 40,
},
--Set the possible planet sizes
--All are equally likely
planet_size = {
minimum = 5,
maximum = 15,
--size of sector as multiple of maximum, must be > 2
--Larger values increase the distance between planetoids
--TECHNICAL SETTING - The world is divided into cubes to
--generate planetoid positions
--The size of each one is maximum * sector_scale
--Sector_scale must be > 2 for algorithmic reasons
sector_scale = 3,
},
--List of planet group tables
--See planets.lua
planet_types = {
planets.stone,planets.soft,planets.tree,planets.glass,
},
--tables to add basic surface population - e.g. for long grass
--Tables to add basic surface population - e.g. for long grass
--See populator.lua
surface_populator = {
enabled = true,
pop.grass_pop,pop.jungle_pop,pop.sand_pop,pop.stone_pop,
pop.drygrass_pop,pop.desertsand_pop,
},
--how distance from the centre of a biome is judged
--changes he shape of generated biomes
--How distance from the centre of a biome is judged
--Changes he shape of generated biomes
--"euclidean" - sphere
--"manhattan" - diamond
--"chebyshev" - cube
--"oddprod" - cross - WARNING does NOT keep liquids enclosed
geometry = "euclidean",
}
--perlin specific settings
--Override and additional settings for perlin mode
if planetoids.settings.mode == "perlin" then
--Perlin planets are smaller - this table is the MAXIMUM size now
--On average ~1/2 radius
planetoids.settings.planet_size = {
minimum = 15,
maximum = 30,
--size of sector as multiple of maximum, must be > 2
--This valus is reduced to offset the larger size of planets
--in determining distance between them
sector_scale = 2,
}
--Perlin ONLY settings below
--Perlin map settings - see RubenWardy's modding book for explination
--http://rubenwardy.com/minetest_modding_book/lua_api.html
planetoids.settings.perlin_map = {
lacunarity = 1.4,
octaves = 2,
@ -61,9 +88,15 @@ if planetoids.settings.mode == "perlin" then
seeddiff = 5349,
spread = {x=10,y=10,z=10},
}
--TECHNICAL SETTING - Minimum density for planetoids to be generated
--Setting this higher can lead to larger planetoids - but if too high
--will lead to planetoids with terrain shaped only by the geometry
planetoids.settings.threshold = 0
--Perlin planet crusts are thinner - crust_thickness is the MAXIMUM
--This value is added to each crust thickness to counter this
planetoids.settings.thickness_offset = 1
end
--This finalises the configuration - all settings must be above this
planetoids.configure()