From a24d6c37a41e9adc25302aa50bb8feb470998884 Mon Sep 17 00:00:00 2001 From: ondra Date: Sat, 26 Apr 2014 16:06:04 +0200 Subject: [PATCH] worldgen tweaks --- src/mightypork/rogue/world/WorldCreator.java | 2 +- .../rogue/world/entity/models/PlayerModel.java | 1 - src/mightypork/rogue/world/gen/LevelGenerator.java | 7 ++----- src/mightypork/rogue/world/gen/ScratchMap.java | 10 +++++----- .../rogue/world/gen/rooms/SimpleRectRoom.java | 2 +- src/mightypork/rogue/world/tile/models/Floor.java | 2 -- src/mightypork/rogue/world/tile/models/SimpleDoor.java | 2 -- src/mightypork/rogue/world/tile/models/Wall.java | 1 - 8 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/mightypork/rogue/world/WorldCreator.java b/src/mightypork/rogue/world/WorldCreator.java index 8d6a14e..f743e25 100644 --- a/src/mightypork/rogue/world/WorldCreator.java +++ b/src/mightypork/rogue/world/WorldCreator.java @@ -23,7 +23,7 @@ public class WorldCreator { Level l; // first level - l = LevelGenerator.build(rand.nextLong(), 30, LevelGenerator.DUNGEON_THEME); // + l = LevelGenerator.build(rand.nextLong(), 5, LevelGenerator.DUNGEON_THEME); // w.addLevel(l); w.createPlayer(0); diff --git a/src/mightypork/rogue/world/entity/models/PlayerModel.java b/src/mightypork/rogue/world/entity/models/PlayerModel.java index 6e6f15c..663ea79 100644 --- a/src/mightypork/rogue/world/entity/models/PlayerModel.java +++ b/src/mightypork/rogue/world/entity/models/PlayerModel.java @@ -5,7 +5,6 @@ import mightypork.rogue.world.Coord; import mightypork.rogue.world.entity.Entity; import mightypork.rogue.world.entity.EntityData; import mightypork.rogue.world.entity.renderers.PlayerRenderer; -import mightypork.rogue.world.level.Level; import mightypork.rogue.world.tile.Tile; diff --git a/src/mightypork/rogue/world/gen/LevelGenerator.java b/src/mightypork/rogue/world/gen/LevelGenerator.java index 6a41ed8..f235787 100644 --- a/src/mightypork/rogue/world/gen/LevelGenerator.java +++ b/src/mightypork/rogue/world/gen/LevelGenerator.java @@ -29,12 +29,9 @@ public class LevelGenerator { // start map.addRoom(ROOM_SQUARE); - for (int i = 0; i < 1+complexity/4 + rand.nextInt(3 + complexity); i++) { + for (int i = 0; i < 1+complexity/2 + rand.nextInt((int) (3 + complexity*1.5)); i++) { map.addRoom(ROOM_SQUARE); - } - - for (int i = 0; i < 1 + complexity/8 + rand.nextInt(1 + complexity); i++) { - map.addRoom(DEAD_END); + if(rand.nextInt(4)>0) map.addRoom(DEAD_END); } map.buildCorridors(); diff --git a/src/mightypork/rogue/world/gen/ScratchMap.java b/src/mightypork/rogue/world/gen/ScratchMap.java index 798fbc4..802206f 100644 --- a/src/mightypork/rogue/world/gen/ScratchMap.java +++ b/src/mightypork/rogue/world/gen/ScratchMap.java @@ -125,16 +125,16 @@ public class ScratchMap { switch (rand.nextInt(4)) { case 0: - center.x += 2 + rand.nextInt(6); + center.x += 1 + rand.nextInt(4); break; case 1: - center.x -= 2 + rand.nextInt(6); + center.x -= 1 + rand.nextInt(4); break; case 2: - center.y += 2 + rand.nextInt(6); + center.y += 1 + rand.nextInt(4); break; case 3: - center.y -= 2 + rand.nextInt(6); + center.y -= 1 + rand.nextInt(4); } final RoomDesc rd = rb.buildToFit(this, theme, rand, center); @@ -266,7 +266,7 @@ public class ScratchMap { Coord start = nodes.get(0); Set starts = new HashSet<>(); - for (int i = 0; i < 1+rooms.size()/8; i++) { + for (int i = 0; i < 2 + rooms.size() / 5; i++) { if (!starts.contains(start)) { for (int j = 0; j < nodes.size(); j++) { buildCorridor(start, nodes.get(j)); diff --git a/src/mightypork/rogue/world/gen/rooms/SimpleRectRoom.java b/src/mightypork/rogue/world/gen/rooms/SimpleRectRoom.java index e9ff181..f2dea0f 100644 --- a/src/mightypork/rogue/world/gen/rooms/SimpleRectRoom.java +++ b/src/mightypork/rogue/world/gen/rooms/SimpleRectRoom.java @@ -28,7 +28,7 @@ public class SimpleRectRoom implements RoomBuilder { map.border(min, max, theme.wall()); map.protect(min, max); - for (int i = 0; i <= 2 + rand.nextInt(4); i++) { + for (int i = 0; i <= rand.nextInt(6); i++) { final Coord door = min.copy(); switch (rand.nextInt(4)) { case 0: diff --git a/src/mightypork/rogue/world/tile/models/Floor.java b/src/mightypork/rogue/world/tile/models/Floor.java index 515a025..209b30c 100644 --- a/src/mightypork/rogue/world/tile/models/Floor.java +++ b/src/mightypork/rogue/world/tile/models/Floor.java @@ -2,9 +2,7 @@ package mightypork.rogue.world.tile.models; import mightypork.rogue.world.tile.Tile; -import mightypork.util.math.color.COMMODORE; import mightypork.util.math.color.Color; -import mightypork.util.math.color.PAL16; import mightypork.util.math.color.RGB; diff --git a/src/mightypork/rogue/world/tile/models/SimpleDoor.java b/src/mightypork/rogue/world/tile/models/SimpleDoor.java index 0accaeb..7bdb025 100644 --- a/src/mightypork/rogue/world/tile/models/SimpleDoor.java +++ b/src/mightypork/rogue/world/tile/models/SimpleDoor.java @@ -3,10 +3,8 @@ package mightypork.rogue.world.tile.models; import mightypork.rogue.world.tile.Tile; import mightypork.rogue.world.tile.renderers.DoorRenderer; -import mightypork.util.math.color.COMMODORE; import mightypork.util.math.color.Color; import mightypork.util.math.color.PAL16; -import mightypork.util.math.color.RGB; public class SimpleDoor extends AbstractTile { diff --git a/src/mightypork/rogue/world/tile/models/Wall.java b/src/mightypork/rogue/world/tile/models/Wall.java index 906120c..2d1192c 100644 --- a/src/mightypork/rogue/world/tile/models/Wall.java +++ b/src/mightypork/rogue/world/tile/models/Wall.java @@ -2,7 +2,6 @@ package mightypork.rogue.world.tile.models; import mightypork.rogue.world.tile.Tile; -import mightypork.util.math.color.COMMODORE; import mightypork.util.math.color.Color; import mightypork.util.math.color.RGB;