From fa15428ed219739a8181a96688333dc28ab99c6d Mon Sep 17 00:00:00 2001 From: Regalis Date: Tue, 13 Sep 2016 18:55:20 +0300 Subject: [PATCH] The entrances and exits of the levels have more variety (not always a straight vertical tunnel) --- .../Content/Map/LevelGenerationParameters.xml | 4 ++-- Subsurface/Source/Map/Levels/Level.cs | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Subsurface/Content/Map/LevelGenerationParameters.xml b/Subsurface/Content/Map/LevelGenerationParameters.xml index f593fbfc1..add72c487 100644 --- a/Subsurface/Content/Map/LevelGenerationParameters.xml +++ b/Subsurface/Content/Map/LevelGenerationParameters.xml @@ -46,7 +46,7 @@ width="150000" height="50000" VoronoiSiteInterval="8000,1000" - VoronoiSiteVariance="2000,400" + VoronoiSiteVariance="1400,100" MainPathNodeIntervalRange="5000,10000" BackgroundColor="55,72,58" SmallTunnelCount="10" @@ -62,7 +62,7 @@ VoronoiSiteInterval="1500,1500" VoronoiSiteVariance="700,700" MainPathNodeIntervalRange="6000,10000" - BackgroundColor="50,46,20" + BackgroundColor="25,23,10" SmallTunnelCount="10" SmallTunnelLengthRange="5000,50000" RuinCount="3" diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs index fb13abd02..13766cf55 100644 --- a/Subsurface/Source/Map/Levels/Level.cs +++ b/Subsurface/Source/Map/Levels/Level.cs @@ -182,29 +182,28 @@ namespace Barotrauma minWidth = Math.Max(minWidth, 6500.0f); startPosition = new Vector2( - Rand.Range(minWidth * 2, minWidth * 4, false), - Rand.Range(minWidth * 2, borders.Height - minWidth * 2, false)); + Rand.Range(minWidth * 2, minWidth * 4, false), + Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, false)); endPosition = new Vector2( - borders.Width - Rand.Range(minWidth * 2, minWidth * 4, false), - Rand.Range(minWidth * 2, borders.Height - minWidth * 2, false)); + borders.Width - Rand.Range(minWidth * 2, minWidth * 4, false), + Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, false)); List pathNodes = new List(); Rectangle pathBorders = borders;// new Rectangle((int)minWidth, (int)minWidth, borders.Width - (int)minWidth * 2, borders.Height - (int)minWidth); pathBorders.Inflate(-minWidth*2, -minWidth*2); pathNodes.Add(new Vector2(startPosition.X, borders.Height)); - pathNodes.Add(startPosition); + Vector2 nodeInterval = generationParams.MainPathNodeIntervalRange; - for (float x = startPosition.X; - x < endPosition.X; - x += Rand.Range(generationParams.MainPathNodeIntervalRange.X, generationParams.MainPathNodeIntervalRange.Y, false)) + for (float x = startPosition.X + Rand.Range(nodeInterval.X, nodeInterval.Y, false); + x < endPosition.X - Rand.Range(nodeInterval.X, nodeInterval.Y, false); + x += Rand.Range(nodeInterval.X, nodeInterval.Y, false)) { pathNodes.Add(new Vector2(x, Rand.Range(pathBorders.Y, pathBorders.Bottom, false))); } - pathNodes.Add(endPosition); pathNodes.Add(new Vector2(endPosition.X, borders.Height)); List> smallTunnels = new List>(); @@ -273,7 +272,7 @@ namespace Barotrauma sw2.Restart(); List mainPath = CaveGenerator.GeneratePath(pathNodes, cells, cellGrid, GridCellSize, - new Rectangle(pathBorders.X, pathBorders.Y, pathBorders.Width, borders.Height), 0.3f, mirror); + new Rectangle(pathBorders.X, pathBorders.Y, pathBorders.Width, borders.Height), 0.5f, mirror); for (int i = 2; i < mainPath.Count; i += 3) {