v0.6.1: connection room counts in levels are now much more consistent
This commit is contained in:
parent
0e033720c7
commit
b4ee9fa434
|
@ -55,11 +55,18 @@ public class LineBuilder extends RegularBuilder {
|
||||||
|
|
||||||
Room curr = entrance;
|
Room curr = entrance;
|
||||||
|
|
||||||
|
float[] pathTunnels = pathTunnelChances.clone();
|
||||||
for (int i = 0; i <= roomsOnPath; i++){
|
for (int i = 0; i <= roomsOnPath; i++){
|
||||||
if (i == roomsOnPath && exit == null)
|
if (i == roomsOnPath && exit == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int tunnels = Random.chances(pathTunnelChances);
|
int tunnels = Random.chances(pathTunnels);
|
||||||
|
if (tunnels == -1){
|
||||||
|
pathTunnels = pathTunnelChances.clone();
|
||||||
|
tunnels = Random.chances(pathTunnels);
|
||||||
|
}
|
||||||
|
pathTunnels[tunnels]--;
|
||||||
|
|
||||||
for (int j = 0; j < tunnels; j++){
|
for (int j = 0; j < tunnels; j++){
|
||||||
ConnectionRoom t = ConnectionRoom.createRoom();
|
ConnectionRoom t = ConnectionRoom.createRoom();
|
||||||
placeRoom(rooms, curr, t, direction + Random.Float(-pathVariance, pathVariance));
|
placeRoom(rooms, curr, t, direction + Random.Float(-pathVariance, pathVariance));
|
||||||
|
|
|
@ -88,13 +88,20 @@ public class LoopBuilder extends RegularBuilder {
|
||||||
roomsOnLoop = Math.min(roomsOnLoop, multiConnections.size());
|
roomsOnLoop = Math.min(roomsOnLoop, multiConnections.size());
|
||||||
roomsOnLoop++;
|
roomsOnLoop++;
|
||||||
|
|
||||||
|
float[] pathTunnels = pathTunnelChances.clone();
|
||||||
for (int i = 0; i < roomsOnLoop; i++){
|
for (int i = 0; i < roomsOnLoop; i++){
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
loop.add(entrance);
|
loop.add(entrance);
|
||||||
else
|
else
|
||||||
loop.add(multiConnections.remove(0));
|
loop.add(multiConnections.remove(0));
|
||||||
|
|
||||||
int tunnels = Random.chances(pathTunnelChances);
|
int tunnels = Random.chances(pathTunnels);
|
||||||
|
if (tunnels == -1){
|
||||||
|
pathTunnels = pathTunnelChances.clone();
|
||||||
|
tunnels = Random.chances(pathTunnels);
|
||||||
|
}
|
||||||
|
pathTunnels[tunnels]--;
|
||||||
|
|
||||||
for (int j = 0; j < tunnels; j++){
|
for (int j = 0; j < tunnels; j++){
|
||||||
loop.add(ConnectionRoom.createRoom());
|
loop.add(ConnectionRoom.createRoom());
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,9 +47,9 @@ public abstract class RegularBuilder extends Builder {
|
||||||
}
|
}
|
||||||
|
|
||||||
//path length is the percentage of pathable rooms that are on
|
//path length is the percentage of pathable rooms that are on
|
||||||
protected float pathLength = 0.6f;
|
protected float pathLength = 0.5f;
|
||||||
//The chance weights for extra rooms to be added to the path
|
//The chance weights for extra rooms to be added to the path
|
||||||
protected float[] pathLenJitterChances = new float[]{1, 0, 0};
|
protected float[] pathLenJitterChances = new float[]{0, 1, 0};
|
||||||
|
|
||||||
public RegularBuilder setPathLength( float len, float[] jitter ){
|
public RegularBuilder setPathLength( float len, float[] jitter ){
|
||||||
pathLength = len;
|
pathLength = len;
|
||||||
|
@ -57,8 +57,8 @@ public abstract class RegularBuilder extends Builder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float[] pathTunnelChances = new float[]{2, 6, 2};
|
protected float[] pathTunnelChances = new float[]{1, 3, 1};
|
||||||
protected float[] branchTunnelChances = new float[]{5, 4, 1};
|
protected float[] branchTunnelChances = new float[]{2, 2, 1};
|
||||||
|
|
||||||
public RegularBuilder setTunnelLength( float[] path, float[] branch){
|
public RegularBuilder setTunnelLength( float[] path, float[] branch){
|
||||||
pathTunnelChances = path;
|
pathTunnelChances = path;
|
||||||
|
@ -131,12 +131,20 @@ public abstract class RegularBuilder extends Builder {
|
||||||
int tries;
|
int tries;
|
||||||
Room curr;
|
Room curr;
|
||||||
ArrayList<Room> connectingRoomsThisBranch = new ArrayList<>();
|
ArrayList<Room> connectingRoomsThisBranch = new ArrayList<>();
|
||||||
|
|
||||||
|
float[] connectionChances = connChances.clone();
|
||||||
while (i < roomsToBranch.size()){
|
while (i < roomsToBranch.size()){
|
||||||
|
|
||||||
connectingRoomsThisBranch.clear();
|
connectingRoomsThisBranch.clear();
|
||||||
curr = Random.element(branchable);
|
curr = Random.element(branchable);
|
||||||
|
|
||||||
int connectingRooms = Random.chances(connChances);
|
int connectingRooms = Random.chances(connectionChances);
|
||||||
|
if (connectingRooms == -1){
|
||||||
|
connectionChances = connChances.clone();
|
||||||
|
connectingRooms = Random.chances(connectionChances);
|
||||||
|
}
|
||||||
|
connectionChances[connectingRooms]--;
|
||||||
|
|
||||||
for (int j = 0; j < connectingRooms; j++){
|
for (int j = 0; j < connectingRooms; j++){
|
||||||
ConnectionRoom t = ConnectionRoom.createRoom();
|
ConnectionRoom t = ConnectionRoom.createRoom();
|
||||||
tries = 3;
|
tries = 3;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user