More generation improvements

This commit is contained in:
Anuken 2018-07-22 13:29:01 -04:00
parent df147c700c
commit 68c51bb1bc
5 changed files with 396 additions and 312 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Before After
Before After

View file

@ -18,7 +18,7 @@ import static io.anuke.mindustry.Vars.*;
public class Sectors{
private static final int sectorImageSize = 16;
private static final float sectorLargeChance = 0.15f;
private static final float sectorLargeChance = 0.23f;
private GridMap<Sector> grid = new GridMap<>();
@ -48,7 +48,7 @@ public class Sectors{
/**Creates a sector at a location if it is not present, but does not unlock it.*/
public void createSector(int x, int y){
boolean isLarge = Mathf.randomSeed(Bits.packInt((short)round2(x), (short)round2(y))) < sectorLargeChance;
boolean isLarge = Mathf.randomSeed(3+Bits.packInt((short)round2(x), (short)round2(y))) < sectorLargeChance;
if(isLarge){
x = round2(x);

View file

@ -221,26 +221,15 @@ public class WorldGenerator{
int x = sectorX * sectorSize + localX + Short.MAX_VALUE;
int y = sectorY * sectorSize + localY + Short.MAX_VALUE;
Block floor = Blocks.stone;
Block floor;
Block wall = Blocks.air;
double ridge = rid.getValue(x, y, 1f / 400f);
double iceridge = rid.getValue(x+99999, y, 1f / 500f);
double iceridge = rid.getValue(x+99999, y, 1f / 300f) + sim3.octaveNoise2D(2, 1f, 1f/14f, x, y)/11f;
double elevation = sim.octaveNoise2D(detailed ? 7 : 2, 0.5, 1f / 500, x, y) * 6.1 - 1 - ridge;
double temp = vn.noise(x, y, 1f / 300f) * sim3.octaveNoise2D(detailed ? 2 : 1, 1, 1f / 13f, x, y)/13f
+ sim3.octaveNoise2D(detailed ? 12 : 6, 0.6, 1f / 920f, x, y);
double r = sim2.octaveNoise2D(1, 0.6, 1f / 70, x, y);
double edgeDist = Math.max(sectorSize / 2, sectorSize / 2) - Math.max(Math.abs(x - sectorSize / 2), Math.abs(y - sectorSize / 2));
//double dst = Vector2.dst((sectorX * sectorSize) + sectorSize/2f, (sectorY * sectorSize) + sectorSize/2f, x, y);
double elevDip = 30;
double border = 14;
if(edgeDist < border){
// elevation += (border - edgeDist) / 6.0;
}
if(elevation < 0.7){
floor = Blocks.deepwater;
}else if(elevation < 0.79){
@ -263,22 +252,11 @@ public class WorldGenerator{
floor = Blocks.stone;
}
if(elevation > 2 && iceridge > 0.3){
if(elevation > 3.3 && iceridge > 0.25){
elevation ++;
floor = Blocks.ice;
}
//if(dst < elevDip){
// elevation -= (elevDip - dst) / elevDip * 3.0;
/*}else*///if(detailed && r > 0.9){
//floor = Blocks.water;
//elevation = 0;
//if(r > 0.94){
// floor = Blocks.deepwater;
//}
//}
if(((Floor)floor).liquidDrop != null){
elevation = 0;
}

View file

@ -27,8 +27,9 @@ public class ColorMapper implements ContentList{
if(elevation > 0){
if(tmpColors.get() == null) tmpColors.set(new Color());
Color tmpColor = tmpColors.get();
float mul = 1.1f + elevation / 4f;
tmpColor.set(color);
float maxMult = 1f/Math.max(Math.max(tmpColor.r, tmpColor.g), tmpColor.b) ;
float mul = Math.min(1.1f + elevation / 4f, maxMult);
tmpColor.mul(mul, mul, mul, 1f);
color = Color.rgba8888(tmpColor);
}