Entity spawning: Difference between revisions

From Vintage Story Wiki
(added details about elevation)
Line 96: Line 96:
=== Elevation ===
=== Elevation ===


<pre>
"goat-muskox-*-adult": {
</pre>...<pre>
"minY": 0.9,
"maxY": 1.2
},</pre>
{| class="wikitable"
! Value !! Significance
|-
| 0.0 to 1.0 || from the bottom of the world (0.0) to sea level (1.0)
|-
| 1.0 to 2.0 || from sea level (1.0) to the top of the world (2.0)
|}
Musk ox can spawn in areas no lower than 0.9 but no higher than 1.2 (and where other spawn conditions are met).
0.9 in a default world of height 256 would be Y 99 (110 x 0.9 = 99); 1.2 would be Y 132 (110 x 0.9 = 132).
In a world with different height than default, multiply 0.9 and 1.2 by the new world height to find the Y levels for musk ox in that world.
"Very occasionally there can be land below sea level which doesn't have water in it, e.g. cave entrances, and we still want plants and creatures to generate down there otherwise it might look weird, bare earth / no nature as soon as a cave goes below sea level.  There can also be dried lake beds in deserts I think." --radfast


== Sequence ==
== Sequence ==

Revision as of 07:33, 25 August 2024

This page was last verified for Vintage Story version 1.19.8.


UnderCon icon.png

This page is under construction.
This page is being created, or is in the process of extensive expansion or major restructuring. Until this notice is removed, please do not translate this page. Expect the content of this page to change significantly.


Entities such as wolves and butterflies have fairly complex conditions for when and where to spawn.

Data

Each entity has spawn conditions detailed in a document you can access on your computer. By default, the files are installed to %AppData%\Roaming\Vintagestory\assets\survival\entities. The file type is .json and Notepad++ is one example of a free program that can read and edit this file type.

JSON

JSON is a text format for storing and transporting data. While it's not necessary to study JSON to glean useful information from .json files, it may be beneficial to outline a few basic terms to be used throughout this article.

JSON syntax is derived from JavaScript object notation syntax. The JSON syntax is a subset of the JavaScript syntax. Basic rules:

  • Data is in name/value pairs
  • Data is separated by commas
  • Curly braces {} hold objects
  • Square brackets [] hold arrays

A name/value pair consists of a field name (in double quotes), followed by a colon, followed by a value. Example: "name":"John". This might not matter much when reading, but any edits must be careful about punctuation.

The musk ox entity belongs[1] to the same biological "family"[2] as goats, and its characteristics are defined in the goat.json file.

Within goat.json we can see 11 species of goat defined, as distinct "types." Later, when the file assigns properties "ByType" it will be to one or more of these 11 types. Asterisks serve as wildcards: *-adult-* refers to an adult of any species in this file, while *-muskox-* refers to an ox of any age/gender.

	"variantgroups": [
		{ "code": "type", "states": ["angora", "ibexalp", "ibexnub", "markhor", "mountain", "muskox", "nubian", "sirohi", "takingold", "turdag", "valais" ] },
		{ "code": "gender", "states": ["male", "female"] },
		{ "code": "age", "states": ["adult", "baby"] }
	],

Ctrl+F lets you search within a document for a specific word. A search within goat.json for "spawnconditions" yields a fairly lengthy entry with two main sections: "worldgen" and "runtime".

  • Worldgen: creatures spawn as you explore the undiscovered areas of the map
  • Runtime: creatures spawn in your vicinity (loaded chunks) and may have a check of distance to player

If you scroll down within goat.json, there's a "spawnconditionsByType" entry that breaks down the climate preferences for each species.

"goat-muskox-*-adult": {
	"climate": {
		"minTemp": -30,
		"maxTemp": -10,
		"minRain": 0.0,
		"maxRain": 0.8,
		"minForestOrShrubs": 0.0,
		"maxForest": 0.4,
		"maxShrubs": 0.8,
		"minY": 0.9,
		"maxY": 1.2					
	},
	"worldgen": {
		"triesPerChunk": { "avg": 0.003, "var": 0 }
	},
	"runtime": {
		"maxQuantityByGroup": { "code": "goat-*", "maxQuantity": 4 }
	}
},

Climate conditions

Using the command /wgen pos climate in the chat box will display the climate characteristics at that position.

Temperature

The minTemp and maxTemp for an entity's spawn conditions refer to annual average temperature. With C the player can view the current temperature, but that's not particularly useful for determining whether a location is a valid spawn for a particular entity. Instead, check /wgen pos climate.

Musk ox can spawn in areas where the annual average temperature is no lower than -30°C but no higher than -10°C (and where other spawn conditions are met). Comparing with the table below, they can't be found in default Temperate climates.

Climate band average temperatures
Starting climate Annual average
Hot 28 to 32°C
Warm 19 to 23 °C
Temperate 6 to 14 °C
Cool -5 to 1 °C
Icy -15 to -10°C

Rainfall

The minRain and maxRain for an entity's spawn conditions refer to annual average precipitation. With C the player can view the average rainfall of a location, but with a descriptive term that's not particularly useful for determining whether a location is a valid spawn for a particular entity. Instead, check /wgen pos climate.

Musk ox can spawn in areas where the annual average rainfall is no lower than 0 but no higher than 0.8 (and where other spawn conditions are met).

Forestation

Forestation parameters are a regional average. "It doesn't mean that a deer for example has to spawn in a place where there are trees overhead. More like, deer will spawn in places where trees are more likely." --radfast

Shrub

Elevation

"goat-muskox-*-adult": {

...

"minY": 0.9, "maxY": 1.2

},
Value Significance
0.0 to 1.0 from the bottom of the world (0.0) to sea level (1.0)
1.0 to 2.0 from sea level (1.0) to the top of the world (2.0)

Musk ox can spawn in areas no lower than 0.9 but no higher than 1.2 (and where other spawn conditions are met). 0.9 in a default world of height 256 would be Y 99 (110 x 0.9 = 99); 1.2 would be Y 132 (110 x 0.9 = 132). In a world with different height than default, multiply 0.9 and 1.2 by the new world height to find the Y levels for musk ox in that world.


"Very occasionally there can be land below sea level which doesn't have water in it, e.g. cave entrances, and we still want plants and creatures to generate down there otherwise it might look weird, bare earth / no nature as soon as a cave goes below sea level. There can also be dried lake beds in deserts I think." --radfast

Sequence

When a new chunk is discovered and begins to load, creatures are among one of the last features to be added. 93.GenCreatures.cs shows relevant details and some plain-English commentary.

Musk ox get 0.003 triesPerChunk. Bears will be significantly more common (0.015 triesPerChunk), and wolves even more so (0.07 triesPerChunk).

The file serverconfig.json includes a line that affects how many entities will spawn if there are multiple players sharing a world: "SpawnCapPlayerScaling": 0.5,

History

Notes

  • Bees are particles, not entities. Their spawn details can be found elsewhere.
  • Grasshoppers and cicadas are probably particles.

See also

References

  1. "The Bovidae comprise the biological family of cloven-hoofed, ruminant mammals that includes cattle, yaks, bison, buffalo, antelopes (including goat-antelopes), sheep and goats." From Wikipedia
  2. Wikipedia


Wiki Navigation
Vintage Story Guides[[::Category:Guides| ]]Frequently Asked Questions Soundtrack Versions Controls
Game systems Crafting Knapping Clay forming Smithing Cooking Temperature Hunger Mining Temporal stability Mechanical power Trading Farming Animal husbandry
World World generation Biomes Weather Temporal storms
Items Tools Weapons Armor Clothing Bags Materials Food
Blocks Terrain Plants Decorative Lighting Functional Ore
Entities Hostile entities Animals NPCs Players
Miscellaneous List of client commands List of server commands Creative Starter Guide Bot System WorldEdit Cinematic Camera Adjustable FPS Video Recording ServerBlockTicking