Skip to content

Generació de món #2

Description

@RubyEnoshima

Ara mateix hi ha una generació molt simple amb Perlin noise que només fa un terreny gairebé pla.

https://www.youtube.com/watch?v=CSa5O6knuwI&t=1s

https://www.youtube.com/watch?v=HPao-rNrH5Q

https://dawnosaur.substack.com/p/how-minecraft-generates-worlds-you

  • Poder seleccionar modo isla

int height = Y/2 + (int)(glm::perlin(glm::vec2((float)(i + X * posX) / X, (float)(k + Z * posY) / Z)) * 7);
for (int j = 0; j <= height; j++) {
uint8_t tipus = TERRA;
if (j == height) { // Capa d'adalt
tipus = GESPA;
chunk[i][j][k].top = true;
float probArbre = (float)(rand()) / (float)(RAND_MAX);
float probFlor = (float)(rand()) / (float)(RAND_MAX);
if (probArbre < probabilitatArbre) {
// Marquem l'arbre
res.push_back({0, glm::vec3(i + X * posX,j + 1,k + Z * posY) });
}
else if (probFlor < probabilitatFlor) {
// Marquem la flor
res.push_back({ 1, glm::vec3(i + X * posX,j + 1,k + Z * posY) });
}
}
else if (j < height - 3) tipus = PEDRA;
else if (j < 2) tipus = BEDROCK;
canviarCub(i, j, k, tipus);

  • Separar en generació de terreny i decoració (herba, arbres, bioma...)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

urgenteEsta issue es urgente

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions