Reimplement Biomes
parent
7cdd9bc270
commit
b272721fed
|
@ -51,7 +51,7 @@ public:
|
|||
ENetAddress address;
|
||||
|
||||
bool changedMapBlocks = true;
|
||||
glm::vec3 lastPos {-10000000, -10000000, -10000000};
|
||||
glm::vec3 lastPos = glm::vec3(INFINITY);
|
||||
|
||||
private:
|
||||
glm::vec3 pos {};
|
||||
|
|
|
@ -96,7 +96,7 @@ void ServerWorld::update(double delta) {
|
|||
if (client->hasPlayer) {
|
||||
r.sendTo(client->peer, PacketChannel::SERVER);
|
||||
|
||||
if (client->changedMapBlocks) changedChunks(*client);
|
||||
if (client->changedMapBlocks) changedMapBlocks(*client);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,42 +124,54 @@ void ServerWorld::update(double delta) {
|
|||
dimension.clearRemovedEntities();
|
||||
}
|
||||
|
||||
void ServerWorld::changedChunks(ServerClient& client) {
|
||||
auto mapBlock = Space::MapBlock::world::fromBlock(client.getPos());
|
||||
auto lastMapBlock = Space::MapBlock::world::fromBlock(client.lastPos);
|
||||
|
||||
std::pair<glm::ivec3, glm::ivec3> oldBounds = {
|
||||
{lastMapBlock.x - MB_GEN_H, lastMapBlock.y - MB_GEN_V, lastMapBlock.z - MB_GEN_H},
|
||||
{lastMapBlock.x + MB_GEN_H, lastMapBlock.y + MB_GEN_V, lastMapBlock.z + MB_GEN_H}};
|
||||
|
||||
unsigned int mapBlocksExisting = 0;
|
||||
unsigned int mapBlocksGenerating = 0;
|
||||
|
||||
for (const auto &c : generateOrder) {
|
||||
glm::ivec3 mapBlockPos = mapBlock + c;
|
||||
if (!isInBounds(mapBlockPos, oldBounds)) {
|
||||
auto existing = dimension.getMapBlock(mapBlockPos);
|
||||
if (existing != nullptr && existing->generated) {
|
||||
mapBlocksExisting++;
|
||||
sendMapBlock(mapBlockPos, client);
|
||||
}
|
||||
else {
|
||||
mapBlocksGenerating += generateMapBlock(mapBlockPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Generating " << mapBlocksGenerating << " blocks, sending " << mapBlocksExisting << " existing blocks." << std::endl;
|
||||
void ServerWorld::changedMapBlocks(ServerClient& client) {
|
||||
generateMapBlocks(client);
|
||||
sendChunksToPlayer(client);
|
||||
client.changedMapBlocks = false;
|
||||
}
|
||||
|
||||
bool ServerWorld::generateMapBlock(glm::ivec3 pos) {
|
||||
if(!dimension.getMapBlock(pos) || !dimension.getMapBlock(pos)->generated)
|
||||
return genStream->queue(pos);
|
||||
void ServerWorld::generateMapBlocks(ServerClient& client) {
|
||||
unsigned int generating = 0;
|
||||
glm::ivec3 playerMapBlock = Space::MapBlock::world::fromBlock(client.getPos());
|
||||
|
||||
for (const auto &c : generateOrder) {
|
||||
glm::ivec3 mapBlockPos = playerMapBlock + c;
|
||||
auto existing = dimension.getMapBlock(mapBlockPos);
|
||||
if (existing && existing->generated) continue;
|
||||
else generating += generateMapBlock(mapBlockPos);
|
||||
}
|
||||
|
||||
std::cout << "Player moved, generating " << generating << " MapBlocks." << std::endl;
|
||||
}
|
||||
|
||||
bool ServerWorld::generateMapBlock(glm::ivec3 pos) {
|
||||
if(!dimension.getMapBlock(pos) || !dimension.getMapBlock(pos)->generated) return genStream->queue(pos);
|
||||
return false;
|
||||
}
|
||||
|
||||
void ServerWorld::sendChunksToPlayer(ServerClient& client) {
|
||||
glm::ivec3 playerChunk = Space::Chunk::world::fromBlock(client.getPos());
|
||||
std::pair<glm::ivec3, glm::ivec3> bounds = {
|
||||
{playerChunk.x - CHUNK_SEND_H, playerChunk.y - CHUNK_SEND_V, playerChunk.z - CHUNK_SEND_H},
|
||||
{playerChunk.x + CHUNK_SEND_H, playerChunk.y + CHUNK_SEND_V, playerChunk.z + CHUNK_SEND_H}};
|
||||
|
||||
glm::ivec3 lastPlayerChunk = Space::Chunk::world::fromBlock(client.lastPos);
|
||||
std::pair<glm::ivec3, glm::ivec3> oldBounds = {
|
||||
{lastPlayerChunk.x - CHUNK_SEND_H, lastPlayerChunk.y - CHUNK_SEND_V, lastPlayerChunk.z - CHUNK_SEND_H},
|
||||
{lastPlayerChunk.x + CHUNK_SEND_H, lastPlayerChunk.y + CHUNK_SEND_V, lastPlayerChunk.z + CHUNK_SEND_H}};
|
||||
|
||||
for (int i = bounds.first.x; i < bounds.second.x; i++) {
|
||||
for (int j = bounds.first.y; j < bounds.second.y; j++) {
|
||||
for (int k = bounds.first.z; k < bounds.second.z; k++) {
|
||||
glm::ivec3 chunkPos {i, j, k};
|
||||
if (isInBounds(chunkPos, oldBounds)) continue;
|
||||
auto chunk = dimension.getChunk(chunkPos);
|
||||
if (chunk) sendChunk(chunk, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ServerWorld::sendChunk(const std::shared_ptr<Chunk>& chunk, ServerClient &peer) {
|
||||
if (chunk == nullptr || !chunk->generated) return;
|
||||
|
||||
|
@ -167,22 +179,6 @@ void ServerWorld::sendChunk(const std::shared_ptr<Chunk>& chunk, ServerClient &p
|
|||
r.sendTo(peer.peer, PacketChannel::CHUNK);
|
||||
}
|
||||
|
||||
void ServerWorld::sendChunk(const glm::ivec3& pos, ServerClient &peer) {
|
||||
sendChunk(dimension.getChunk(pos), peer);
|
||||
}
|
||||
|
||||
void ServerWorld::sendMapBlock(const glm::ivec3& pos, ServerClient &peer) {
|
||||
unsigned long long mapBlockIntegrity = dimension.getMapBlockIntegrity(pos);
|
||||
if (peer.getMapBlockIntegrity(pos) < mapBlockIntegrity) {
|
||||
auto mapBlock = dimension.getMapBlock(pos);
|
||||
assert(mapBlock != nullptr);
|
||||
|
||||
for (unsigned short i = 0; i < 64; i++) {
|
||||
if ((*mapBlock)[i] != nullptr) sendChunk((*mapBlock)[i], peer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ServerWorld::getBlock(glm::ivec3 pos) {
|
||||
return dimension.getBlock(pos);
|
||||
}
|
||||
|
@ -210,29 +206,25 @@ void ServerWorld::setBlock(glm::ivec3 pos, unsigned int block) {
|
|||
|
||||
for (auto &client : clientList.clients) {
|
||||
if (client->hasPlayer) {
|
||||
auto mapBlock = Space::MapBlock::world::fromBlock(client->getPos());
|
||||
|
||||
glm::ivec3 mapBlock = Space::MapBlock::world::fromBlock(client->getPos());
|
||||
std::pair<glm::ivec3, glm::ivec3> bounds = {
|
||||
{mapBlock.x - MB_GEN_H, mapBlock.y - MB_GEN_V, mapBlock.z - MB_GEN_H},
|
||||
{mapBlock.x + MB_GEN_H, mapBlock.y + MB_GEN_V, mapBlock.z + MB_GEN_H}};
|
||||
{mapBlock.x - MB_GEN_H, mapBlock.y - MB_GEN_V, mapBlock.z - MB_GEN_H},
|
||||
{mapBlock.x + MB_GEN_H, mapBlock.y + MB_GEN_V, mapBlock.z + MB_GEN_H}};
|
||||
|
||||
if (isInBounds(Space::MapBlock::world::fromChunk(chunkPos), bounds)) {
|
||||
if (isInBounds(Space::MapBlock::world::fromChunk(chunkPos), bounds))
|
||||
b.sendTo(client->peer, PacketChannel::BLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (block == DefinitionAtlas::AIR) {
|
||||
auto def = game.defs.blockFromId(oldBlock);
|
||||
if (def.callbacks.count(Callback::AFTER_DESTRUCT)) {
|
||||
if (def.callbacks.count(Callback::AFTER_DESTRUCT))
|
||||
def.callbacks[Callback::AFTER_DESTRUCT](game.parser.luaVec(pos));
|
||||
}
|
||||
}
|
||||
else {
|
||||
auto def = game.defs.blockFromId(block);
|
||||
if (def.callbacks.count(Callback::AFTER_CONSTRUCT)) {
|
||||
if (def.callbacks.count(Callback::AFTER_CONSTRUCT))
|
||||
def.callbacks[Callback::AFTER_CONSTRUCT](game.parser.luaVec(pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
class ServerWorld : public World {
|
||||
public:
|
||||
const static int MB_GEN_H = 2, MB_GEN_V = 2;
|
||||
const static int MB_GEN_H = 3, MB_GEN_V = 3;
|
||||
const static int CHUNK_SEND_H = 8, CHUNK_SEND_V = 8;
|
||||
|
||||
explicit ServerWorld(unsigned int seed, ServerGame& game, ClientList& clients);
|
||||
|
@ -26,15 +26,15 @@ public:
|
|||
|
||||
ServerDimension dimension;
|
||||
private:
|
||||
void changedChunks(ServerClient& client);
|
||||
bool generateMapBlock(glm::ivec3 pos);
|
||||
|
||||
void sendChunk(const glm::ivec3& pos, ServerClient& client);
|
||||
static void sendChunk(const std::shared_ptr<Chunk>& chunk, ServerClient& client);
|
||||
void sendMapBlock(const glm::ivec3& pos, ServerClient& client);
|
||||
|
||||
void changedMapBlocks(ServerClient& client);
|
||||
static bool isInBounds(glm::ivec3 pos, std::pair<glm::ivec3, glm::ivec3>& bounds);
|
||||
|
||||
void generateMapBlocks(ServerClient& client);
|
||||
bool generateMapBlock(glm::ivec3 pos);
|
||||
void sendChunksToPlayer(ServerClient& client);
|
||||
|
||||
static void sendChunk(const std::shared_ptr<Chunk>& chunk, ServerClient& client);
|
||||
|
||||
std::unique_ptr<ServerGenStream> genStream = nullptr;
|
||||
|
||||
unsigned int seed;
|
||||
|
@ -42,8 +42,6 @@ private:
|
|||
ClientList& clientList;
|
||||
|
||||
unsigned int generatedChunks = 0;
|
||||
|
||||
//Static vector of chunks to place around players
|
||||
std::vector<glm::ivec3> generateOrder;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
runfile(_PATH .. "plains")
|
||||
-- runfile(_PATH .. "plains")
|
||||
runfile(_PATH .. "highlands")
|
||||
runfile(_PATH .. "desert")
|
||||
runfile(_PATH .. "forest")
|
|
@ -1,40 +1,44 @@
|
|||
--local noise = {
|
||||
-- module = "add",
|
||||
-- sources = {
|
||||
-- { -- Elevation
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.02,
|
||||
-- octaves = 8
|
||||
-- },
|
||||
-- scale = 250,
|
||||
-- bias = 32
|
||||
-- },
|
||||
-- { -- Features
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.8,
|
||||
-- octaves = 3,
|
||||
-- },
|
||||
-- scale = 30,
|
||||
-- bias = 6
|
||||
-- }
|
||||
-- }
|
||||
--}
|
||||
--
|
||||
--zepha.register_biome("zeus:mapgen:desert", {
|
||||
-- environment = {
|
||||
-- temperature = 40/100,
|
||||
-- humidity = 20/100,
|
||||
-- roughness = 10/100
|
||||
-- },
|
||||
-- blocks = {
|
||||
-- top = "zeus:default:sand",
|
||||
-- soil = "zeus:default:sand",
|
||||
-- rock = "zeus:default:sandstone"
|
||||
-- },
|
||||
-- biome_tint = "#e6fa61",
|
||||
-- noise = noise
|
||||
--})
|
||||
local noise = {
|
||||
heightmap = {
|
||||
module = "add",
|
||||
sources = {{
|
||||
module = "const",
|
||||
value = -80
|
||||
}, {
|
||||
-- Elevation
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.02,
|
||||
octaves = 8
|
||||
},
|
||||
scale = 20,
|
||||
bias = 32
|
||||
}, {
|
||||
-- Features
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.8,
|
||||
octaves = 3,
|
||||
},
|
||||
scale = 5,
|
||||
bias = 6
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
zepha.register_biome("zeus:mapgen:desert", {
|
||||
environment = {
|
||||
temperature = 40/100,
|
||||
humidity = 20/100,
|
||||
roughness = 10/100
|
||||
},
|
||||
blocks = {
|
||||
top = "zeus:default:sand",
|
||||
soil = "zeus:default:sand",
|
||||
rock = "zeus:default:sandstone"
|
||||
},
|
||||
biome_tint = "#e6fa61",
|
||||
noise = noise
|
||||
})
|
|
@ -1,127 +1,127 @@
|
|||
--local noise = {
|
||||
-- heightmap = {
|
||||
-- module = "add",
|
||||
-- sources = {{
|
||||
-- -- Elevation
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.002,
|
||||
-- octaves = 8
|
||||
-- },
|
||||
-- scale = 250,
|
||||
-- bias = -32
|
||||
-- }, {
|
||||
-- -- Features
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.2,
|
||||
-- octaves = 3,
|
||||
-- },
|
||||
-- scale = 6,
|
||||
-- bias = 6
|
||||
-- }}
|
||||
-- }
|
||||
--}
|
||||
--
|
||||
--local woo = "zeus:default:wood"
|
||||
--local lea = "zeus:default:leaves"
|
||||
--local inv = "invalid"
|
||||
--
|
||||
--local trunk_layer_0 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local trunk_layer_1 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, woo, inv, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, inv, woo, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local trunk_layer_2 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, woo, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local leaf_layer_1 = {
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { lea, lea, lea, lea, lea },
|
||||
-- { lea, lea, woo, lea, lea },
|
||||
-- { lea, lea, lea, lea, lea },
|
||||
-- { inv, lea, lea, lea, inv }
|
||||
--}
|
||||
--
|
||||
--local leaf_layer_2 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { inv, lea, woo, lea, inv },
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local leaf_layer_3 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, lea, lea, inv, inv },
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { inv, inv, lea, lea, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local tree = zepha.create_structure({
|
||||
-- origin = V(2, 2, 2),
|
||||
-- schematic = {
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_1,
|
||||
-- trunk_layer_1,
|
||||
-- trunk_layer_1,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- leaf_layer_2,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_2,
|
||||
-- leaf_layer_3
|
||||
-- }
|
||||
--})
|
||||
--
|
||||
--zepha.register_biome("zeus:mapgen:forest", {
|
||||
-- environment = {
|
||||
-- temperature = 15/100,
|
||||
-- humidity = 80/100,
|
||||
-- roughness = 20/100,
|
||||
-- },
|
||||
-- blocks = {
|
||||
-- top = "zeus:default:grass",
|
||||
-- soil = "zeus:default:dirt",
|
||||
-- rock = "zeus:default:stone"
|
||||
-- },
|
||||
-- biome_tint = "#7beb26",
|
||||
-- noise = noise,
|
||||
-- structures = {
|
||||
-- tree
|
||||
-- }
|
||||
--})
|
||||
local noise = {
|
||||
heightmap = {
|
||||
module = "add",
|
||||
sources = {{
|
||||
-- Elevation
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.002,
|
||||
octaves = 8
|
||||
},
|
||||
scale = 250,
|
||||
bias = -32
|
||||
}, {
|
||||
-- Features
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.2,
|
||||
octaves = 3,
|
||||
},
|
||||
scale = 6,
|
||||
bias = 6
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
local woo = "zeus:default:wood"
|
||||
local lea = "zeus:default:leaves"
|
||||
local inv = "invalid"
|
||||
|
||||
local trunk_layer_0 = {
|
||||
{ inv, inv, inv, inv, inv },
|
||||
{ inv, woo, woo, woo, inv },
|
||||
{ inv, woo, woo, woo, inv },
|
||||
{ inv, woo, woo, woo, inv },
|
||||
{ inv, inv, inv, inv, inv }
|
||||
}
|
||||
|
||||
local trunk_layer_1 = {
|
||||
{ inv, inv, inv, inv, inv },
|
||||
{ inv, inv, woo, inv, inv },
|
||||
{ inv, woo, woo, woo, inv },
|
||||
{ inv, inv, woo, inv, inv },
|
||||
{ inv, inv, inv, inv, inv }
|
||||
}
|
||||
|
||||
local trunk_layer_2 = {
|
||||
{ inv, inv, inv, inv, inv },
|
||||
{ inv, inv, inv, inv, inv },
|
||||
{ inv, inv, woo, inv, inv },
|
||||
{ inv, inv, inv, inv, inv },
|
||||
{ inv, inv, inv, inv, inv }
|
||||
}
|
||||
|
||||
local leaf_layer_1 = {
|
||||
{ inv, lea, lea, lea, inv },
|
||||
{ lea, lea, lea, lea, lea },
|
||||
{ lea, lea, woo, lea, lea },
|
||||
{ lea, lea, lea, lea, lea },
|
||||
{ inv, lea, lea, lea, inv }
|
||||
}
|
||||
|
||||
local leaf_layer_2 = {
|
||||
{ inv, inv, inv, inv, inv },
|
||||
{ inv, lea, lea, lea, inv },
|
||||
{ inv, lea, woo, lea, inv },
|
||||
{ inv, lea, lea, lea, inv },
|
||||
{ inv, inv, inv, inv, inv }
|
||||
}
|
||||
|
||||
local leaf_layer_3 = {
|
||||
{ inv, inv, inv, inv, inv },
|
||||
{ inv, lea, lea, inv, inv },
|
||||
{ inv, lea, lea, lea, inv },
|
||||
{ inv, inv, lea, lea, inv },
|
||||
{ inv, inv, inv, inv, inv }
|
||||
}
|
||||
|
||||
local tree = zepha.create_structure({
|
||||
origin = V(2, 2, 2),
|
||||
schematic = {
|
||||
trunk_layer_0,
|
||||
trunk_layer_0,
|
||||
trunk_layer_0,
|
||||
trunk_layer_0,
|
||||
trunk_layer_1,
|
||||
trunk_layer_1,
|
||||
trunk_layer_1,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
trunk_layer_2,
|
||||
leaf_layer_2,
|
||||
leaf_layer_1,
|
||||
leaf_layer_1,
|
||||
leaf_layer_1,
|
||||
leaf_layer_1,
|
||||
leaf_layer_2,
|
||||
leaf_layer_3
|
||||
}
|
||||
})
|
||||
|
||||
zepha.register_biome("zeus:mapgen:forest", {
|
||||
environment = {
|
||||
temperature = 15/100,
|
||||
humidity = 80/100,
|
||||
roughness = 20/100,
|
||||
},
|
||||
blocks = {
|
||||
top = "zeus:default:grass",
|
||||
soil = "zeus:default:dirt",
|
||||
rock = "zeus:default:stone"
|
||||
},
|
||||
biome_tint = "#7beb26",
|
||||
noise = noise,
|
||||
structures = {
|
||||
tree
|
||||
}
|
||||
})
|
|
@ -1,46 +1,50 @@
|
|||
--local noise = {
|
||||
-- heightmap = {
|
||||
-- module = "const",
|
||||
-- value = -12
|
||||
---- module = "add",
|
||||
---- sources = {{
|
||||
---- -- Elevation
|
||||
---- module = "scale_bias",
|
||||
---- source = {
|
||||
---- module = "perlin",
|
||||
---- frequency = 0.002,
|
||||
---- octaves = 8
|
||||
---- },
|
||||
---- scale = 250,
|
||||
---- bias = -32
|
||||
---- }, {
|
||||
---- -- Features
|
||||
---- module = "scale_bias",
|
||||
---- source = {
|
||||
---- module = "perlin",
|
||||
---- frequency = 0.2,
|
||||
---- octaves = 3,
|
||||
---- },
|
||||
---- scale = 6,
|
||||
---- bias = 6
|
||||
---- }}
|
||||
-- }
|
||||
--}
|
||||
--
|
||||
--zepha.register_biome("zeus:mapgen:plains", {
|
||||
-- environment = {
|
||||
-- temperature = 15/100,
|
||||
-- humidity = 60/100,
|
||||
-- roughness = 20/100,
|
||||
-- },
|
||||
-- blocks = {
|
||||
-- top = "zeus:default:grass",
|
||||
-- soil = "zeus:default:dirt",
|
||||
-- rock = "zeus:default:stone"
|
||||
-- },
|
||||
-- biome_tint = "#aaed45",
|
||||
-- noise = noise,
|
||||
-- structures = {
|
||||
-- tree
|
||||
-- }
|
||||
--})
|
||||
local noise = {
|
||||
heightmap = {
|
||||
module = "add",
|
||||
sources = {{
|
||||
module = "const",
|
||||
value = -12
|
||||
}, {
|
||||
module = "add",
|
||||
sources = {{
|
||||
-- Elevation
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.002,
|
||||
octaves = 8
|
||||
},
|
||||
scale = 250,
|
||||
bias = -32
|
||||
}, {
|
||||
-- Features
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.2,
|
||||
octaves = 3,
|
||||
},
|
||||
scale = 6,
|
||||
bias = 6
|
||||
}}
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
zepha.register_biome("zeus:mapgen:plains", {
|
||||
environment = {
|
||||
temperature = 15/100,
|
||||
humidity = 60/100,
|
||||
roughness = 20/100,
|
||||
},
|
||||
blocks = {
|
||||
top = "zeus:default:grass",
|
||||
soil = "zeus:default:dirt",
|
||||
rock = "zeus:default:stone"
|
||||
},
|
||||
biome_tint = "#aaed45",
|
||||
noise = noise,
|
||||
structures = {
|
||||
tree
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue