mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Update map chunk generation
This commit is contained in:
parent
386725000a
commit
4566b620df
@ -158,37 +158,32 @@ export class MapChunk {
|
|||||||
|
|
||||||
let weights = {};
|
let weights = {};
|
||||||
|
|
||||||
if (distanceToOriginInChunks < 3) {
|
// Later there is a mix of everything
|
||||||
// In the beginning, there are just circles
|
|
||||||
weights = {
|
|
||||||
[enumSubShape.circle]: 100,
|
|
||||||
};
|
|
||||||
} else if (distanceToOriginInChunks < 6) {
|
|
||||||
// Later there come rectangles
|
|
||||||
if (Math_random() > 0.4) {
|
|
||||||
weights = {
|
|
||||||
[enumSubShape.circle]: 100,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
weights = {
|
|
||||||
[enumSubShape.rect]: 100,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Finally there is a mix of everything
|
|
||||||
weights = {
|
weights = {
|
||||||
[enumSubShape.rect]: 100,
|
[enumSubShape.rect]: 100,
|
||||||
[enumSubShape.circle]: Math_round(50 + clamp(distanceToOriginInChunks * 2, 0, 50)),
|
[enumSubShape.circle]: Math_round(50 + clamp(distanceToOriginInChunks * 2, 0, 50)),
|
||||||
[enumSubShape.star]: Math_round(20 + clamp(distanceToOriginInChunks * 2, 0, 30)),
|
[enumSubShape.star]: Math_round(20 + clamp(distanceToOriginInChunks * 2, 0, 30)),
|
||||||
[enumSubShape.windmill]: Math_round(5 + clamp(distanceToOriginInChunks * 2, 0, 20)),
|
[enumSubShape.windmill]: Math_round(5 + clamp(distanceToOriginInChunks * 2, 0, 20)),
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
if (distanceToOriginInChunks < 7) {
|
||||||
|
// Initial chunk patches always have the same shape
|
||||||
|
const subShape = this.internalGenerateRandomSubShape(weights);
|
||||||
|
subShapes = [subShape, subShape, subShape, subShape];
|
||||||
|
} else if (distanceToOriginInChunks < 12) {
|
||||||
|
// Later patches can also have mixed ones
|
||||||
|
const subShapeA = this.internalGenerateRandomSubShape(weights);
|
||||||
|
const subShapeB = this.internalGenerateRandomSubShape(weights);
|
||||||
|
subShapes = [subShapeA, subShapeA, subShapeB, subShapeB];
|
||||||
|
} else {
|
||||||
|
// Finally there is a mix of everything
|
||||||
subShapes = [
|
subShapes = [
|
||||||
this.internalGenerateRandomSubShape(weights),
|
this.internalGenerateRandomSubShape(weights),
|
||||||
this.internalGenerateRandomSubShape(weights),
|
this.internalGenerateRandomSubShape(weights),
|
||||||
this.internalGenerateRandomSubShape(weights),
|
this.internalGenerateRandomSubShape(weights),
|
||||||
this.internalGenerateRandomSubShape(weights),
|
this.internalGenerateRandomSubShape(weights),
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
const definition = this.root.shapeDefinitionMgr.getDefinitionFromSimpleShapes(subShapes);
|
const definition = this.root.shapeDefinitionMgr.getDefinitionFromSimpleShapes(subShapes);
|
||||||
this.internalGeneratePatch(shapePatchSize, new ShapeItem(definition));
|
this.internalGeneratePatch(shapePatchSize, new ShapeItem(definition));
|
||||||
|
Loading…
Reference in New Issue
Block a user