Improved generation
This commit is contained in:
@@ -11,7 +11,7 @@ text.link.wiki.description=official Mindustry wiki
|
|||||||
text.linkfail=Failed to open link!\nThe URL has been copied to your cliboard.
|
text.linkfail=Failed to open link!\nThe URL has been copied to your cliboard.
|
||||||
text.editor.web=The web version does not support the editor!\nDownload the game to use it.
|
text.editor.web=The web version does not support the editor!\nDownload the game to use it.
|
||||||
text.web.unsupported=The web version does not support this feature! Download the game to use it.
|
text.web.unsupported=The web version does not support this feature! Download the game to use it.
|
||||||
text.multiplayer.web=This version of the game does not support multiplayer!\nTo play multiplayer from your browser, use the "multiplayer web version" link at the itch.io page.
|
text.multiplayer.web=The web version of the game does not support multiplayer!\nUse the downloadable PC, Android or iOS versions.
|
||||||
text.host.web=The web version does not support hosting games! Download the game to use this feature.
|
text.host.web=The web version does not support hosting games! Download the game to use this feature.
|
||||||
text.gameover=The core was destroyed.
|
text.gameover=The core was destroyed.
|
||||||
text.highscore=[YELLOW]New highscore!
|
text.highscore=[YELLOW]New highscore!
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ public class Blocks extends BlockList implements ContentList{
|
|||||||
drops = new ItemStack(Items.stone, 1);
|
drops = new ItemStack(Items.stone, 1);
|
||||||
minimapColor = Color.valueOf("252525");
|
minimapColor = Color.valueOf("252525");
|
||||||
playerUnmineable = true;
|
playerUnmineable = true;
|
||||||
|
hasOres = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
dirt = new Floor("dirt"){{
|
dirt = new Floor("dirt"){{
|
||||||
@@ -130,7 +131,7 @@ public class Blocks extends BlockList implements ContentList{
|
|||||||
ice = new Floor("ice"){{
|
ice = new Floor("ice"){{
|
||||||
dragMultiplier = 0.3f;
|
dragMultiplier = 0.3f;
|
||||||
speedMultiplier = 0.4f;
|
speedMultiplier = 0.4f;
|
||||||
minimapColor = Color.valueOf("c4e3e7");
|
minimapColor = Color.valueOf("b8eef8");
|
||||||
hasOres = true;
|
hasOres = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class MapInfoDialog extends FloatingDialog{
|
|||||||
content().add().padRight(8).left();
|
content().add().padRight(8).left();
|
||||||
content().addCheck("$text.editor.oregen", enabled -> {
|
content().addCheck("$text.editor.oregen", enabled -> {
|
||||||
tags.put("oregen", enabled ? "1" : "0");
|
tags.put("oregen", enabled ? "1" : "0");
|
||||||
}).left();
|
}).update(c -> c.setChecked(!tags.get("oregen", "0").equals("0"))).left();
|
||||||
|
|
||||||
name.change();
|
name.change();
|
||||||
description.change();
|
description.change();
|
||||||
|
|||||||
@@ -503,9 +503,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
|
|
||||||
if(mech.flying){
|
if(mech.flying){
|
||||||
//prevent strafing backwards, have a penalty for doing so
|
//prevent strafing backwards, have a penalty for doing so
|
||||||
float angDist = Angles.angleDist(rotation, velocity.angle()) / 180f;
|
|
||||||
float penalty = 0.2f; //when going 180 degrees backwards, reduce speed to 0.2x
|
float penalty = 0.2f; //when going 180 degrees backwards, reduce speed to 0.2x
|
||||||
speed *= Mathf.lerp(1f, penalty, angDist);
|
speed *= Mathf.lerp(1f, penalty, Angles.angleDist(rotation, velocity.angle()) / 180f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//drop from carrier on key press
|
//drop from carrier on key press
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class WorldGenerator{
|
|||||||
private Simplex sim2 = new Simplex(seed + 1);
|
private Simplex sim2 = new Simplex(seed + 1);
|
||||||
private Simplex sim3 = new Simplex(seed + 2);
|
private Simplex sim3 = new Simplex(seed + 2);
|
||||||
private RidgedPerlin rid = new RidgedPerlin(seed + 4, 1);
|
private RidgedPerlin rid = new RidgedPerlin(seed + 4, 1);
|
||||||
private VoronoiNoise vn = new VoronoiNoise(seed + 2, (short)1);
|
private VoronoiNoise vn = new VoronoiNoise(seed + 2, (short)0);
|
||||||
|
|
||||||
private SeedRandom random = new SeedRandom(seed + 3);
|
private SeedRandom random = new SeedRandom(seed + 3);
|
||||||
|
|
||||||
@@ -42,6 +42,8 @@ public class WorldGenerator{
|
|||||||
private ObjectMap<Block, Block> decoration;
|
private ObjectMap<Block, Block> decoration;
|
||||||
|
|
||||||
public WorldGenerator(){
|
public WorldGenerator(){
|
||||||
|
vn.setUseDistance(true);
|
||||||
|
|
||||||
decoration = Mathf.map(
|
decoration = Mathf.map(
|
||||||
Blocks.grass, Blocks.shrub,
|
Blocks.grass, Blocks.shrub,
|
||||||
Blocks.stone, Blocks.rock,
|
Blocks.stone, Blocks.rock,
|
||||||
@@ -222,9 +224,11 @@ public class WorldGenerator{
|
|||||||
Block floor = Blocks.stone;
|
Block floor = Blocks.stone;
|
||||||
Block wall = Blocks.air;
|
Block wall = Blocks.air;
|
||||||
|
|
||||||
double ridge = Mathf.clamp(rid.getValue(x, y, 1f / 400f))/3f;
|
double ridge = rid.getValue(x, y, 1f / 400f);
|
||||||
double elevation = sim.octaveNoise2D(detailed ? 7 : 2, 0.5, 1f / 500, x, y) * 5.1 - 1 - ridge;
|
double iceridge = rid.getValue(x+99999, y, 1f / 500f);
|
||||||
double temp = sim3.octaveNoise2D(detailed ? 2 : 1, 1, 1f / 13f, x, y)/13f + sim3.octaveNoise2D(detailed ? 12 : 6, 0.6, 1f / 620f, x, y) - ridge;
|
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 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 edgeDist = Math.max(sectorSize / 2, sectorSize / 2) - Math.max(Math.abs(x - sectorSize / 2), Math.abs(y - sectorSize / 2));
|
||||||
@@ -237,31 +241,43 @@ public class WorldGenerator{
|
|||||||
// elevation += (border - edgeDist) / 6.0;
|
// elevation += (border - edgeDist) / 6.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(temp < 0.35){
|
if(elevation < 0.7){
|
||||||
floor = Blocks.snow;
|
floor = Blocks.deepwater;
|
||||||
}else if(temp < 0.45){
|
}else if(elevation < 0.79){
|
||||||
floor = Blocks.stone;
|
floor = Blocks.water;
|
||||||
}else if(temp < 0.65){
|
}else if(elevation < 0.85){
|
||||||
floor = Blocks.grass;
|
|
||||||
}else if(temp < 0.8){
|
|
||||||
floor = Blocks.sand;
|
floor = Blocks.sand;
|
||||||
}else if(temp < 0.9){
|
}else if(temp < 0.55){
|
||||||
|
floor = Blocks.grass;
|
||||||
|
}else if(temp < 0.65){
|
||||||
|
floor = Blocks.sand;
|
||||||
|
}else if(temp + ridge/2f < 0.8 || elevation < 1.3){
|
||||||
floor = Blocks.blackstone;
|
floor = Blocks.blackstone;
|
||||||
elevation = 0f;
|
|
||||||
}else{
|
}else{
|
||||||
floor = Blocks.lava;
|
floor = Blocks.lava;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(elevation > 3.5){
|
||||||
|
floor = Blocks.snow;
|
||||||
|
}else if(elevation > 3){
|
||||||
|
floor = Blocks.stone;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(elevation > 2 && iceridge > 0.3){
|
||||||
|
elevation ++;
|
||||||
|
floor = Blocks.ice;
|
||||||
|
}
|
||||||
|
|
||||||
//if(dst < elevDip){
|
//if(dst < elevDip){
|
||||||
// elevation -= (elevDip - dst) / elevDip * 3.0;
|
// elevation -= (elevDip - dst) / elevDip * 3.0;
|
||||||
/*}else*/if(detailed && r > 0.9){
|
/*}else*///if(detailed && r > 0.9){
|
||||||
floor = Blocks.water;
|
//floor = Blocks.water;
|
||||||
elevation = 0;
|
//elevation = 0;
|
||||||
|
|
||||||
if(r > 0.94){
|
//if(r > 0.94){
|
||||||
floor = Blocks.deepwater;
|
// floor = Blocks.deepwater;
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(((Floor)floor).liquidDrop != null){
|
if(((Floor)floor).liquidDrop != null){
|
||||||
elevation = 0;
|
elevation = 0;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import io.anuke.mindustry.type.ContentList;
|
|||||||
public class ColorMapper implements ContentList{
|
public class ColorMapper implements ContentList{
|
||||||
private static IntMap<Block> blockMap = new IntMap<>();
|
private static IntMap<Block> blockMap = new IntMap<>();
|
||||||
private static ObjectIntMap<Block> colorMap = new ObjectIntMap<>();
|
private static ObjectIntMap<Block> colorMap = new ObjectIntMap<>();
|
||||||
private static Color tmpColor = new Color();
|
private static ThreadLocal<Color> tmpColors = new ThreadLocal<>();
|
||||||
|
|
||||||
public static Block getByColor(int color){
|
public static Block getByColor(int color){
|
||||||
return blockMap.get(color);
|
return blockMap.get(color);
|
||||||
@@ -25,6 +25,8 @@ public class ColorMapper implements ContentList{
|
|||||||
int color = wall.breakable ? team.intColor : getBlockColor(wall);
|
int color = wall.breakable ? team.intColor : getBlockColor(wall);
|
||||||
if(color == 0) color = ColorMapper.getBlockColor(floor);
|
if(color == 0) color = ColorMapper.getBlockColor(floor);
|
||||||
if(elevation > 0){
|
if(elevation > 0){
|
||||||
|
if(tmpColors.get() == null) tmpColors.set(new Color());
|
||||||
|
Color tmpColor = tmpColors.get();
|
||||||
float mul = 1.1f + elevation / 4f;
|
float mul = 1.1f + elevation / 4f;
|
||||||
tmpColor.set(color);
|
tmpColor.set(color);
|
||||||
tmpColor.mul(mul, mul, mul, 1f);
|
tmpColor.mul(mul, mul, mul, 1f);
|
||||||
|
|||||||
Reference in New Issue
Block a user