Commit Graph

45 Commits

Author SHA1 Message Date
Gaël C 6017510df0 Re-implement minetest.get_spawn_level 2024-02-11 08:40:48 +01:00
Gaël C 146f009684 Re-organize grid management code for less dependance between files
Remove gridio.lua and move its function to appropriate files
2024-02-01 19:30:07 +01:00
Gaël C 2cf3b19167 Generate grid directly in pregenerate.lua, not in a function 2024-01-31 11:32:24 +01:00
Gaël C 4697f9c948 Remove "full" grid loading method
I see no reason to let the choice between a greedy and a lighter loading method, so better remove it to simplify the code.
2024-01-31 10:47:37 +01:00
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 b374e8ee95 Create settings_default.json to store default values for settings
Move noise parameters to settings.lua
2022-01-18 15:21:14 +01:00
Gaël C 1ad8c96b8c Remove 'default' hard dependency 2022-01-17 23:20:34 +01:00
Gael-de-Sailly 417ce1bcbc Use builtin logging system and appropriate loglevels 2022-01-03 16:33:56 +01:00
Gael-de-Sailly 0c98fc0881 Skip chunks that are fully higher than ground level 2022-01-03 16:18:48 +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
Gael-de-Sailly 27670addb3 Switch to singlenode mapgen if not done 2021-09-07 11:59:33 +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 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 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 19efeaaff6 Globalize modpath and worldpath 2021-06-03 20:04:08 +02:00
Gael-de-Sailly 90f60ea6fb typo 2020-11-14 19:13:58 +01:00
Gael-de-Sailly 7acd0af550 Use biomegen.generate_all 2020-11-14 17:35:03 +01:00
Gael-de-Sailly 3792cd5dc8 Added support for biomegen mod 2020-11-14 17:35:03 +01:00
Gael-de-Sailly 9475b49b8d Removed duplicate calls to 2 scripts 2020-11-10 13:18:02 +01:00
Gaël de Sailly 103cd49d78 Optionally disable distorsion
by setting 'mapgen_rivers_distort = false' in minetest.conf
2020-07-21 14:01:29 +02: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 625768f967 Added snow and ice in function of temperature.
Uses noise parameters of builtin biomegen
2020-05-23 18:13:00 +02:00
Gael-de-Sailly 4edd1a946e Horizontal shifting according to 3D noises:
makes slopes more irregular and natural-looking, allows overhanging.
This is done by generating an intermediate 2D elevation map and, for each node in 3D, add a 2D offset vector to the position, and seek this position on the heightmap.
2020-05-23 15:52:16 +02:00
Gael-de-Sailly f56857e804 Fix water not being set at lower chunk borders 2020-05-08 10:02:04 +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
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 6af6795d90 Comment and clarify 2020-04-26 17:13:38 +02:00
Gael-de-Sailly 9700e948b9 Position should be strictly beyond river threshold to be a river
Prevents some wrongly placed water pixels.
2020-04-14 21:54:05 +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
Gael-de-Sailly 43211fc31b Removed useless functions get_point_location and geometry.area 2020-04-14 20:26:15 +02:00
Gael-de-Sailly 14163681cc Use settings from minetest.conf 2020-04-14 18:40:51 +02:00
Gael-de-Sailly af7a7ce26d Compress data files (reduces size by a factor 3-4) 2020-04-13 15:59:34 +02:00
Gael-de-Sailly da98a538bb Draw outer corners of river turns. 2020-04-13 15:01:54 +02:00
Gael-de-Sailly 1adb4fbece Added an offset of 0.5 on terrain elevation
This prevents rounding errors and improves interpolation on nearly flat areas
2020-04-13 12:27:24 +02:00
Gael-de-Sailly 13d3e70b66 Implemented variable river width.
Also changed the river data exported by terrain_rivers.py. They will not be compatible with what's generated by older versions.
2020-04-13 12:15:10 +02:00
Gael-de-Sailly 4b63ed371e Add more information in the polygon table 2020-04-13 10:31:38 +02:00
Gael-de-Sailly eba90803fe Removed useless debug print 2020-04-13 10:01:23 +02:00
Gael-de-Sailly 34de4269ee Add directly a reference to the polygon table in the polygon list, instead of adding an index 2020-04-13 09:54:04 +02:00
Gael-de-Sailly 56cebecb13 More robust and faster code for grid twisting on the Lua side.
At chunkgen init, build a list of the polygons instead of calculating them for every node.
2020-04-13 09:27:41 +02:00
Gael-de-Sailly b7c6f71635 Implemented grid twisting. Still many possible bugs, potentially clumsy implementation, but it seems to work. 2020-04-13 09:27:41 +02:00
Gael-de-Sailly 0bf351b2f6 Initial commit: working example using a basis of Simplex noise and implementing river flowing, lakes, and erosion 2020-04-09 21:15:41 +02:00