Generation tweaks
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 423 B |
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 769 B |
|
Before Width: | Height: | Size: 687 KiB After Width: | Height: | Size: 682 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 284 KiB After Width: | Height: | Size: 284 KiB |
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 905 KiB After Width: | Height: | Size: 905 KiB |
@@ -158,10 +158,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
if(tile == null) return 0;
|
if(tile == null) return 0;
|
||||||
tile = tile.link();
|
tile = tile.link();
|
||||||
int bc = tile.block().minimapColor(tile);
|
int bc = tile.block().minimapColor(tile);
|
||||||
if(bc != 0){
|
Color color = Tmp.c1.set(bc == 0 ? MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.team()) : bc);
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
Color color = Tmp.c1.set(MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.team()));
|
|
||||||
color.mul(1f - Mathf.clamp(world.getDarkness(tile.x, tile.y) / 4f));
|
color.mul(1f - Mathf.clamp(world.getDarkness(tile.x, tile.y) / 4f));
|
||||||
|
|
||||||
return color.rgba();
|
return color.rgba();
|
||||||
|
|||||||
@@ -45,13 +45,44 @@ public abstract class BasicGenerator implements WorldGenerator{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for visual testing only
|
||||||
|
public void cliffs2(){
|
||||||
|
for(Tile tile : tiles){
|
||||||
|
tile.setBlock(Blocks.air);
|
||||||
|
tile.cost = tile.floor().isLiquid ? 0 : (byte)(sim.octaveNoise2D(4, 0.5, 1.0 / 90.0, tile.x, tile.y) * 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Tile tile : tiles){
|
||||||
|
if(tile.floor().isLiquid) continue;
|
||||||
|
|
||||||
|
int rotation = 0;
|
||||||
|
for(int i = 0; i < 8; i++){
|
||||||
|
Tile other = tiles.get(tile.x + Geometry.d8[i].x, tile.y + Geometry.d8[i].y);
|
||||||
|
if(other != null && other.cost < tile.cost){ //down slope
|
||||||
|
rotation |= (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tile.rotation(rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Tile tile : tiles){
|
||||||
|
if(tile.rotation() != 0){
|
||||||
|
int rotation = tile.rotation();
|
||||||
|
tile.setBlock(Blocks.cliff);
|
||||||
|
tile.setOverlay(Blocks.air);
|
||||||
|
tile.rotation(rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void cliffs(){
|
public void cliffs(){
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
if(!tile.block().isStatic()) continue;
|
if(!tile.block().isStatic()) continue;
|
||||||
|
|
||||||
int rotation = 0;
|
int rotation = 0;
|
||||||
for(int i = 0; i < 4; i++){
|
for(int i = 0; i < 8; i++){
|
||||||
Tile other = tiles.get(tile.x + Geometry.d4[i].x, tile.y + Geometry.d4[i].y);
|
Tile other = tiles.get(tile.x + Geometry.d8[i].x, tile.y + Geometry.d8[i].y);
|
||||||
if(other != null && !other.block().isStatic()){
|
if(other != null && !other.block().isStatic()){
|
||||||
rotation |= (1 << i);
|
rotation |= (1 << i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,13 +102,34 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
|||||||
@Override
|
@Override
|
||||||
protected void generate(){
|
protected void generate(){
|
||||||
|
|
||||||
|
class Room{
|
||||||
|
int x, y, radius;
|
||||||
|
ObjectSet<Room> connected = new ObjectSet<>();
|
||||||
|
|
||||||
|
Room(int x, int y, int radius){
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.radius = radius;
|
||||||
|
connected.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(Room to){
|
||||||
|
if(connected.contains(to)) return;
|
||||||
|
|
||||||
|
connected.add(to);
|
||||||
|
float nscl = Mathf.random(20f, 60f);
|
||||||
|
int stroke = Mathf.random(4, 12);
|
||||||
|
brush(pathfind(x, y, to.x, to.y, tile -> (tile.solid() ? 5f : 0f) + (float)sim.octaveNoise2D(1, 1, 1f / nscl, tile.x, tile.y) * 50, manhattan), stroke);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cells(4);
|
cells(4);
|
||||||
distort(20f, 12f);
|
distort(20f, 12f);
|
||||||
|
|
||||||
float constraint = 1.3f;
|
float constraint = 1.3f;
|
||||||
float radius = width / 2f / Mathf.sqrt3;
|
float radius = width / 2f / Mathf.sqrt3;
|
||||||
int rooms = Mathf.random(2, 5);
|
int rooms = Mathf.random(2, 5);
|
||||||
Array<Point3> array = new Array<>();
|
Array<Room> array = new Array<>();
|
||||||
|
|
||||||
//TODO replace random calls with seed
|
//TODO replace random calls with seed
|
||||||
|
|
||||||
@@ -118,32 +139,31 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
|||||||
float ry = (height/2f + Tmp.v1.y);
|
float ry = (height/2f + Tmp.v1.y);
|
||||||
float maxrad = radius - Tmp.v1.len();
|
float maxrad = radius - Tmp.v1.len();
|
||||||
float rrad = Math.min(Mathf.random(9f, maxrad / 2f), 30f);
|
float rrad = Math.min(Mathf.random(9f, maxrad / 2f), 30f);
|
||||||
array.add(new Point3((int)rx, (int)ry, (int)rrad));
|
array.add(new Room((int)rx, (int)ry, (int)rrad));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Point3 room : array){
|
for(Room room : array){
|
||||||
erase(room.x, room.y, room.z);
|
erase(room.x, room.y, room.radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
int connections = Mathf.random(Math.max(rooms - 1, 1), rooms + 3);
|
int connections = Mathf.random(Math.max(rooms - 1, 1), rooms + 3);
|
||||||
|
Room spawn = array.random();
|
||||||
for(int i = 0; i < connections; i++){
|
for(int i = 0; i < connections; i++){
|
||||||
Point3 from = array.random();
|
array.random().connect(array.random());
|
||||||
Point3 to = array.random();
|
}
|
||||||
|
|
||||||
float nscl = Mathf.random(20f, 60f);
|
for(Room room : array){
|
||||||
int stroke = Mathf.random(4, 12);
|
spawn.connect(room);
|
||||||
brush(pathfind(from.x, from.y, to.x, to.y, tile -> (tile.solid() ? 5f : 0f) + (float)sim.octaveNoise2D(1, 1, 1f / nscl, tile.x, tile.y) * 50, manhattan), stroke);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cells(1);
|
cells(1);
|
||||||
distort(20f, 6f);
|
distort(20f, 6f);
|
||||||
|
|
||||||
Point3 spawn = array.random();
|
|
||||||
inverseFloodFill(tiles.getn(spawn.x, spawn.y));
|
inverseFloodFill(tiles.getn(spawn.x, spawn.y));
|
||||||
|
|
||||||
ores(ores);
|
ores(ores);
|
||||||
|
|
||||||
for(Point3 other : array){
|
for(Room other : array){
|
||||||
if(other != spawn){
|
if(other != spawn){
|
||||||
// tiles.getn(other.x, other.y).setOverlay(Blocks.spawn);
|
// tiles.getn(other.x, other.y).setOverlay(Blocks.spawn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,18 @@ public class Cliff extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
int r = tile.rotation();
|
int r = tile.rotation();
|
||||||
for(int i = 0; i < 4; i++){
|
for(int i = 0; i < 8; i++){
|
||||||
if((r & (1 << i)) != 0){
|
if((r & (1 << i)) != 0){
|
||||||
Draw.color(Tmp.c1.set(tile.floor().color).mul(1.3f + (i >= 2 ? -0.4f : 0.3f)));
|
Draw.color(Tmp.c1.set(tile.floor().color).mul(1.3f + (i >= 4 ? -0.4f : 0.3f)));
|
||||||
Draw.rect(region, tile.worldx(), tile.worldy(), i * 90f);
|
Draw.rect(region, tile.worldx(), tile.worldy(), 11f, 11f, i * 45f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minimapColor(Tile tile){
|
||||||
|
return Tmp.c1.set(tile.floor().color).mul(1.2f).rgba();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=e1a251eb2e98fb858e4132006fdc51da1a441586
|
archash=8a274592626265cb59a71d26bea94b38f703092a
|
||||||
|
|||||||