Terrain Generation/ru: Difference between revisions

From Vintage Story Wiki
(Created page with "__TOC__ == Этапы генерации ландшафта == Следующие шаги являются обзором, в следующем разделе будет б...")
(Created page with "== Техническое == Каждый этап определен в [https://github.com/anegostudios/vssurvivalmod/tree/master/Systems/WorldGen/Standard/ChunkGen Базо...")
Line 16: Line 16:
# finalize, это завершает процесс, обрабатывая свет в куске, создавая животных и добавляя снег.
# finalize, это завершает процесс, обрабатывая свет в куске, создавая животных и добавляя снег.


== Technical ==
== Техническое ==
Each stage is defined in the [https://github.com/anegostudios/vssurvivalmod/tree/master/Systems/WorldGen/Standard/ChunkGen Survival base mod].
Каждый этап определен в [https://github.com/anegostudios/vssurvivalmod/tree/master/Systems/WorldGen/Standard/ChunkGen Базовый мод выживания].


=== Noise maps ===
=== Noise maps ===

Revision as of 10:31, 18 February 2022

Other languages:

Система генерации ландшафта чрезвычайно сложна и запутана.

«Генерация ландшафта» — это термин, обозначающий все части мира, созданные игрой, которые представляют собой блоки. Это включает, помимо прочего, почву, горы, озера, деревья и руины.

Этапы генерации ландшафта

Следующие шаги являются обзором, в следующем разделе будет более подробное объяснение этих этапов.

  1. генерирование карты шума для различных свойств.
  2. landforms, они выбираются на основе карты шума форм рельефа.
  3. rock strata, это этап, на котором тип горных пород в регионе выбирается частично на основе карты шума геологической провинции.
  4. caves, чанки заполнены пещерами.
  5. block layers, слои, размещенные поверх текущей земли, например. почва, снег и трава.
  6. deposits, руды и прочее в размещаются в породе.
  7. structures, добавляет руины, тележки торговцев, сундуки с сокровищами и многое другое.
  8. ponds, водоемы.
  9. vegetation and patches, случайно встречающиеся группами, рогоз, хвощ, цветы. Он также добавляет деревья.
  10. finalize, это завершает процесс, обрабатывая свет в куске, создавая животных и добавляя снег.

Техническое

Каждый этап определен в Базовый мод выживания.

Noise maps

VS utilizes three methods for generating noise: weighted octave, Perlin, and normalized simplex noise. Each one behaves differently. In total, seven [1] noise maps are created at this stage.

  • Climate
  • Flower
  • Bush
  • Forest
  • Beach
  • Geologic province
  • Landform

These maps are utilized by later stages to provide randomness to terrain.

Landforms

These are the shapes the land takes. There are many different landforms that can generate and some utilize more than one noise map, mostly the climate map. Each landform's properties are defined in the game assets. There are several optional properties, but all landforms must specify:

  • Octaves
  • Octave thresholds
  • Terrain Y key positions
  • Terrain Y key thresholds

Octaves defines how rough or smooth terrain is.

Rock strata

Rocks are generated in layers and those layers are grouped by their type: sedimentary, metamorphic and igneous.

Sedimentary group doesn't have to be generated. If it does, sedimentary stones lie above all metamorphic and igneous stones.

Metamorphic group doesn't have to be generated. If it does, metamorphic stones rest below all sedimentary layers and above all igneous layers.

Igneous group will always be generated. Igneous stones always start at the mantle, at the bottom of the map, and stretch upwards until it reaches metamorphic or sedimentary layers, or the surface.

Certain kinds of rocks have special spawning rules.

  • Basalt, despite being an igneous stone, can be generated above any layer, including sedimentary and metamorphic stones.
  • Halite spawns in underground domes of substantial size.
  • Marble spawns in veins in phyllite and slate.
  • Obsidian spawns in veins in basalt.
  • Suevite is found only in craters, surrounding meteoric iron veins.

Caves

Caves

Block layers

Layers of blocks.

Deposits

Deposits are handled in GenDeposits.cs in the Survival Mod. The code for deposits handles more than just ores in rocks. There are many steps in the process of generating ores.

  1. All assets in worldgen/deposits/ are loaded and parsed.
    1. The generator goes over all deposits and adds them to a list.
    2. If there are any child deposits, they are registered.
  2. A deposit shape distortion map is created. This is used when initializing deposits.
  3. The generator goes over all registered deposits.
    1. Each deposit variant is initialized with a random seed and the deposit shape distortion map. This init process is the same for all deposits and is used only to simplify the code.
    2. If the deposit variant uses an ore map, one is created for it. Each kind of deposit gets its own ore map.
    3. If there are any child deposits that also use an ore map, one is created for the child deposit.

This is the end of what is done in GenDeposits. When a new world region is generated, GenDeposits calls .OnMapRegionGen on each deposit variant.

  1. Region generation begins by updating the vertical distortion ore maps for the region.
  2. Each deposit variant then generates ore in the region.

GenDeposits.OnMapRegionGen is relatively simple because most of the generation work is given to each variant. What actually happens when a variant generates a region is dependent on which ore generator is used, of which there are several.

Structures

Trader carts, ruins, vugs.

Ponds

Vegetation and patches