v0.6.1: connection room counts in levels are now much more consistent

This commit is contained in:
Evan Debenham 2017-08-11 22:47:06 -04:00
parent 0e033720c7
commit b4ee9fa434
3 changed files with 31 additions and 9 deletions

View File

@ -54,12 +54,19 @@ public class LineBuilder extends RegularBuilder {
roomsOnPath = Math.min(roomsOnPath, multiConnections.size());
Room curr = entrance;
float[] pathTunnels = pathTunnelChances.clone();
for (int i = 0; i <= roomsOnPath; i++){
if (i == roomsOnPath && exit == null)
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++){
ConnectionRoom t = ConnectionRoom.createRoom();
placeRoom(rooms, curr, t, direction + Random.Float(-pathVariance, pathVariance));

View File

@ -88,13 +88,20 @@ public class LoopBuilder extends RegularBuilder {
roomsOnLoop = Math.min(roomsOnLoop, multiConnections.size());
roomsOnLoop++;
float[] pathTunnels = pathTunnelChances.clone();
for (int i = 0; i < roomsOnLoop; i++){
if (i == 0)
loop.add(entrance);
else
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++){
loop.add(ConnectionRoom.createRoom());
}

View File

@ -47,9 +47,9 @@ public abstract class RegularBuilder extends Builder {
}
//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
protected float[] pathLenJitterChances = new float[]{1, 0, 0};
protected float[] pathLenJitterChances = new float[]{0, 1, 0};
public RegularBuilder setPathLength( float len, float[] jitter ){
pathLength = len;
@ -57,8 +57,8 @@ public abstract class RegularBuilder extends Builder {
return this;
}
protected float[] pathTunnelChances = new float[]{2, 6, 2};
protected float[] branchTunnelChances = new float[]{5, 4, 1};
protected float[] pathTunnelChances = new float[]{1, 3, 1};
protected float[] branchTunnelChances = new float[]{2, 2, 1};
public RegularBuilder setTunnelLength( float[] path, float[] branch){
pathTunnelChances = path;
@ -131,12 +131,20 @@ public abstract class RegularBuilder extends Builder {
int tries;
Room curr;
ArrayList<Room> connectingRoomsThisBranch = new ArrayList<>();
float[] connectionChances = connChances.clone();
while (i < roomsToBranch.size()){
connectingRoomsThisBranch.clear();
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++){
ConnectionRoom t = ConnectionRoom.createRoom();
tries = 3;