Commit Graph

145 Commits

Author SHA1 Message Date
Gaël C 9386ef51f1 Changed the way river width is determined in settings
- min_catchment now in square nodes instead of cells
- River widening power as input instead of calculating it from max_catchment
2021-07-24 13:18:58 +02:00
Gaël C 8ce20816e1 Some changes in default settings
- blocksize = 15 by default
- base noise is eased
- added tectonic compensation radius in settings
2021-07-24 10:23:06 +02:00
Gaël C 32bc9561b6 Made interactive loading optional but enabled by default 2021-06-26 16:02:00 +02:00
Gaël C 7e39189368 Load data on request instead of loading everything at first.
Data is cached in memory in case it is reused.
Offset values have a callback that converts them to the range ±0.5
2021-06-26 13:17:09 +02:00
Gaël C 636773487a Optimized load.lua by avoiding multi-argument packing 2021-06-26 11:49:26 +02:00
Gaël C 9cda649c93 Fixed time statistics 2021-06-26 11:26:45 +02:00
Gaël C ecd1f0e08f Added time statistics and removed debug prints 2021-06-25 21:05:14 +02:00
Gaël C 5898354dbe Changed some default parameters
Map centered by default
Base noise higher and less wide horizontally
2021-06-25 21:05:03 +02:00
Gaël C e14bc5216c Removed useless and deprecated files 2021-06-23 19:56:37 +02:00
Gaël C a313244d07 Rename generate.lua -> pregenerate.lua 2021-06-23 19:53:56 +02:00
Gaël C 0de2f746cf Update settingtypes.txt 2021-06-06 17:17:28 +02:00
Gaël C de8d685471 New settings system, use a conf file instead of datastorage
Added many missing settings, including pregeneration-related ones
TODO: update settingtypes.txt
2021-06-06 13:25:43 +02:00
Gaël C 51f3a2719d Generate and load map after mod loading
This has needed to globalize map tables
2021-06-05 11:24:28 +02:00
Gaël C b02387944d Pre-generation: reverse X and Y directions everywhere
to make directions compatible with the mapgen code
2021-06-04 18:24:06 +02:00
Gaël C 74733549df Various bugfixes and workarounds
Now working in pure Lua!
Some parts of the code are very hacky (e.g. noise) and the way new and old codes have been glued together is sometimes to be rewritten.
But at least it works.
2021-06-03 23:30:04 +02:00
Gaël C cb297af047 Add all code for generating a grid on world creation.
Not tested ; will likely need much testing and bugfix.
2021-06-03 20:08:57 +02:00
Gaël C 19efeaaff6 Globalize modpath and worldpath 2021-06-03 20:04:08 +02:00
Gaël C 0427b42d17 Removed Python terrainlib 2021-06-02 18:56:46 +02:00
Gaël C 7495d8a690 Added grid twisting (twist.lua)
Equivalent of Python terrainlib's 'bounds.py'
2021-06-02 18:42:40 +02:00
Gaël C c99b8338e0 Lua Terrainlib: added first Lua files for erosion and flow routing
Tested, but not linked with the mod, yet.
2021-06-01 19:07:09 +02:00
Gael-de-Sailly c175f2bbf7 Document conf files 2020-12-24 14:48:17 +01:00
Gael-de-Sailly ca68738ba7 Reworked parameters, and rename 'terrain.conf' to 'terrain_default.conf' 2020-12-24 14:48:17 +01:00
Gael-de-Sailly 85e545d5ac Fixed sea level variations 2020-12-24 14:48:17 +01:00
Gael-de-Sailly e0aecdc3f3 Added a second method for local flow calculation. It is possible to switch between them using the 'flow_method' parameter. 2020-12-24 14:48:17 +01:00
Gael-de-Sailly 83728cc932 Fixed lakes elevation
There were sometimes missing water patches near a lake's edge, when the neighbour catchment area was lower.
This commit allows to divide a cell into several mini-catchment basins, to fill only a part of it with water.
2020-12-24 14:48:17 +01:00
Gael-de-Sailly 9ffa150263 Added function 'noisemap' to generate a noise map with a quite unified parameter set, and an option for logarithmic noise. For future use. 2020-12-24 14:48:17 +01:00
Gael-de-Sailly 2a9335332b Added optional sea level variations for the simulation.
This results in more varied coastline morphologies.
2020-12-24 14:48:17 +01:00
Gael-de-Sailly 9b4a9b2516 Rework default erosion parameters,
Fix ignored values of K and m,
and changed processes order.
2020-12-24 14:48:17 +01:00
Gael-de-Sailly 7529291ab4 For bounds.py (calculation of offsets), use the same data type as rivers 2020-12-24 14:48:17 +01:00
Gael-de-Sailly b4f97bec61 For noise map seed: don't go over ±4096, to prevent rounding errors on coordinates (because noise library uses 32-bit floats) 2020-12-24 14:48:17 +01:00
Gael-de-Sailly 3dc874a494 Added description of the algorithm + acknowledge the authors of the paper. 2020-12-24 14:48:17 +01:00
Gael-de-Sailly f0dddee33c Lakes map: keep initial height (reduces file size)
Lake height is calculated for every basin, and there is a lake if lake height is higher than ground height. If it is lower, there is no lake.
In that case, it was previously raised to ground level, but since this can be done in Lua, we can write initial lakes height in the files.
This has the advantage of reducing file size, since there are bigger areas of equal values, that are more efficiently compressed.
2020-12-24 14:48:17 +01:00
Gael-de-Sailly ecd2c7d3f9 Completely change flow routing algorithm,
use a local flow calculation, determine depressions, and link them using a minimum spanning tree (Boruvka's algorithm).
This is based on a paper by Cordonnier et al, 2019.
2020-12-24 14:48:17 +01:00
Gael-de-Sailly 40098d6be3 Use standard int instead of uint8, int32, etc.
Much faster with NumPy.
2020-12-24 14:48:17 +01:00
Gael-de-Sailly faef1658a9 Fixed map centering, and converted polygon coordinates to map nodes instead of grid nodes. 2020-12-22 16:38:30 +01:00
Gael-de-Sailly d5cf4a6267 Optionally center the map around x=0 z=0 2020-12-20 22:28:54 +01:00
Gael-de-Sailly 53f88d337d Protect map preview from exceptions
Since map preview is optional, an exception should not propagate to terrain calculation, so print an error message + traceback but keep the script running.
2020-11-25 13:12:24 +01:00
Gael-de-Sailly 3644965842 Fix bool settings being improperly loaded as strings 2020-11-17 20:56:02 +01:00
Gael-de-Sailly 9725979363 Fix increments for argument parsing 2020-11-17 20:45:11 +01:00
Gael-de-Sailly ebacd3cdd4 Add license, update/improve documentation 2020-11-15 11:43:30 +01:00
Gael-de-Sailly fc0a158385 Disable glaciers by default 2020-11-15 11:26:50 +01:00
Gael-de-Sailly 050ca3b779 Change demo data, update to a grid using new default parameters 2020-11-15 11:19:28 +01:00
Gael-de-Sailly 1f41423104 Print a clear message when grid is ready
Also use plt.pause before plotting, ensuring plot is updated in real time
2020-11-15 11:13:42 +01:00
Gael-de-Sailly 52766e8918 Added settingtypes 2020-11-15 11:10:19 +01:00
Gael-de-Sailly 28c674d57c Decrease default diffusion factor 2020-11-14 19:14:09 +01:00
Gael-de-Sailly 90f60ea6fb typo 2020-11-14 19:13:58 +01:00
Gael-de-Sailly 803114aaab Generate data in `river_data` instead of `data` 2020-11-14 19:12:12 +01:00
Gael-de-Sailly 9594a79f8b Configurable output directory
Now relative to the directory the script is *run in*.
2020-11-14 18:26:13 +01:00
Gael-de-Sailly d93234c9b7 Moved Python files inside a folder (package), except the 2 that are directly executable 2020-11-14 17:35:27 +01:00
Gael-de-Sailly 7acd0af550 Use biomegen.generate_all 2020-11-14 17:35:03 +01:00