mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-05-05 21:31:19 +02:00
goods
parent
63c07bebd2
commit
f9cc5feac1
1 changed files with 5 additions and 5 deletions
|
|
@ -1,16 +1,16 @@
|
|||
# 🚧 Under construction
|
||||
|
||||
Resource **spread models** are applied to check whether resource can or cannot be placed in a cell. Fantasy Map Generator allows to create custom spread models, but it requires some understanding on how models work. Resources are generated before states and cultures, so models are built on top of geographical data. Once model is changed, you need to regenerate all resources.
|
||||
Goods **spread models** are applied to check whether goods can or cannot be placed in a cell. Fantasy Map Generator allows to create custom spread models, but it requires some understanding on how models work. Goods are generated before states and cultures, so models are built on top of geographical data. Once model is changed, you need to regenerate all goods.
|
||||
|
||||
# Technical info
|
||||
Technically spread models are expressions evaluated for each cell to return `true` or `false`. If `true` is returned, the resource can be placed in the cell. The expressions are valid JS functions, you can use logical operators (`!` for not, `||` for OR, `&&` for and, etc.) and other features.
|
||||
Technically spread models are expressions evaluated for each cell to return `true` or `false`. If `true` is returned, the good can be placed in the cell. The expressions are valid JS functions, you can use logical operators (`!` for not, `||` for OR, `&&` for and, etc.) and other features.
|
||||
|
||||
The options are limited to a number of build-in functions. These functions make models syntax easier to read and write:
|
||||
* `random(number)`: percentage of true, e.g. `50` will return true in 50% of cases
|
||||
* `nth(number)`: true for each only n-th cell: 1st, 2nd, 3rd and so on. For example `nth(2)` skips 1/2 (50%) of cells and `nth(5)` skips 4/5 (80%) of cells.
|
||||
* `habitable()`: true if biome habitability is greater than 0
|
||||
* `habitability()`: check against biome habitability. Always true for habitability `>=100`, false for `0`, skips 50% of cells if habitability is `50` and so on
|
||||
* `elevation()`: check against cell's height - the higher cell is, the greater chance is. If you need resource to be more frequent in lower elevation areas, than just negate the function: `!elevation()`
|
||||
* `elevation()`: check against cell's height - the higher cell is, the greater chance is. If you need a good to be more frequent in lower elevation areas, than just negate the function: `!elevation()`
|
||||
* `biome(biomeId, biomeId, ...)`: check against list of biome ids, see below to get biome id reference
|
||||
* `minHeight(number)`: true if cell height >= number. Number is in range `[0-100]`, where `0` is deep ocean and `20` is minimal land elevation
|
||||
* `maxHeight(number)`: true if cell height <= number
|
||||
|
|
@ -40,9 +40,9 @@ These are the default biomes. To get actual ids run `biomesData.name.map((n,i) =
|
|||
|
||||
# Examples
|
||||
|
||||
Let's say we want a resource to be generated in hot and highly elevated areas. If altitude is medium, let it also be allowed, but pretty rarely. The model will be something like `minTemp(15) && (minHeight(70) || minHeight(40) && nth(5))`.
|
||||
Let's say we want a a good to be generated in hot and highly elevated areas. If altitude is medium, let it also be allowed, but pretty rarely. The model will be something like `minTemp(15) && (minHeight(70) || minHeight(40) && nth(5))`.
|
||||
|
||||
Another usual case is when we want resource frequency vary based on biomes. In this case you need to join multiple `biome()` functions like `biome(1) && (biome(2) && nth(2)) && (biome(3) && nth(3))`.
|
||||
Another usual case is when we want a good frequency vary based on biomes. In this case you need to join multiple `biome()` functions like `biome(1) && (biome(2) && nth(2)) && (biome(3) && nth(3))`.
|
||||
|
||||
Check the build-in models below to get the gist.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue