aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen
AgeCommit message (Collapse)Author
2022-12-24Store `MapEditEvent` blocks in a vector (#13071)Jude Melton-Houghton
2022-12-03Add `minetest.get_mapgen_edges` (#12999)Jude Melton-Houghton
2022-11-09Fix typos and en_US/en_GB inconsistency in various files (#12902)Abdou-31
2022-10-09Optimize lighting calculation (#12797)Jude Melton-Houghton
2022-09-06Code optimizations / refactor (#12704)Herman Semenov
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com> Co-authored-by: sfan5 <sfan5@live.de>
2022-07-09Enforce limits of settings that could cause buggy behaviour (#12450)SmallJoker
Enforces the setting value bounds that are currently only limited by the GUI (settingtypes.txt).
2022-06-20Annotate light spread functions with commentssfan5
2022-06-03fix integer overflow in mapgen (#11641)JosiahWI
* fix integer overflow in mapgen Some calculations involving the magic seed had overflow because the result of an intermediate arithmetic step could not fit in an s32. By making the magic seed unsigned, the other operand in the equation will be cast to unsigned, and possibly other operands or intermediate operands. This will result in unexpected behavior if an operand is negative, which is technically possible, but logically should not happen. * comment noise2d bitshift While working through the code I was momentarily concerned that the right bitshift in noise2d could fill ones in some cases. It turns out that with signed integers, this is indeed true, but this one is shifting an unsigned integer, so the behavior is as expected. I put a comment here to clarify this, in case someone else wonders the same thing down the line. * noise2d and noise3d unittests I have added 3 tests each for noise2d and noise3d, testing all zero inputs, a very large seed (case which caused UB in the old implementation) and some fun primes I picked for no particular reason. This should be sufficient to demonstrate that the behavior of the new implementation has not changed. I used uniform initialization because it is a good feature of C++11. Please do not explode. * uncomment the noise2d bitshift This reverts commit 583b77ee9f1ad6bb77340ebb5ba51eb9a88ff51c. It's a well-defined language semantic; it doesn't need to be commented. * code cleanliness
2022-04-08Spacing fixesShadowNinja
2022-01-09Mainmenu game-related changes (#11887)sfan5
fixes: * Switching between games does not immediately hide creative mode / damage buttons if so specified * World creation menu has a game selection list even though the menu already provides a gamebar * Showing gameid in world list is unnecessary * Choice of mapgen parameters in menu persists between games (and was half-broken)
2021-10-12Remove a few unused functions reported by callcatcher (#11658)SmallJoker
2021-08-31Switch MapBlock compression to zstd (#10788)lhofhansl
* Add zstd support. * Rearrange serialization order * Compress entire mapblock Co-authored-by: sfan5 <sfan5@live.de>
2021-08-16Fix access violation in create_schematic() (#11534)Treer
fixes #11533 Schematics saved from y locations greater than 0 would cause an access violation if layer probabilities were specified
2021-03-23Fix broken `BiomeGen` abstraction (#11107)sfan5
2021-03-20Schematic: Properly deal with before/after node resolving and document (#11011)SmallJoker
This fixes an out-of-bounds index access when the node resolver was already applied to the schematic (i.e. biome decoration). Also improves the handling of the two cases: prior node resolving (m_nodenames), and after node resolving (manual lookup)
2021-03-06Fix function override warnings in mg_ore.hsfan5
2021-01-22Remove dead code (#10845)rubenwardy
2021-01-21MgOre: Fix invalid field polymorphism (#10846)rubenwardy
2021-01-21Removed some obsolete code (#10562)Zughy
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2020-12-24Fix some minor code issues all over the placesfan5
2020-12-15Allow configuring block disk and net compression. Change default disk level.Lars
2020-11-26Avoid generating the same chunk more than once with multiple emerge threads.Lars
2020-11-20Move Mapgen V7 river generation into the main generation loop (#10639)Paramat
All terrain generation now occurs in one loop, instead of rivers being carved afterwards in a separate loop. Fixes the removal of nodes added by mods in 'register on generated'. Avoids other problems and reduces the chance of future bugs. Mapchunk generation time is reduced. Also fixes a code mistake which resulted in river channel generation being disabled at floatland altitudes even when floatlands were disabled.
2020-11-12Fix warnings about an unused variables and implicit conversion (#10586)red-001
2020-10-05Remove unused functions reported by cppcheck (#10463)SmallJoker
Run unused functions reported by cppcheck This change removes a few (but not all) unused functions. Some unused helper functions were not removed due to their complexity and potential of future use.
2020-10-01(se)SerializeString: Include max length in the nameSmallJoker
This commit clarifies the maximal length of the serialized strings. It will avoid accidental use of serializeString() when a larger string can be expected. Removes unused Wide String serialization functions
2020-09-03Add 'ores' global mapgen flag (#10276)Paramat
2020-08-05Mapgen Flat: Add caverns, disabled by default (#9913)Paramat
Add the caverns used in V5, V7, Valleys, Carpathian. Disabled by default to not be force-enabled in existing worlds.
2020-05-25L-System trees: Remove hardcoded use of 'mapgen_dirt' alias (#9931)Paramat
Games often and increasingly do not use this mapgen alias, as it is only required for Mapgen V6. Such games were triggering the recently added error message. Even if this mapgen alias was defined, dirt nodes placed under a wide trunk were inconsistent with biomes that do not use dirt surface nodes. Place trunk nodes below a wide trunk instead of 'mapgen_dirt'. On sloping ground, the trunk then extends down to the surface, instead of the surface rising up to meet the trunk. This looks more natural and does not alter the terrain.
2020-05-20Allow more than 255 biomes, document new maximum (#9855)Paramat
Change biomemap data type from u8 to u16. New technical (not practical) maximum is 65535 biomes.
2020-05-14Add new Mapgen V7 floatland implementation (#9296)Paramat
Floatland structure is vertically-compressed 3D noise. Uses a lacunarity of 1.618 (the golden ratio) for high quality noise. Floatlands appear between user-settable Y limits, with smooth tapering at each limit. Simple user-settable density adjustment. Shadow propagation is disabled in and just below floatlands, no shadows are cast on the world surface. Can be reconfigured to create a solid upper world layer between the Y limits, lakes/seas can be optionally added to this.
2020-05-05Fix thread safety of PcgRandom use in BiomeGensfan5
2020-05-05Fix remaining issues with mapgen scriptapisfan5
2020-05-05Give the Mapgen on each EmergeThread its own Biome/Ore/Deco/SchemManager copysfan5
2020-05-05Allow ObjDefManager instances to be clonedsfan5
2020-04-11Reduce ServerEnvironment propagation (#9642)Loïc Blot
ServerEnvironment is a huge class with many accessors. In various places it's not needed Remove it to reduce the ServerEnvironment view. Idea here is to reduce size of some of our objects to transport lightweight managers and permit easier testing Pathfinder is now tied to a generic map, not a ServerMap, it can be ported to client
2020-04-11Drop content_sao.{cpp,h}Loic Blot
Move LuaEntitySAO to a new dedicated file Drop TestSAO (useless object) Drop the old static startup initialized SAO factory, which was pretty useless. This factory was using a std::map for 2 elements, now just use a simple condition owned by ServerEnvironment, which will be lightweight, that will also drop a one time useful test on each LuaEntitySAO creation. This should reduce server load on massive SAO creation
2020-04-11Move serveractiveobject & unitsaoLoic Blot
Move serverobject.{cpp,h} to server/serveractiveobject.{cpp,h} Move UnitSAO class to dedicated files
2020-04-10Print error if invalid mapgen alias was detected (#9579)Wuzzy
2020-04-04Fix 'the the' typos in comments (#9554)LNJ
2020-03-10Remove unnecessary checks before delete (#9500)Nicolas Abril
Co-authored-by: Nicolas Abril <nicolasabril@alunos.utfpr.edu.br>
2020-01-25Settings: Add get_flags API for mapgen flags (mg_flags, mgv6_spflags, ...) ↵SmallJoker
(#9284) Unified flags handling in C++ and Lua Settings API -> Reading only, for now. Writing can be implemented later, if needed. API function to read the currently active flags -> was impossible from Lua Co-authored-by: Wuzzy <wuzzy2@mail.ru>
2020-01-04Remove Mapgen V7 floatlands in preparation for new implementation (#9238)Paramat
Preserve the floatland flag of existing worlds, to be used again when the new implementation is added.
2019-11-23Caves: Fix shadowing of 'large_cave_depth' to avoid confusionparamat
2019-11-23Dungeons: Move duplicated y limit checks to generation functionparamat
2019-11-19Move duplicated mapgen parameters to class MapgenBasic (#9134)Paramat
'large_cave_depth', 'dungeon_ymin' and 'dungeon_ymax' are duplicated across many mapgens so should have been in class MapgenBasic from the start.
2019-11-18Randomwalk cave liquids: Remove deprecated 'lava depth' parameter (#9105)Paramat
Low-disruption first step towards removing the hardcoded cave liquid code. Since MT 5.0.0 cave liquids can be defined and located by biome definitions instead. In games that do not yet use biome definitions to define and locate cave liquids (MTGame does), lava will now appear below y = water_level - 256 instead of below 'lava depth' (usually y = -256). Therefore no change in most mapgens if using the default 'lava depth'.
2019-11-10Randomwalk caves: Extend beyond mapchunk vertically also (#9094)Paramat
Previously, randomwalk caves only extended beyond the mapchunk borders horizontally, preventing vertical overlap and interconnection.
2019-11-09Tunnels: Completely disable generation when 'cave width' >= 10.0 (#9093)Paramat
Previously, the only way to disable the 3D noise tunnels was to set 'cave width' > 1.0, however doing so did not disable the very intensive noise calculations or the generation loop. All the other types of cave generation (randomwalk caves, caverns) can already be independently and completely disabled. This feature is now needed more because the small randomwalk caves are now available for use as an alternative to the 3D noise tunnels.
2019-11-08Randomwalk caves: Add parameters for number, proportion flooded. Allow small ↵Paramat
caves (#8928) Add mapgen parameters to set the range of the random number of randomwalk caves per mapchunk, and to set the proportion that are flooded with liquids. Default values are, for now, unchanged from the previous hardcoded values. Add parameters to allow small randomwalk caves Disabled by default for now as they have never been present in the non-mgv6 mapgens.