replace argument 'seed' with global constant 'SEED'

This commit is contained in:
MihailRis 2024-10-16 08:46:32 +03:00
parent 0ad59fadd9
commit faca68e6c3
5 changed files with 85 additions and 74 deletions

View File

@ -3,6 +3,7 @@
## Содержание ## Содержание
- [Основные понятия](#основные-понятия) - [Основные понятия](#основные-понятия)
- [Глобальные переменные](#глобальные-переменные)
- [Файл конфигурации](#файл-конфигурации) - [Файл конфигурации](#файл-конфигурации)
- [Фрагменты](#фрагменты) - [Фрагменты](#фрагменты)
- [Структуры](#структуры) - [Структуры](#структуры)
@ -52,6 +53,14 @@
- **heights-bpd** - количество блоков на точку карты высот. По-умолчанию: 4. - **heights-bpd** - количество блоков на точку карты высот. По-умолчанию: 4.
- **wide-structs-chunks-radius** - масимальный радиус размещения 'широких' структур, измеряемый в чанках. - **wide-structs-chunks-radius** - масимальный радиус размещения 'широких' структур, измеряемый в чанках.
## Глобальные переменные
В скрипте генератора доступны следующие переменные:
- `SEED` - зерно генерации мира
- `__DIR__` - директория генератора (`пак:generators/имя_генератора.files/`)
- `__FILE__` - файл скрипта (`пак:generators/имя_генератора.files/script.lua`)
## Фрагменты ## Фрагменты
Фрагмент является сохраненной для дальнейшего использования, областью мира, как и чанк, ограниченную некоторой шириной, высотой и длиной. Фрагмент может содержать данные не только о блоках, попадающих в область, но и о инвентарях блоков области, а так же сущностях. В отличие от чанка, размер фрагмента произволен. Фрагмент является сохраненной для дальнейшего использования, областью мира, как и чанк, ограниченную некоторой шириной, высотой и длиной. Фрагмент может содержать данные не только о блоках, попадающих в область, но и о инвентарях блоков области, а так же сущностях. В отличие от чанка, размер фрагмента произволен.
@ -75,6 +84,7 @@
``` ```
На данный момент, имя структуры должно совпадать с именем использованного фрагмента. На данный момент, имя структуры должно совпадать с именем использованного фрагмента.
## Биомы ## Биомы
Биом определяет то, из каких блоков и какими слоями генерируется ландшафт, а так же набор растений, структур. Биом определяет то, из каких блоков и какими слоями генерируется ландшафт, а так же набор растений, структур.
@ -139,22 +149,22 @@ structures = [
-- x, y - позиция начала карты (в точках) -- x, y - позиция начала карты (в точках)
-- w, h - ширина и высота карты (в точках) -- w, h - ширина и высота карты (в точках)
-- bpd - (blocks per dot) число блоков на точку (масштаб) -- bpd - (blocks per dot) число блоков на точку (масштаб)
function generate_biome_parameters(x, y, w, h, seed, bpd) function generate_biome_parameters(x, y, w, h, bpd)
-- создание карт высот (Heightmap) для каждого параметра биомов -- создание карт высот (Heightmap) для каждого параметра биомов
-- ... -- ...
return карты_через_запятую return карты_через_запятую
end end
-- пример -- пример
function generate_biome_parameters(x, y, w, h, seed, s) function generate_biome_parameters(x, y, w, h, s)
-- карта температур -- карта температур
local tempmap = Heightmap(w, h) local tempmap = Heightmap(w, h)
tempmap.noiseSeed = seed + 5324 tempmap.noiseSeed = SEED + 5324
tempmap:noise({x, y}, 0.04*s, 6) tempmap:noise({x, y}, 0.04*s, 6)
tempmap:pow(3) tempmap:pow(3)
-- карта влажности -- карта влажности
local hummap = Heightmap(w, h) local hummap = Heightmap(w, h)
hummap.noiseSeed = seed + 953 hummap.noiseSeed = SEED + 953
hummap:noise({x, y}, 0.04*s, 6) hummap:noise({x, y}, 0.04*s, 6)
hummap:pow(3) hummap:pow(3)
@ -356,7 +366,6 @@ generation.save_fragment(
function generate_heightmap( function generate_heightmap(
x, y, -- смещение карты высот x, y, -- смещение карты высот
w, h, -- размер карты высот, ожидаемый движком w, h, -- размер карты высот, ожидаемый движком
seed, -- зерно мира
bpd, -- число блоков на точку карты (blocks per dot) - масштаб bpd, -- число блоков на точку карты (blocks per dot) - масштаб
[опционально] inputs -- массив входных карт параметров биомов [опционально] inputs -- массив входных карт параметров биомов
-- (см. свойство heightmap-inputs генератора) -- (см. свойство heightmap-inputs генератора)
@ -367,11 +376,11 @@ function generate_heightmap(
к нужному диапазону: к нужному диапазону:
```lua ```lua
function generate_heightmap(x, y, w, h, seed, bpd) function generate_heightmap(x, y, w, h, bpd)
-- создаем карту высот с заданным размером -- создаем карту высот с заданным размером
local map = Heightmap(w, h) local map = Heightmap(w, h)
-- настраиваем зерно шума -- настраиваем зерно шума
map.noiseSeed = seed map.noiseSeed = SEED
-- шум с масштабом 1/10 на 4 октавы с амплитудой 0.5 -- шум с масштабом 1/10 на 4 октавы с амплитудой 0.5
map:noise({x, y}, 0.1*bpd, 4, 0.5) map:noise({x, y}, 0.1*bpd, 4, 0.5)
-- сдвигаем высоты к положительному диапазону -- сдвигаем высоты к положительному диапазону
@ -415,7 +424,6 @@ end
function place_structures( function place_structures(
x, z, -- позиция начала области в блоках x, z, -- позиция начала области в блоках
w, d, -- размер области в блоках w, d, -- размер области в блоках
seed, -- зерно мира
heights, -- карта высот чанка heights, -- карта высот чанка
chunk_height, -- высота чанка chunk_height, -- высота чанка
) --> массив размещений структур ) --> массив размещений структур
@ -426,7 +434,7 @@ function place_structures(
Пример: Пример:
```lua ```lua
function place_structures(x, z, w, d, seed, hmap, chunk_height) function place_structures(x, z, w, d, hmap, chunk_height)
local placements = {} local placements = {}
local height = hmap:at(w/2, h/2) * chunk_height local height = hmap:at(w/2, h/2) * chunk_height
@ -449,7 +457,6 @@ end
function place_structures_wide( function place_structures_wide(
x, z, -- позиция начала области в блоках x, z, -- позиция начала области в блоках
w, d, -- размер области в блоках w, d, -- размер области в блоках
seed, -- зерно мира
chunk_height, -- высота чанка chunk_height, -- высота чанка
) --> массив размещений структур / тоннелей ) --> массив размещений структур / тоннелей
``` ```

View File

@ -2,13 +2,13 @@ local _, dir = parse_path(__DIR__)
local ores = require "base:generation/ores" local ores = require "base:generation/ores"
ores.load(dir) ores.load(dir)
function place_structures(x, z, w, d, seed, hmap, chunk_height) function place_structures(x, z, w, d, hmap, chunk_height)
local placements = {} local placements = {}
ores.place(placements, x, z, w, d, seed, hmap, chunk_height) ores.place(placements, x, z, w, d, SEED, hmap, chunk_height)
return placements return placements
end end
function place_structures_wide(x, z, w, d, seed, chunk_height) function place_structures_wide(x, z, w, d, chunk_height)
local placements = {} local placements = {}
if math.random() < 0.05 then -- generate caves if math.random() < 0.05 then -- generate caves
local sx = x + math.random() * 10 - 5 local sx = x + math.random() * 10 - 5
@ -43,22 +43,22 @@ function place_structures_wide(x, z, w, d, seed, chunk_height)
return placements return placements
end end
function generate_heightmap(x, y, w, h, seed, s, inputs) function generate_heightmap(x, y, w, h, s, inputs)
local umap = Heightmap(w, h) local umap = Heightmap(w, h)
local vmap = Heightmap(w, h) local vmap = Heightmap(w, h)
umap.noiseSeed = seed umap.noiseSeed = SEED
vmap.noiseSeed = seed vmap.noiseSeed = SEED
vmap:noise({x+521, y+70}, 0.1*s, 3, 25.8) vmap:noise({x+521, y+70}, 0.1*s, 3, 25.8)
vmap:noise({x+95, y+246}, 0.15*s, 3, 25.8) vmap:noise({x+95, y+246}, 0.15*s, 3, 25.8)
local map = Heightmap(w, h) local map = Heightmap(w, h)
map.noiseSeed = seed map.noiseSeed = SEED
map:noise({x, y}, 0.8*s, 4, 0.02) map:noise({x, y}, 0.8*s, 4, 0.02)
map:cellnoise({x, y}, 0.1*s, 3, 0.3, umap, vmap) map:cellnoise({x, y}, 0.1*s, 3, 0.3, umap, vmap)
map:add(0.7) map:add(0.7)
local rivermap = Heightmap(w, h) local rivermap = Heightmap(w, h)
rivermap.noiseSeed = seed rivermap.noiseSeed = SEED
rivermap:noise({x+21, y+12}, 0.1*s, 4) rivermap:noise({x+21, y+12}, 0.1*s, 4)
rivermap:abs() rivermap:abs()
rivermap:mul(2.0) rivermap:mul(2.0)
@ -67,21 +67,21 @@ function generate_heightmap(x, y, w, h, seed, s, inputs)
map:mul(rivermap) map:mul(rivermap)
local desertmap = Heightmap(w, h) local desertmap = Heightmap(w, h)
desertmap.noiseSeed = seed desertmap.noiseSeed = SEED
desertmap:cellnoise({x+52, y+326}, 0.3*s, 2, 0.2) desertmap:cellnoise({x+52, y+326}, 0.3*s, 2, 0.2)
desertmap:add(0.4) desertmap:add(0.4)
map:mixin(desertmap, inputs[1]) map:mixin(desertmap, inputs[1])
return map return map
end end
function generate_biome_parameters(x, y, w, h, seed, s) function generate_biome_parameters(x, y, w, h, s)
local tempmap = Heightmap(w, h) local tempmap = Heightmap(w, h)
tempmap.noiseSeed = seed + 5324 tempmap.noiseSeed = SEED + 5324
tempmap:noise({x, y}, 0.04*s, 6) tempmap:noise({x, y}, 0.04*s, 6)
tempmap:mul(0.5) tempmap:mul(0.5)
tempmap:add(0.5) tempmap:add(0.5)
local hummap = Heightmap(w, h) local hummap = Heightmap(w, h)
hummap.noiseSeed = seed + 953 hummap.noiseSeed = SEED + 953
hummap:noise({x, y}, 0.04*s, 6) hummap:noise({x, y}, 0.04*s, 6)
tempmap:pow(3) tempmap:pow(3)
hummap:pow(3) hummap:pow(3)

View File

@ -24,10 +24,13 @@ static debug::Logger logger("generator-scripting");
class LuaGeneratorScript : public GeneratorScript { class LuaGeneratorScript : public GeneratorScript {
State* L; State* L;
const GeneratorDef& def; const GeneratorDef& def;
scriptenv env; scriptenv env = nullptr;
fs::path file;
std::string dirPath;
public: public:
LuaGeneratorScript(State* L, const GeneratorDef& def, scriptenv env) LuaGeneratorScript(State* L, const GeneratorDef& def, const fs::path& file, const std::string& dirPath)
: L(L), def(def), env(std::move(env)) { : L(L), def(def), file(file), dirPath(dirPath) {
} }
virtual ~LuaGeneratorScript() { virtual ~LuaGeneratorScript() {
@ -37,10 +40,33 @@ public:
} }
} }
void initialize(uint64_t seed) override {
env = create_environment(L);
stackguard _(L);
pushenv(L, *env);
pushstring(L, dirPath);
setfield(L, "__DIR__");
pushstring(L, dirPath + "/script.lua");
setfield(L, "__FILE__");
pushinteger(L, seed);
setfield(L, "SEED");
pop(L);
if (fs::exists(file)) {
std::string src = files::read_string(file);
logger.info() << "script (generator) " << file.u8string();
pop(L, execute(L, *env, src, file.u8string()));
} else {
// Use default (empty) script
pop(L, execute(L, *env, "", "<empty>"));
}
}
std::shared_ptr<Heightmap> generateHeightmap( std::shared_ptr<Heightmap> generateHeightmap(
const glm::ivec2& offset, const glm::ivec2& offset,
const glm::ivec2& size, const glm::ivec2& size,
uint64_t seed,
uint bpd, uint bpd,
const std::vector<std::shared_ptr<Heightmap>>& inputs const std::vector<std::shared_ptr<Heightmap>>& inputs
) override { ) override {
@ -48,7 +74,6 @@ public:
if (getfield(L, "generate_heightmap")) { if (getfield(L, "generate_heightmap")) {
pushivec_stack(L, offset); pushivec_stack(L, offset);
pushivec_stack(L, size); pushivec_stack(L, size);
pushinteger(L, seed);
pushinteger(L, bpd); pushinteger(L, bpd);
if (!inputs.empty()) { if (!inputs.empty()) {
size_t inputsNum = def.heightmapInputs.size(); size_t inputsNum = def.heightmapInputs.size();
@ -58,7 +83,7 @@ public:
rawseti(L, i+1); rawseti(L, i+1);
} }
} }
if (call_nothrow(L, 6 + (!inputs.empty()))) { if (call_nothrow(L, 5 + (!inputs.empty()))) {
auto map = touserdata<LuaHeightmap>(L, -1)->getHeightmap(); auto map = touserdata<LuaHeightmap>(L, -1)->getHeightmap();
pop(L, 2); pop(L, 2);
return map; return map;
@ -69,7 +94,7 @@ public:
} }
std::vector<std::shared_ptr<Heightmap>> generateParameterMaps( std::vector<std::shared_ptr<Heightmap>> generateParameterMaps(
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed, uint bpd const glm::ivec2& offset, const glm::ivec2& size, uint bpd
) override { ) override {
std::vector<std::shared_ptr<Heightmap>> maps; std::vector<std::shared_ptr<Heightmap>> maps;
@ -78,9 +103,8 @@ public:
if (getfield(L, "generate_biome_parameters")) { if (getfield(L, "generate_biome_parameters")) {
pushivec_stack(L, offset); pushivec_stack(L, offset);
pushivec_stack(L, size); pushivec_stack(L, size);
pushinteger(L, seed);
pushinteger(L, bpd); pushinteger(L, bpd);
if (call_nothrow(L, 6, biomeParameters)) { if (call_nothrow(L, 5, biomeParameters)) {
for (int i = biomeParameters-1; i >= 0; i--) { for (int i = biomeParameters-1; i >= 0; i--) {
maps.push_back( maps.push_back(
touserdata<LuaHeightmap>(L, -1-i)->getHeightmap()); touserdata<LuaHeightmap>(L, -1-i)->getHeightmap());
@ -166,7 +190,6 @@ public:
std::vector<Placement> placeStructuresWide( std::vector<Placement> placeStructuresWide(
const glm::ivec2& offset, const glm::ivec2& offset,
const glm::ivec2& size, const glm::ivec2& size,
uint64_t seed,
uint chunkHeight uint chunkHeight
) override { ) override {
std::vector<Placement> placements {}; std::vector<Placement> placements {};
@ -176,9 +199,8 @@ public:
if (getfield(L, "place_structures_wide")) { if (getfield(L, "place_structures_wide")) {
pushivec_stack(L, offset); pushivec_stack(L, offset);
pushivec_stack(L, size); pushivec_stack(L, size);
pushinteger(L, seed);
pushinteger(L, chunkHeight); pushinteger(L, chunkHeight);
if (call_nothrow(L, 6, 1)) { if (call_nothrow(L, 5, 1)) {
int len = objlen(L, -1); int len = objlen(L, -1);
for (int i = 1; i <= len; i++) { for (int i = 1; i <= len; i++) {
rawgeti(L, i); rawgeti(L, i);
@ -194,8 +216,10 @@ public:
} }
std::vector<Placement> placeStructures( std::vector<Placement> placeStructures(
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed, const glm::ivec2& offset,
const std::shared_ptr<Heightmap>& heightmap, uint chunkHeight const glm::ivec2& size,
const std::shared_ptr<Heightmap>& heightmap,
uint chunkHeight
) override { ) override {
std::vector<Placement> placements {}; std::vector<Placement> placements {};
@ -204,10 +228,9 @@ public:
if (getfield(L, "place_structures")) { if (getfield(L, "place_structures")) {
pushivec_stack(L, offset); pushivec_stack(L, offset);
pushivec_stack(L, size); pushivec_stack(L, size);
pushinteger(L, seed);
newuserdata<LuaHeightmap>(L, heightmap); newuserdata<LuaHeightmap>(L, heightmap);
pushinteger(L, chunkHeight); pushinteger(L, chunkHeight);
if (call_nothrow(L, 7, 1)) { if (call_nothrow(L, 6, 1)) {
int len = objlen(L, -1); int len = objlen(L, -1);
for (int i = 1; i <= len; i++) { for (int i = 1; i <= len; i++) {
rawgeti(L, i); rawgeti(L, i);
@ -224,28 +247,11 @@ public:
}; };
std::unique_ptr<GeneratorScript> scripting::load_generator( std::unique_ptr<GeneratorScript> scripting::load_generator(
const GeneratorDef& def, const fs::path& file, const std::string& dirPath const GeneratorDef& def,
const fs::path& file,
const std::string& dirPath
) { ) {
auto L = create_state(*engine->getPaths(), StateType::GENERATOR); auto L = create_state(*engine->getPaths(), StateType::GENERATOR);
auto env = create_environment(L);
stackguard _(L);
pushenv(L, *env); return std::make_unique<LuaGeneratorScript>(L, def, file, dirPath);
pushstring(L, dirPath);
setfield(L, "__DIR__");
pushstring(L, dirPath + "/script.lua");
setfield(L, "__FILE__");
pop(L);
if (fs::exists(file)) {
std::string src = files::read_string(file);
logger.info() << "script (generator) " << file.u8string();
pop(L, execute(L, *env, src, file.u8string()));
} else {
// Use default (empty) script
pop(L, execute(L, *env, "", "<empty>"));
}
return std::make_unique<LuaGeneratorScript>(L, def, std::move(env));
} }

View File

@ -123,17 +123,17 @@ class GeneratorScript {
public: public:
virtual ~GeneratorScript() = default; virtual ~GeneratorScript() = default;
virtual void initialize(uint64_t seed) = 0;
/// @brief Generate a heightmap with values in range 0..1 /// @brief Generate a heightmap with values in range 0..1
/// @param offset position of the heightmap in the world /// @param offset position of the heightmap in the world
/// @param size size of the heightmap /// @param size size of the heightmap
/// @param seed world seed
/// @param bpd blocks per dot /// @param bpd blocks per dot
/// @param inputs biome parameter maps passed to generate_heightmap /// @param inputs biome parameter maps passed to generate_heightmap
/// @return generated heightmap (can't be nullptr) /// @return generated heightmap (can't be nullptr)
virtual std::shared_ptr<Heightmap> generateHeightmap( virtual std::shared_ptr<Heightmap> generateHeightmap(
const glm::ivec2& offset, const glm::ivec2& offset,
const glm::ivec2& size, const glm::ivec2& size,
uint64_t seed,
uint bpd, uint bpd,
const std::vector<std::shared_ptr<Heightmap>>& inputs const std::vector<std::shared_ptr<Heightmap>>& inputs
) = 0; ) = 0;
@ -141,13 +141,11 @@ public:
/// @brief Generate a biomes parameters maps /// @brief Generate a biomes parameters maps
/// @param offset position of maps in the world /// @param offset position of maps in the world
/// @param size maps size /// @param size maps size
/// @param seed world seed
/// @param bpd blocks per dot /// @param bpd blocks per dot
/// @return generated maps (can't be nullptr) /// @return generated maps (can't be nullptr)
virtual std::vector<std::shared_ptr<Heightmap>> generateParameterMaps( virtual std::vector<std::shared_ptr<Heightmap>> generateParameterMaps(
const glm::ivec2& offset, const glm::ivec2& offset,
const glm::ivec2& size, const glm::ivec2& size,
uint64_t seed,
uint bpd uint bpd
) = 0; ) = 0;
@ -156,12 +154,10 @@ public:
/// wide-structs-chunks-radius /// wide-structs-chunks-radius
/// @param offset position of the area /// @param offset position of the area
/// @param size size of the area (blocks) /// @param size size of the area (blocks)
/// @param seed world seed
/// @param chunkHeight chunk height to use as heights multiplier /// @param chunkHeight chunk height to use as heights multiplier
virtual std::vector<Placement> placeStructuresWide( virtual std::vector<Placement> placeStructuresWide(
const glm::ivec2& offset, const glm::ivec2& offset,
const glm::ivec2& size, const glm::ivec2& size,
uint64_t seed,
uint chunkHeight uint chunkHeight
) = 0; ) = 0;
@ -169,13 +165,15 @@ public:
/// placed to nearest chunks also (position of out area). /// placed to nearest chunks also (position of out area).
/// @param offset position of the area /// @param offset position of the area
/// @param size size of the area (blocks) /// @param size size of the area (blocks)
/// @param seed world seed
/// @param heightmap area heightmap /// @param heightmap area heightmap
/// @param chunkHeight chunk height to use as heights multiplier /// @param chunkHeight chunk height to use as heights multiplier
/// @return structure & line placements /// @return structure & line placements
virtual std::vector<Placement> placeStructures( virtual std::vector<Placement> placeStructures(
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed, const glm::ivec2& offset,
const std::shared_ptr<Heightmap>& heightmap, uint chunkHeight) = 0; const glm::ivec2& size,
const std::shared_ptr<Heightmap>& heightmap,
uint chunkHeight
) = 0;
}; };
/// @brief Structure voxel fragments and metadata /// @brief Structure voxel fragments and metadata

View File

@ -31,6 +31,8 @@ WorldGenerator::WorldGenerator(
seed(seed), seed(seed),
surroundMap(0, BASIC_PROTOTYPE_LAYERS + def.wideStructsChunksRadius * 2) surroundMap(0, BASIC_PROTOTYPE_LAYERS + def.wideStructsChunksRadius * 2)
{ {
def.script->initialize(seed);
uint levels = BASIC_PROTOTYPE_LAYERS + def.wideStructsChunksRadius * 2; uint levels = BASIC_PROTOTYPE_LAYERS + def.wideStructsChunksRadius * 2;
surroundMap = SurroundMap(0, levels); surroundMap = SurroundMap(0, levels);
@ -228,7 +230,7 @@ void WorldGenerator::generateStructuresWide(
return; return;
} }
auto placements = def.script->placeStructuresWide( auto placements = def.script->placeStructuresWide(
{chunkX * CHUNK_W, chunkZ * CHUNK_D}, {CHUNK_W, CHUNK_D}, seed, CHUNK_H {chunkX * CHUNK_W, chunkZ * CHUNK_D}, {CHUNK_W, CHUNK_D}, CHUNK_H
); );
placeStructures(placements, prototype, chunkX, chunkZ); placeStructures(placements, prototype, chunkX, chunkZ);
@ -245,7 +247,7 @@ void WorldGenerator::generateStructures(
const auto& heightmap = prototype.heightmap; const auto& heightmap = prototype.heightmap;
auto placements = def.script->placeStructures( auto placements = def.script->placeStructures(
{chunkX * CHUNK_W, chunkZ * CHUNK_D}, {CHUNK_W, CHUNK_D}, seed, {chunkX * CHUNK_W, chunkZ * CHUNK_D}, {CHUNK_W, CHUNK_D},
heightmap, CHUNK_H heightmap, CHUNK_H
); );
placeStructures(placements, prototype, chunkX, chunkZ); placeStructures(placements, prototype, chunkX, chunkZ);
@ -297,7 +299,6 @@ void WorldGenerator::generateBiomes(
auto biomeParams = def.script->generateParameterMaps( auto biomeParams = def.script->generateParameterMaps(
{floordiv(chunkX * CHUNK_W, bpd), floordiv(chunkZ * CHUNK_D, bpd)}, {floordiv(chunkX * CHUNK_W, bpd), floordiv(chunkZ * CHUNK_D, bpd)},
{floordiv(CHUNK_W, bpd)+1, floordiv(CHUNK_D, bpd)+1}, {floordiv(CHUNK_W, bpd)+1, floordiv(CHUNK_D, bpd)+1},
seed,
bpd bpd
); );
for (auto index : def.heightmapInputs) { for (auto index : def.heightmapInputs) {
@ -339,7 +340,6 @@ void WorldGenerator::generateHeightmap(
prototype.heightmap = def.script->generateHeightmap( prototype.heightmap = def.script->generateHeightmap(
{floordiv(chunkX * CHUNK_W, bpd), floordiv(chunkZ * CHUNK_D, bpd)}, {floordiv(chunkX * CHUNK_W, bpd), floordiv(chunkZ * CHUNK_D, bpd)},
{floordiv(CHUNK_W, bpd)+1, floordiv(CHUNK_D, bpd)+1}, {floordiv(CHUNK_W, bpd)+1, floordiv(CHUNK_D, bpd)+1},
seed,
bpd, bpd,
prototype.heightmapInputs prototype.heightmapInputs
); );