Level biomes (basically a way of categorizing level generation parameters). The single player map is now divided into biomes, meaning that specific types of levels are generated at different areas of the map.
TODO: more variety between biomes, assign the map biomes in a less random way (e.g. splotches of easier biomes connected by more dangerous ones, very dangerous biomes at the edges of the map...), option to select the biome in MP?
This commit is contained in:
@@ -209,8 +209,46 @@ namespace Barotrauma
|
||||
connection.CrackSegments = MathUtils.GenerateJaggedLine(start, end, generations, 5.0f);
|
||||
}
|
||||
|
||||
List<LocationConnection> biomeSeeds = new List<LocationConnection>();
|
||||
foreach (Biome biome in LevelGenerationParams.GetBiomes())
|
||||
{
|
||||
LocationConnection seed = connections[0];
|
||||
while (biomeSeeds.Contains(seed))
|
||||
{
|
||||
seed = connections[Rand.Range(0, connections.Count, Rand.RandSync.Server)];
|
||||
}
|
||||
seed.Biome = biome;
|
||||
biomeSeeds.Add(seed);
|
||||
}
|
||||
|
||||
ExpandBiomes(biomeSeeds);
|
||||
}
|
||||
|
||||
private void ExpandBiomes(List<LocationConnection> seeds)
|
||||
{
|
||||
List<LocationConnection> nextSeeds = new List<LocationConnection>();
|
||||
foreach (LocationConnection connection in seeds)
|
||||
{
|
||||
foreach (Location location in connection.Locations)
|
||||
{
|
||||
foreach (LocationConnection otherConnection in location.Connections)
|
||||
{
|
||||
if (otherConnection == connection) continue;
|
||||
if (otherConnection.Biome != null) continue; //already assigned
|
||||
|
||||
otherConnection.Biome = connection.Biome;
|
||||
nextSeeds.Add(otherConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nextSeeds.Count > 0)
|
||||
{
|
||||
ExpandBiomes(nextSeeds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void GenerateDifficulties(Location start, List<LocationConnection> locations, float currDifficulty)
|
||||
{
|
||||
//start.Difficulty = currDifficulty;
|
||||
@@ -258,6 +296,8 @@ namespace Barotrauma
|
||||
private Location[] locations;
|
||||
private Level level;
|
||||
|
||||
public Biome Biome;
|
||||
|
||||
public float Difficulty;
|
||||
|
||||
public List<Vector2[]> CrackSegments;
|
||||
|
||||
Reference in New Issue
Block a user