Translations:Modding:WorldGen Concept/1/en

From Vintage Story Wiki
Revision as of 13:26, 21 November 2023 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This article introduces how world generation is handled in Vintage story, and the extent to which it can be modded. It is also intended as a general introduction for modding endeavors in regards to world generation.

Terminology

Important terminology to note while reading this article:

  • Chunk: An data structure that holds 32x32x32 blocks. It is of note that chunks do not span the world height.
  • Chunk column: A set of chunks spanning the vertical height of the world. Given a world height of 256, a chunk column would represent 8 vertically stacked chunks
  • Map chunk: A data structure that holds information on a chunk column, such as the rain height or snow accumulation
  • Map Region: A data structure that holds information over an area of 16x16 chunk columns, such as weather and maps required for world generation

Concept

World generation is the process of generating necessary data about the world when the player requires it. World generation is done on a region, map chunk and chunk column basis - each acting as a meaningful subdivision of the world. Each region, map chunk and chunk column is only generated once and stores important data about that area. World generation is very modular. Almost all generated parts of the world, such as ore deposits, creatures or trees, are specified via JSON content mods. On a coding level, each stage of generation triggers an event which the base game registers handlers to. Event handlers can be registered or removed through the API to alter any part of generation.

Content modding

Using content modding, here are the various things that can be added, modified or removed from world generation. Properties relative to world generation are generally located at Vintagestory/assets/survival/worldgen

Moddable content

Item Description
Deposits Anything that is "deposited" in the ground on generation, such as ores or patches of blocks like gravel and chalk
Structures Pre-defined structures, such as the ruins found throughout. The "How to use WorldEdit" page has instructions on building and exporting structures
Trees Tree and shrub placement
Block layers Layers of blocks found above the rock layer
Block patches Patches of blocks, also vegetation
Geological provinces Geological attributes and placement
Landforms Land layout and the general arrangement of terrain