veloren_world/
config.rs

1use common::assets;
2use serde::Deserialize;
3use vek::*;
4
5pub struct Config {
6    pub sea_level: f32,
7    pub mountain_scale: f32,
8    pub snow_temp: f32,
9    pub temperate_temp: f32,
10    pub tropical_temp: f32,
11    pub desert_temp: f32,
12    pub desert_hum: f32,
13    pub forest_hum: f32,
14    pub jungle_hum: f32,
15    /// Rainfall (in meters) per m² of surface per minute.  Default is set to
16    /// make it approximately 1 m rainfall / year uniformly across the whole
17    /// land area, which is the average rainfall on Earth.
18    pub rainfall_chunk_rate: f32,
19    /// Roughness coefficient is an empirical value that controls the rate of
20    /// energy loss of water in a river.  The higher it is, the more water
21    /// slows down as it flows downhill, which consequently leads to lower
22    /// velocities and higher river area for the same flow rate.
23    ///
24    /// See https://wwwrcamnl.wr.usgs.gov/sws/fieldmethods/Indirects/nvalues/index.htm.
25    ///
26    /// The default is set to over 0.06, which is pretty high but still within a
27    /// reasonable range for rivers.  The higher this is, the quicker rivers
28    /// appear, and since we often will have high slopes we want to give
29    /// rivers as much of a chance as possible.  In the future we can set
30    /// this dynamically.
31    ///
32    /// NOTE: The values in the link are in seconds / (m^(-1/3)), but we use
33    /// them without conversion as though they are in minutes / (m^(-1/3)).
34    /// The idea here is that our clock speed has time go by at
35    /// approximately 1 minute per second, but since velocity depends on
36    /// this parameter, we want flow rates to still "look" natural at the second
37    /// level.  The way we are cheating is that we still allow the refill
38    /// rate (via rainfall) of rivers and lakes to be specified as though
39    /// minutes are *really* minutes.  This reduces the amount of water
40    /// needed to form a river of a given area by 60, but hopefully this should
41    /// not feel too unnatural since the refill rate is still below what
42    /// people should be able to perceive.
43    pub river_roughness: f32,
44    /// Maximum width of rivers, in terms of a multiple of the horizontal chunk
45    /// size.
46    ///
47    /// Currently, not known whether setting this above 1.0 will work properly.
48    /// Please use with care!
49    pub river_max_width: f32,
50    /// Minimum height at which rivers display.
51    pub river_min_height: f32,
52    /// Rough desired river width-to-depth ratio (in terms of horizontal chunk
53    /// width / m, for some reason).  Not exact.
54    pub river_width_to_depth: f32,
55    /// TODO: Move to colors.ron when blockgen can access it
56    pub ice_color: Rgb<u8>,
57}
58
59pub const CONFIG: Config = Config {
60    sea_level: 140.0,
61    mountain_scale: 2048.0,
62    // temperature
63    snow_temp: -0.8,
64    temperate_temp: -0.4,
65    tropical_temp: 0.4,
66    desert_temp: 0.8,
67    // humidity
68    desert_hum: 0.15,
69    forest_hum: 0.5,
70    jungle_hum: 0.75,
71    // water
72    rainfall_chunk_rate: 1.0 / (512.0 * 32.0 * 32.0),
73    river_roughness: 0.06125,
74    river_max_width: 2.0,
75    river_min_height: 0.25,
76    river_width_to_depth: 8.0,
77    ice_color: Rgb::new(140, 175, 255),
78};
79
80#[derive(Deserialize)]
81pub struct Features {
82    pub caverns: bool,
83    pub caves: bool,
84    pub rocks: bool,
85    pub shrubs: bool,
86    pub trees: bool,
87    pub scatter: bool,
88    pub paths: bool,
89    pub spots: bool,
90    pub site2_towns: bool,
91    pub site2_giant_trees: bool,
92    // 1.0 is the default wildlife density
93    pub wildlife_density: f32,
94    pub peak_naming: bool,
95    pub biome_naming: bool,
96    pub train_tracks: bool,
97}
98
99impl assets::Asset for Features {
100    type Loader = assets::RonLoader;
101
102    const EXTENSION: &'static str = "ron";
103}