Commit Graph

32 Commits

Author SHA1 Message Date
Gael-de-Sailly d00295600d Add a very brief description at the head of every file 2022-01-26 11:25:17 +01:00
Gael-de-Sailly 6564d40b85 Refactor grid loading and reorganize code
Move grid management functions out of polygons.lua, in a new file called gridmanager.lua
Explicitly call other files and grid management functions from init.lua
to make workflow more apparent
Move mapgen loop out of init.lua, into mapgen.lua
2022-01-26 10:54:11 +01:00
Gael-de-Sailly cd2a77803f Globalize some of the main functions
This will allow to avoid nested 'dofile's
2022-01-21 14:22:22 +01:00
Gael-de-Sailly b0930f4d40 Fix river shape in confluences (less sharp riverbeds when a small rivers joins a big one)
Also cleaned and commented the code
2022-01-20 15:28:14 +01:00
Gael-de-Sailly 7e155b7076 Express map size in Minetest nodes, not in river grid nodes
This introduces new parameters 'map_x_size' and 'map_z_size' that default to 15K
Deprecates 'grid_x_size' and 'grid_z_size'; if they are present, corresponding
values of 'map_x_size' and 'map_z_size' are automatically written in config files.
Also rework compatibility system to better compare versions,
and bump version to 1.0.2-dev1.
2022-01-20 15:28:14 +01:00
Gael-de-Sailly 417ce1bcbc Use builtin logging system and appropriate loglevels 2022-01-03 16:33:56 +01:00
Gael-de-Sailly f8f467ac3f Use local variables for math.* functions
and remove an unnecessary index calculation
2022-01-03 11:56:16 +01:00
Gaël C f7bc5ee0b4 Added logs during pre-generation 2021-07-25 10:14:15 +02:00
Gaël C db33e58f0a Make map size a setting 2021-07-24 17:41:17 +02:00
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 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 ecd1f0e08f Added time statistics and removed debug prints 2021-06-25 21:05:14 +02:00
Gaël C a313244d07 Rename generate.lua -> pregenerate.lua 2021-06-23 19:53:56 +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 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
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 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 803114aaab Generate data in `river_data` instead of `data` 2020-11-14 19:12:12 +01:00
Gael-de-Sailly 6b9c091dd5 Fix file opening mode on the Lua side, to avoid crashes on Windows 2020-11-14 17:31:36 +01:00
Gaël de Sailly 25c5cb2e1f Reverse axes order for heightmaps (iterate in Z direction first instead of X) 2020-07-21 12:46:23 +02:00
Gael-de-Sailly 6f43430574 Added glaciers, and re-organized noise definitions 2020-05-24 12:09:21 +02:00
Gael-de-Sailly a73a0dd80b Avoid some redundant calculation on corners
(not very significant, but why not)
2020-04-27 21:08:15 +02:00
Gael-de-Sailly a9ab0e53d3 Change folder structure: data files are now in a directory.
Also added a demo 400x400 map, that is overriden on pre-processing.
2020-04-26 23:29:36 +02:00
Gaël de Sailly b429b302e1 Rewritten part of code to calculate river depth
Fixes bathymetry problems on turns or confluences, as well as abrupt riverbanks.
2020-04-26 22:19:05 +02:00
Gael-de-Sailly 206c68813e Switch again to using river direction and flux instead of table of bounds 2020-04-26 18:10:23 +02:00
Gael-de-Sailly 6af6795d90 Comment and clarify 2020-04-26 17:13:38 +02:00
Gael-de-Sailly 55725ad94b Re-organized the code. All polygon-related calculations go to polygons.lua. 2020-04-14 21:11:54 +02:00