aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen
Commit message (Collapse)AuthorAge
* Mapgen v6: Fix mudflow iteration and iterate twice (#8795)Paramat2019-08-15
| | | | | | | | | | In MapgenV6::flowMud(), the previous implementation of coordinate inversion caused the 2 inverted mudflow iterations (out of the 3 iterations) to not loop over the area, so only 1 non-inverted iteration occurred. Fix this bug but only iterate mudflow twice, as mapgen v6 has only had 1 iteration for many years. There is now a good balance of 1 non-inverted iteration and 1 inverted iteration.
* Better F6 profiler (#8750)SmallJoker2019-08-13
| | | | | | | Update the profiler names to make more sense of what they actually represent Move the profiler code from header to its source file Use monospace font to align lines Format the statistics line to align better with surrounding values Refresh the profiler each 3 seconds (roughly)
* Mapgen Flat: Fix and improve getSpawnLevelAtPoint() (#8756)Paramat2019-08-06
| | | | | | Previously, this wrongly returned ground level (a position containing a solid node) as spawn level. Return ground level + 2 (+ 2 to spawn above biome 'dust' nodes). Improve codestyle and make more consistent with generateTerrain().
* Initialise 'seabed_height' to avoid compilation warning (#8715)Paramat2019-07-26
|
* Re-order mapgens in mainmenu and 'all settings' mapgen selection (#8705)Paramat2019-07-25
| | | | | | v6 always last to discourage selection. Special mapgens flat, fractal, singlenode, next to last. Of these, singlenode last to discourage selection. Of the remaining, v5 last due to age, v7 first due to being the default.
* Mgfractal: Make non-fractal terrain optional (#8702)Paramat2019-07-25
| | | | | | Enabled by default. Only allow spawn on fractal, not on seabed terrain. Various codestyle and comment improvements.
* Document the deprecation of hardcoded cave liquids (#8692)Paramat2019-07-20
|
* Dungeons: Make multiple large rooms possible (#8678)Paramat2019-07-16
| | | | | | | | | Re-add the random size range for large rooms. Remove 'first_room_large' bool. Add 'large_room_chance' parameter that can disable large rooms, specify 1 large room, or specify a chance for large rooms. If 1 or a chance is specified, the first generated room is large, to take advantage of the intersection checks that are done for the 1st room only.
* Move more dungeon parameter selection to mapgens (#8653)Paramat2019-07-09
| | | | | | | | | | Move 'num_dungeons' to 'DungeonParams'. Add new parameter 'num_rooms' to replace 'rooms_min' and 'rooms_max', so that the mapgen has complete control over the number of rooms. Add new bool 'first_room_large' so that the mapgen chooses this instead of a hardcoded 1 in 4 chance. Add new parameter 'room_size_large' to replace 'room_size_large_min' and 'room_size_large_max', so that the mapgen has complete control over this.
* Dungeongen: Remove most hardcoded dungeon nodes (#8594)Paramat2019-06-30
| | | | | | | | | | | | | | | Biome-defined dungeon nodes was added as a feature to MT 5.0.0. So now remove most of the hardcoded dungeon node code that assumes a game has stone, sandstone, desert stone, and no other stone types. If biome-defined dungeon nodes are not found, dungeon nodes fall back to the 'cobble' mapgen alias if present, if not present they fall back to biome-defined 'stone'. Remove now-unnecessary mapgen aliases from MapgenBasic. Non-mgv6 games now only need to define 3 to 5 mapgen aliases. Document dungeon parameters. Make c_lava_source fallback to c_water_source as both are used as cave liquids.
* Mapgen Carpathian: Add optional rivers (#7977)Paramat2019-06-19
| | | | | Rivers are disabled by default and will not be added to existing worlds. Rewrite getSpawnLevelAtPoint() to be simpler and more consistent with generateTerrain().
* Dungeons: Settable density noise, move number calculation to mapgens (#8473)Paramat2019-06-01
| | | | | | | | | | | | Add user-settable noise parameters for dungeon density to each mapgen, except V6 which hardcodes this noise parameter. Move the calculation of number of dungeons generated in a mapchunk out of dungeongen.cpp and into mapgen code, to allow mapgens to generate any desired number of dungeons in a mapchunk, instead of being forced to have number of dungeons determined by a density noise. This is more flexible and allows mapgens to use dungeon generation to create custom structures, such as occasional mega-dungeons.
* Allow multiple cave liquids in a biome definition (#8481)Paramat2019-05-18
| | | | | | | | | | | | | This allows games to specify biome cave liquids and avoid the old hardcoded behaviour, but preserves the ability to have multiple cave liquids in one biome, such as lava and water. When multiple cave liquids are defined by the biome definition, make each entire cave use a randomly chosen liquid, instead of every small cave segment using a randomly chosen liquid. Plus an optimisation: Don't place nodes if cave liquid is defined as 'air'
* Optimize random turns in dungeongen (#8129)Jozef Behran2019-04-07
| | | | | | It turns out there is no need to return the new value and preserve the old one in random_turn, the procedure can be made to modify the value in-place. This saves quite a bunch of parameter and return value copying.
* Fix commentsLoic Blot2019-03-31
|
* mapgen: drop mapgen id from child mapgens.Loïc Blot2019-03-31
| | | | | | This id must be owned by the child mapgen and never be set to a misc value by a developer Also use nullptr in some places
* Dungeons: Do not remove nodes that have 'is_ground_content = false' (#8423)Paramat2019-03-26
| | | | | | | Like randomwalk caves, preserve nodes that have 'is_ground_content = false', to avoid dungeons that generate out beyond the edge of a mapchunk destroying nodes added by mods in 'register_on_generated()'. Issue discovered by, and original PR by, argyle77.
* Valleys mapgen code rewrite (#8101)Paramat2019-03-14
| | | | | | | | | | | | Shorter, simpler, clearer and more consistent with other mapgens, while preserving functionality. Base terrain shape is unchanged. With the 'vary river depth' option disabled, river surface level is unchanged. Behaviour of the 4 heat/humidity/river depth options is very slightly changed due to bugfixes and code cleanup (the mapgen is 'unstable'). Apply heat and humidity gradients above water_level instead of above y = 0.
* blitToVManip: Check out-of-bounds using node position not index (#8127)Paramat2019-01-25
| | | | | | | | | | | | | | Previously, when using 'place on vmanip' to add a schematic to a lua voxelmanip, if part of the schematic was outside the voxelmanip volume, the outside part would often appear in a strange place elsewhere inside the voxelmanip instead of being trimmed off. This was due to the out-of-bounds check checking the index. A position outside the voxelmanip can have an index that satisfies '0 <= index <= voxelmanip volume', causing the node to be placed at a strange position inside the voxelmanip. Use 'vm->m_area.contains(pos)' instead. Move index calculation to later in the code to optimise.
* Fix warnings about dungeongen.cpp memcpy() and unused variable in ↵Paramat2019-01-22
| | | | | | | | | | MapBlock::deSerializeNetworkSpecific() (#8122) * Fix warning about dungeongen.cpp memcpy() * Fix unused variable in MapBlock::deSerializeNetworkSpecific() * Fix unused variable a simpler way
* Fix Mapgen Valleys getSpawnLevelAtPoint() (#7756)Treer2018-10-03
|
* Fix various code issues found by cppcheck (#7741)Paramat2018-09-23
| | | | | Mapgen Singlenode: Remove 'flags' that duplicates a 'class Mapgen' member. Dungeongen: Initialise 'MMVManip *vm' to 'nullptr'. Inventorymanager: Remove assignment error 'found = '.
* Change mapgen order to ores > dungeons > decorations (#7656)Paramat2018-08-20
| | | | | | | | | | | Previously dungeons > decorations > ores. Decorations depend on the node they are placed on, and ore types are increasingly able to place large continuous volumes of nodes, such as strata. Decorations are increasingly being used underground. The new order avoids a node being changed by ore generation after a decoration has been placed on it. The new order also avoids ores appearing in the walls of a dungeon if the wall nodes match the local stone node.
* Mgv5: Change tunnel parameters to those of other mapgens (#7641)Paramat2018-08-16
| | | | | Make tunnels wider and use the noise parameters of most other mapgens. All other underground features are already identical to all other non-mgv6 mapgens, this final change modernises and improves the tunnels.
* Fix build on gcc 5.0 (#7586)zeuner2018-07-26
|
* Mgvalleys: Make river depth variation and humidity drop optional (#7532)Paramat2018-07-18
| | | | | | | | | | | Add 2 new mapgen flags to make river depth variation and humidity drop with altitude independently optional, instead of both being enabled by the 'humid rivers' flag. Simplify and clarify related code by removing a low priority optimisation regarding 't_heat'. Remove unnecessary optimisation bools and use spflags directly instead. Improve and fix documentation in settingtypes.txt. A few minor code cleanups.
* Cavegen: Fix errors when getting biome outside mapchunk (#7480)Paramat2018-06-26
| | | | | | | | | | Some cave segments are outside the mapchunk. Previously, biome was being calculated by a function that uses the noise maps. Points outside the mapchunk resulted in incorrect noise map indexes that were sometimes outside the noise map size, causing a crash. Use either noise maps or point noise calculations depending on point location.
* Decoration API: Add lightweight ability to have complete coverage (#7456)Paramat2018-06-24
| | | | | | | | | | | | | | When the noise value or fill_ratio >= 10.0 complete coverage is enabled. This disables random placement to avoid redundant multiple placements at one position. Instead, 1 decoration per surface node is placed by looping across each division. '10' was chosen as this is the fill_ratio that previously created very near complete coverage. The complete coverage feature therefore integrates smoothly when noise is used for variable decoration density. 'fill_ratio = 10' should be used by modders who want a decoration placed on every surface node. Compared to before such a decoration placement will be 10 times faster.
* Biome API: Fix absent water decorations and dust, in deep water (#7470)Paramat2018-06-21
| | | | | | | | | | | | Previously, the biomemap was 'BIOME_NONE' for a mapchunk column if a stone surface was not found in it, causing water surface decorations and water surface dust to fail. Store the biome ID of the biome calculated at a water surface and add it to the biomemap if the biomemap is 'BIOME_NONE' for the mapchunk column. The biome calculated at a stone surface still has priority for the biomemap entry, as it should. Edit an incorrect comment.
* Biome dust: Revert fix that added dust to mod structures (#7464)Paramat2018-06-19
| | | | | | | | | Revert commit 99143f494711034068685b6ee845ce19fa09d7d9 and commit f4ca830abe1aa22875c99b31bf2ee56e26f83f05. These commits caused biome dust to be applied even when there was no core mapgen terrain in a mapchunk column. So the dust, which overgenerates, then appeared on structures added by mods in 'on_generated', such as floatlands, asteroids or above-surface realms.
* Mapgen flags: Add 'biomes' global mapgen flag (#7355)Paramat2018-06-08
| | | | | | | | | Previously the only way to disable biomes was to 'clear' the registered biomes in a mod, but this method causes large amounts of unnecessary processing: 1. Calculation of 4 2D noises. 2. Looping through all nodes of a mapchunk replacing nodes with identical nodes. The new flag disables those operations.
* Biome dust placement: Improve comments, re-order some linesParamat2018-06-04
|
* Biomemap: Simplify code of recent commit (#7398)Paramat2018-06-02
|
* Biomemap: Avoid empty biomemap entry to fix failing biome dust (#7393)Paramat2018-06-02
| | | | | | | | | | | | 'generateBiomes()' constructs the biomemap as it generates biomes. The biome calculated at first stone surface encountered is added to the biomemap. Previously, if no stone surface was encountered in a mapchunk column the biomemap was left empty for that (x, z) position, causing biome dust and water surface decoration placement to fail. If at the base of a mapchunk column the biomemap is empty, add the currently active biome to the biomemap, or if biome is NULL calculate it for this position and add it to the biomemap.
* Mgv7: Avoid rivergen removing mod-placed nodes when overgenerating (#7388)Paramat2018-05-31
| | | | | Only allow river generation to replace c_stone. This also acts as an optimisation by being placed before canyon shape calculation.
* Vein ore: Fix bug caused by changing perlinmap Y size (#7371)Paramat2018-05-24
| | | | | | | | | | Because vein ore uses 3D noise (all the other ores use 2D noise) the perlinmap Y size can be different in different mapchunks when close to the ore Y limits. Previously this caused bugs in the vein structure because changes in perlinmap Y size did not recreate the noise objects. Delete and recreate the noise objects with the new Y size if Y size has changed.
* Schematic decorations: Fix placement bug when centred and rotated (#7365)Paramat2018-05-24
| | | | | | Previously, the centering caused by the 'place center x/z' flags did not take rotation into account. So schematics with unequal X and Z dimensions were incorrectly placed. The bug was hidden for schematics equal in X and Z dimensions.
* Dungeons: Fix duplication of y limit parameters (#7359)Paramat2018-05-20
|
* Vertical biome blend: Tune PRNG seed for finer detail (#7329)Paramat2018-05-14
|
* Mgv7: Code cleanup (#7299)Paramat2018-05-07
|
* Cavegen: Allow small RandomWalk caves to generate beyond mapchunk borderParamat2018-05-04
|
* Mapgen caves: Re-order generation to fix cavern bugParamat2018-04-29
| | | | | | | Previously, caverns confused tunnel generation causing biome top and filler nodes to appear in caverns. Split 'generateCaves()' into 2 functions to separate tunnel and large randomwalk cave generation. In each mapgen re-order cave generation to generate tunnels before caverns.
* Biome-defined cave liquids: Use faster biome calculationparamat2018-04-26
|
* Biome-defined dungeon nodes: Use faster biome calculationparamat2018-04-26
|
* Dungeons: Mostly fix missing stair nodesParamat2018-04-25
|
* Mgvalleys: Code cleanupParamat2018-04-24
| | | | | | | | | | | Split some long lines. Edit comments. Remove unnecessary comments and unnecessary commented-out code. Use std::fmax/fmin instead of MYMAX/MYMIN. Remove scope-limiting braces. Consistently define literals as floats, except in noise parameters. Cleanup literals in noise parameters. Remove unnecessary 'near_cavern' line. Reduce max spawn y to be consistent with other mapgens.
* Mgvalleys: Use shared tunnel / cavern code instead of internalParamat2018-04-21
| | | | | | | | | | | | | | | | Caverns first appeared in mgvalleys and were later added to other mapgens as shared code. Now this shared code can replace mgvalley's internal cavern code. Also use shared tunnel code instead of internal code. Changes to mapgen that will affect existing worlds (mgvalleys is not stable): Single lava and water sources not added in tunnels. Previous caverns are unchanged but an equal number of new ones are added at a distance from the previous. From y = -256 to 192 nodes below, where the caverns taper at their upper limit, they will have a slightly different shape as the taper is now linear.
* Cave liquids: Use a more precise point for calculating biomeParamat2018-04-21
| | | | Use the centre point of the route being carved for a more precise match between cave liquids and biome.
* Node resolver: Make error on fallback optional, disable for mapgen aliasesParamat2018-04-20
|
* Cavegen: Fix variable typo that broke mgvalleys large cave distribution (#7249)Paramat2018-04-17
| | | | | Fix elusive 5 year old bug that caused mgvalleys large caves to be flat and limited to mapchunk borders. Error was fixed 2 years ago in 'CavesV6' but not in 'CavesRandomWalk'.