New generation

This commit is contained in:
Anuken
2019-04-11 16:41:46 -04:00
parent 5783b61631
commit df51078858
39 changed files with 4659 additions and 3951 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 981 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 KiB

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 KiB

After

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 748 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 747 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

View File

@@ -34,6 +34,8 @@ public class Blocks implements ContentList{
holostone, rocks, sporerocks, icerocks, cliffs, sporePine, pine, whiteTree, whiteTreeDead, sporeCluster, holostone, rocks, sporerocks, icerocks, cliffs, sporePine, pine, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, grass, salt, iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, grass, salt,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock,
creeptree,
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
//ores //ores
oreCopper, oreLead, oreScrap, oreCoal, oreTitanium, oreThorium, oreCopper, oreLead, oreScrap, oreCoal, oreTitanium, oreThorium,
@@ -312,6 +314,10 @@ public class Blocks implements ContentList{
whiteTree = new TreeBlock("white-tree"){{ whiteTree = new TreeBlock("white-tree"){{
}}; }};
creeptree = new TreeBlock("creeptree"){{
}};
sporeCluster = new Rock("spore-cluster"){{ sporeCluster = new Rock("spore-cluster"){{
variants = 3; variants = 3;
}}; }};
@@ -360,6 +366,16 @@ public class Blocks implements ContentList{
variants = 0; variants = 0;
}}; }};
darkPanel1 = new Floor("dark-panel-1"){{ variants = 0; }};
darkPanel2 = new Floor("dark-panel-2"){{ variants = 0; }};
darkPanel3 = new Floor("dark-panel-3"){{ variants = 0; }};
darkPanel4 = new Floor("dark-panel-4"){{ variants = 0; }};
darkPanel5 = new Floor("dark-panel-5"){{ variants = 0; }};
darkPanel6 = new Floor("dark-panel-6"){{ variants = 0; }};
darkMetal = new StaticWall("dark-metal"){{
}};
//endregion //endregion
//region ore //region ore

View File

@@ -5,7 +5,7 @@ import io.anuke.arc.graphics.Color;
public enum Team{ public enum Team{
none(Color.valueOf("4d4e58")), none(Color.valueOf("4d4e58")),
blue(Color.ROYAL), blue(Color.valueOf("4169e1")),
red(Color.valueOf("e84737")), red(Color.valueOf("e84737")),
green(Color.valueOf("1dc645")), green(Color.valueOf("1dc645")),
purple(Color.valueOf("ba5bd9")), purple(Color.valueOf("ba5bd9")),

View File

@@ -143,7 +143,7 @@ public class Shaders{
public static class LoadShader extends Shader{ public static class LoadShader extends Shader{
public LoadShader(String frag, String vert){ public LoadShader(String frag, String vert){
super(Core.files.internal("shaders/" + vert + ".vertex"), Core.files.internal("shaders/" + frag + ".fragment")); super(Core.files.internal("shaders/" + vert + ".vertex.glsl"), Core.files.internal("shaders/" + frag + ".fragment.glsl"));
} }
} }
} }

View File

@@ -67,6 +67,7 @@ public abstract class BasicGenerator extends RandomGenerator{
} }
public void noise(Tile[][] tiles, Block floor, Block block, int octaves, float falloff, float scl, float threshold){ public void noise(Tile[][] tiles, Block floor, Block block, int octaves, float falloff, float scl, float threshold){
sim.setSeed(Mathf.random(99999));
pass(tiles, (x, y) -> { pass(tiles, (x, y) -> {
if(sim.octaveNoise2D(octaves, falloff, 1f / scl, x, y) > threshold){ if(sim.octaveNoise2D(octaves, falloff, 1f / scl, x, y) > threshold){
Tile tile = tiles[x][y]; Tile tile = tiles[x][y];
@@ -78,6 +79,27 @@ public abstract class BasicGenerator extends RandomGenerator{
}); });
} }
public void tech(Tile[][] tiles){
Block[] blocks = {Blocks.darkPanel3};
int secSize = 20;
pass(tiles, (x, y) -> {
int mx = x % secSize, my = y % secSize;
int sclx = x / secSize, scly = y / secSize;
if(noise(sclx, scly, 10f, 1f) > 0.63f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
if(Mathf.chance(noise(x + 0x231523, y, 40f, 1f))){
floor = Structs.random(blocks);
if(Mathf.dst(mx, my, secSize/2, secSize/2) > secSize/2f + 2){
floor = Blocks.darkPanel5;
}
}
if(block.solid && Mathf.chance(0.7)){
block = Blocks.darkMetal;
}
}
});
}
public void distort(Tile[][] tiles, float scl, float mag){ public void distort(Tile[][] tiles, float scl, float mag){
Block[][] blocks = new Block[width][height]; Block[][] blocks = new Block[width][height];
Floor[][] floors = new Floor[width][height]; Floor[][] floors = new Floor[width][height];
@@ -95,6 +117,17 @@ public abstract class BasicGenerator extends RandomGenerator{
}); });
} }
public void scatter(Tile[][] tiles, Block target, Block dst, float chance){
pass(tiles, (x, y) -> {
if(!Mathf.chance(chance)) return;
if(floor == target){
floor = dst;
}else if(block == target){
block = dst;
}
});
}
public void each(IntPositionConsumer r){ public void each(IntPositionConsumer r){
for(int x = 0; x < width; x++){ for(int x = 0; x < width; x++){
for(int y = 0; y < height; y++){ for(int y = 0; y < height; y++){

View File

@@ -34,8 +34,12 @@ public class DesertWastesGenerator extends BasicGenerator{
distort(tiles, 20f, 4f); distort(tiles, 20f, 4f);
inverseFloodFill(tiles, tiles[spawnX][spawnY], Blocks.sandRocks); inverseFloodFill(tiles, tiles[spawnX][spawnY], Blocks.sandRocks);
noise(tiles, Blocks.salt, Blocks.sandRocks, 5, 0.6f, 200f, 0.55f);
noise(tiles, Blocks.darksand, Blocks.duneRocks, 5, 0.7f, 120f, 0.5f); noise(tiles, Blocks.darksand, Blocks.duneRocks, 5, 0.7f, 120f, 0.5f);
tech(tiles);
//scatter(tiles, Blocks.sandRocks, Blocks.creeptree, 1f);
tiles[endX][endY].setBlock(Blocks.spawn); tiles[endX][endY].setBlock(Blocks.spawn);
loadout.setup(spawnX, spawnY); loadout.setup(spawnX, spawnY);
} }

View File

@@ -35,6 +35,7 @@ public class OvergrowthGenerator extends BasicGenerator{
inverseFloodFill(tiles, tiles[spawnX][spawnY], Blocks.sporerocks); inverseFloodFill(tiles, tiles[spawnX][spawnY], Blocks.sporerocks);
noise(tiles, Blocks.darksandTaintedWater, Blocks.duneRocks, 4, 0.7f, 120f, 0.64f); noise(tiles, Blocks.darksandTaintedWater, Blocks.duneRocks, 4, 0.7f, 120f, 0.64f);
//scatter(tiles, Blocks.sporePine, Blocks.whiteTreeDead, 1f);
tiles[endX][endY].setBlock(Blocks.spawn); tiles[endX][endY].setBlock(Blocks.spawn);
loadout.setup(spawnX, spawnY); loadout.setup(spawnX, spawnY);

View File

@@ -18,6 +18,7 @@ public class StaticWall extends Rock{
super(name); super(name);
breakable = alwaysReplace = false; breakable = alwaysReplace = false;
solid = true; solid = true;
variants = 2;
cacheLayer = CacheLayer.walls; cacheLayer = CacheLayer.walls;
} }
@@ -43,15 +44,6 @@ public class StaticWall extends Rock{
large = Core.atlas.find(name + "-large"); large = Core.atlas.find(name + "-large");
} }
//two functions for calculating 2x2 tile brightness
int min(int rx, int ry){
return Math.min(world.tile(rx + 1, ry).getRotation(), Math.min(world.tile(rx, ry).getRotation(), Math.min(world.tile(rx + 1, ry + 1).getRotation(), world.tile(rx, ry + 1).getRotation())));
}
int avg(int rx, int ry){
return (world.tile(rx + 1, ry).getRotation() + world.tile(rx, ry).getRotation() + world.tile(rx + 1, ry + 1).getRotation() + world.tile(rx, ry + 1).getRotation()) / 4;
}
boolean eq(int rx, int ry){ boolean eq(int rx, int ry){
return world.tile(rx + 1, ry).block() == this return world.tile(rx + 1, ry).block() == this
&& world.tile(rx, ry + 1).block() == this && world.tile(rx, ry + 1).block() == this

View File

@@ -7,21 +7,19 @@ import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
public class TreeBlock extends Block{ public class TreeBlock extends Block{
static final float shadowOffset = 10f;
public TreeBlock(String name){ public TreeBlock(String name){
super(name); super(name);
solid = true; solid = true;
layer = Layer.power; layer = Layer.power;
//cacheLayer = CacheLayer.walls;
expanded = true; expanded = true;
} }
@Override
public void draw(Tile tile){
}
@Override @Override
public void drawLayer(Tile tile){ public void drawLayer(Tile tile){
Draw.colorl(1f - tile.getRotation() / 4f);
Draw.rect(region, tile.drawx(), tile.drawy(), Mathf.randomSeed(tile.pos(), 0, 4) * 90); Draw.rect(region, tile.drawx(), tile.drawy(), Mathf.randomSeed(tile.pos(), 0, 4) * 90);
Draw.color();
} }
} }