Contains parameters for advanced map generation.
Inheritance: MapGeneratorParameters
Beispiel #1
0
        public RealisticMapGenState( [NotNull] RealisticMapGenParameters genParameters ) {
            if( genParameters == null ) throw new ArgumentNullException( "genParameters" );
            genParams = genParameters;
            genParams.Validate();
            Parameters = genParameters;

            if( !genParams.CustomWaterLevel ) {
                genParams.WaterLevel = (genParams.MapHeight - 1) / 2;
            }

            rand = new Random( genParams.Seed );
            noise = new Noise( genParams.Seed, NoiseInterpolationMode.Bicubic );
            EstimateComplexity();

            ReportsProgress = true;
            SupportsCancellation = true;
        }
Beispiel #2
0
        public RealisticMapGenState([NotNull] RealisticMapGenParameters genParameters)
        {
            if (genParameters == null)
            {
                throw new ArgumentNullException("genParameters");
            }
            genParams = genParameters;
            genParams.Validate();
            Parameters = genParameters;

            if (!genParams.CustomWaterLevel)
            {
                genParams.WaterLevel = (genParams.MapHeight - 1) / 2;
            }

            rand  = new Random(genParams.Seed);
            noise = new Noise(genParams.Seed, NoiseInterpolationMode.Bicubic);
            EstimateComplexity();

            ReportsProgress      = true;
            SupportsCancellation = true;
        }
Beispiel #3
0
 public override void SetParameters(MapGeneratorParameters generatorParameters) {
     genParameters = (RealisticMapGenParameters)generatorParameters;
     LoadGeneratorArgs();
 }
Beispiel #4
0
 void SaveGeneratorArgs() {
     genParameters = new RealisticMapGenParameters {
         DetailScale = sDetailScale.Value,
         FeatureScale = sFeatureScale.Value,
         MapHeight = mapHeight,
         MapWidth = mapWidth,
         MapLength = mapLength,
         LayeredHeightmap = xLayeredHeightmap.Checked,
         MarbledHeightmap = xMarbledMode.Checked,
         MatchWaterCoverage = xMatchWaterCoverage.Checked,
         MaxDepth = (int)nMaxDepth.Value,
         MaxHeight = (int)nMaxHeight.Value,
         AddTrees = xAddTrees.Checked,
         AddGiantTrees = xGiantTrees.Checked,
         Roughness = sRoughness.Value/100f,
         Seed = (int)nSeed.Value,
         Theme = new RealisticMapGenBlockTheme((MapGenTheme)cTheme.SelectedIndex),
         TreeHeightMax = (int)(nTreeHeight.Value + nTreeHeightVariation.Value),
         TreeHeightMin = (int)(nTreeHeight.Value - nTreeHeightVariation.Value),
         TreeSpacingMax = (int)(nTreeSpacing.Value + nTreeSpacingVariation.Value),
         TreeSpacingMin = (int)(nTreeSpacing.Value - nTreeSpacingVariation.Value),
         UseBias = (sBias.Value != 0),
         DelayBias = xDelayBias.Checked,
         WaterCoverage = sWaterCoverage.Value/100f,
         Bias = sBias.Value/100f,
         MidPoint = cMidpoint.SelectedIndex - 1,
         RaisedCorners = (int)nRaisedCorners.Value,
         LoweredCorners = (int)nLoweredCorners.Value,
         InvertHeightmap = xInvert.Checked,
         AddWater = xAddWater.Checked,
         AddCaves = xAddCaves.Checked,
         AddOre = xAddOre.Checked,
         AddCaveLava = xCaveLava.Checked,
         AddCaveWater = xCaveWater.Checked,
         CaveDensity = sCaveDensity.Value/100f,
         CaveSize = sCaveSize.Value/100f,
         CustomWaterLevel = xWaterLevel.Checked,
         WaterLevel = (xWaterLevel.Checked ? (int)nWaterLevel.Value : mapHeight/2),
         AddSnow = xAddSnow.Checked,
         SnowTransition = (int)nSnowTransition.Value,
         SnowAltitude = (int)nSnowAltitude.Value + (xWaterLevel.Checked ? (int)nWaterLevel.Value : mapHeight/2),
         AddCliffs = xAddCliffs.Checked,
         CliffThreshold = sCliffThreshold.Value/100f,
         CliffSmoothing = xCliffSmoothing.Checked,
         AddBeaches = xAddBeaches.Checked,
         BeachExtent = (int)nBeachExtent.Value,
         BeachHeight = (int)nBeachHeight.Value,
         AboveFuncExponent = TrackBarToExponent(sAboveFunc),
         BelowFuncExponent = TrackBarToExponent(sBelowFunc),
         MaxHeightVariation = (int)nMaxHeightVariation.Value,
         MaxDepthVariation = (int)nMaxDepthVariation.Value,
         AddFloodBarrier = xAddFloodBarrier.Checked
     };
 }
Beispiel #5
0
        public static RealisticMapGenParameters CreateParameters(RealisticMapGenTerrainType terrainType,
                                                                 MapGenTheme theme)
        {
            RealisticMapGenParameters genParams;

            switch (terrainType)
            {
            case RealisticMapGenTerrainType.Archipelago:
                genParams = new RealisticMapGenParameters {
                    MaxHeight          = 8,
                    MaxDepth           = 20,
                    FeatureScale       = 3,
                    Roughness          = .46f,
                    MatchWaterCoverage = true,
                    WaterCoverage      = .85f
                };
                break;

            case RealisticMapGenTerrainType.Atoll:
                genParams = new RealisticMapGenParameters {
                    Theme              = new RealisticMapGenBlockTheme(MapGenTheme.Desert),
                    MaxHeight          = 2,
                    MaxDepth           = 39,
                    UseBias            = true,
                    Bias               = .9f,
                    MidPoint           = 1,
                    LoweredCorners     = 4,
                    FeatureScale       = 2,
                    DetailScale        = 5,
                    MarbledHeightmap   = true,
                    InvertHeightmap    = true,
                    MatchWaterCoverage = true,
                    WaterCoverage      = .95f
                };
                break;

            case RealisticMapGenTerrainType.Bay:
                genParams = new RealisticMapGenParameters {
                    MaxHeight        = 22,
                    MaxDepth         = 12,
                    UseBias          = true,
                    Bias             = 1,
                    MidPoint         = -1,
                    RaisedCorners    = 3,
                    LoweredCorners   = 1,
                    TreeSpacingMax   = 12,
                    TreeSpacingMin   = 6,
                    MarbledHeightmap = true,
                    DelayBias        = true
                };
                break;

            case RealisticMapGenTerrainType.Dunes:
                genParams = new RealisticMapGenParameters {
                    AddTrees         = false,
                    AddWater         = false,
                    Theme            = new RealisticMapGenBlockTheme(MapGenTheme.Desert),
                    MaxHeight        = 12,
                    MaxDepth         = 7,
                    FeatureScale     = 2,
                    DetailScale      = 3,
                    Roughness        = .44f,
                    MarbledHeightmap = true,
                    InvertHeightmap  = true
                };
                break;

            case RealisticMapGenTerrainType.Hills:
                genParams = new RealisticMapGenParameters {
                    AddWater       = false,
                    MaxHeight      = 8,
                    MaxDepth       = 8,
                    FeatureScale   = 2,
                    TreeSpacingMin = 7,
                    TreeSpacingMax = 13
                };
                break;

            case RealisticMapGenTerrainType.Ice:
                genParams = new RealisticMapGenParameters {
                    Theme              = new RealisticMapGenBlockTheme(MapGenTheme.Arctic),
                    AddTrees           = false,
                    MaxHeight          = 2,
                    MaxDepth           = 2032,
                    FeatureScale       = 2,
                    DetailScale        = 7,
                    Roughness          = .64f,
                    MarbledHeightmap   = true,
                    MatchWaterCoverage = true,
                    WaterCoverage      = .3f,
                    MaxHeightVariation = 0
                };
                break;

            case RealisticMapGenTerrainType.Island:
                genParams = new RealisticMapGenParameters {
                    MaxHeight        = 16,
                    MaxDepth         = 39,
                    UseBias          = true,
                    Bias             = .7f,
                    MidPoint         = 1,
                    LoweredCorners   = 4,
                    FeatureScale     = 3,
                    DetailScale      = 7,
                    MarbledHeightmap = true,
                    DelayBias        = true,
                    AddBeaches       = true,
                    Roughness        = 0.45f
                };
                break;

            case RealisticMapGenTerrainType.Lake:
                genParams = new RealisticMapGenParameters {
                    MaxHeight          = 14,
                    MaxDepth           = 20,
                    UseBias            = true,
                    Bias               = .65f,
                    MidPoint           = -1,
                    RaisedCorners      = 4,
                    FeatureScale       = 2,
                    Roughness          = .56f,
                    MatchWaterCoverage = true,
                    WaterCoverage      = .3f
                };
                break;

            case RealisticMapGenTerrainType.Mountains:
                genParams = new RealisticMapGenParameters {
                    AddWater           = false,
                    MaxHeight          = 40,
                    MaxDepth           = 10,
                    FeatureScale       = 1,
                    DetailScale        = 7,
                    MarbledHeightmap   = true,
                    AddSnow            = true,
                    MatchWaterCoverage = true,
                    WaterCoverage      = .5f,
                    Roughness          = .55f,
                    CliffThreshold     = .9f
                };
                break;

            case RealisticMapGenTerrainType.Defaults:
                genParams = new RealisticMapGenParameters();
                break;

            case RealisticMapGenTerrainType.River:
                genParams = new RealisticMapGenParameters {
                    MaxHeight          = 22,
                    MaxDepth           = 8,
                    FeatureScale       = 0,
                    DetailScale        = 6,
                    MarbledHeightmap   = true,
                    MatchWaterCoverage = true,
                    WaterCoverage      = .31f
                };
                break;

            case RealisticMapGenTerrainType.Streams:
                genParams = new RealisticMapGenParameters {
                    MaxHeight          = 5,
                    MaxDepth           = 4,
                    FeatureScale       = 2,
                    DetailScale        = 7,
                    Roughness          = .55f,
                    MarbledHeightmap   = true,
                    MatchWaterCoverage = true,
                    WaterCoverage      = .25f,
                    TreeSpacingMin     = 8,
                    TreeSpacingMax     = 14
                };
                break;

            case RealisticMapGenTerrainType.Peninsula:
                genParams = new RealisticMapGenParameters {
                    MaxHeight       = 22,
                    MaxDepth        = 12,
                    UseBias         = true,
                    Bias            = .5f,
                    MidPoint        = -1,
                    RaisedCorners   = 3,
                    LoweredCorners  = 1,
                    TreeSpacingMax  = 12,
                    TreeSpacingMin  = 6,
                    InvertHeightmap = true,
                    WaterCoverage   = .5f
                };
                break;

            case RealisticMapGenTerrainType.Flat:
                genParams = new RealisticMapGenParameters {
                    MaxHeight          = 0,
                    MaxDepth           = 0,
                    MaxHeightVariation = 0,
                    AddWater           = false,
                    DetailScale        = 0,
                    FeatureScale       = 0,
                    AddCliffs          = false
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("terrainType");
            }

            genParams.Theme = new RealisticMapGenBlockTheme(theme);
            switch (theme)
            {
            case MapGenTheme.Arctic:
            case MapGenTheme.Desert:
            case MapGenTheme.Grass:
            case MapGenTheme.Hell:
                genParams.AddTrees = false;
                break;
            }
            return(genParams);
        }
Beispiel #6
0
        public static RealisticMapGenParameters CreateParameters( RealisticMapGenTerrainType terrainType,
                                                                  MapGenTheme theme ) {
            RealisticMapGenParameters genParams;
            switch( terrainType ) {
                case RealisticMapGenTerrainType.Archipelago:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 8,
                        MaxDepth = 20,
                        FeatureScale = 3,
                        Roughness = .46f,
                        MatchWaterCoverage = true,
                        WaterCoverage = .85f
                    };
                    break;

                case RealisticMapGenTerrainType.Atoll:
                    genParams = new RealisticMapGenParameters {
                        Theme = new RealisticMapGenBlockTheme( MapGenTheme.Desert ),
                        MaxHeight = 2,
                        MaxDepth = 39,
                        UseBias = true,
                        Bias = .9f,
                        MidPoint = 1,
                        LoweredCorners = 4,
                        FeatureScale = 2,
                        DetailScale = 5,
                        MarbledHeightmap = true,
                        InvertHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .95f
                    };
                    break;

                case RealisticMapGenTerrainType.Bay:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 22,
                        MaxDepth = 12,
                        UseBias = true,
                        Bias = 1,
                        MidPoint = -1,
                        RaisedCorners = 3,
                        LoweredCorners = 1,
                        TreeSpacingMax = 12,
                        TreeSpacingMin = 6,
                        MarbledHeightmap = true,
                        DelayBias = true
                    };
                    break;

                case RealisticMapGenTerrainType.Dunes:
                    genParams = new RealisticMapGenParameters {
                        AddTrees = false,
                        AddWater = false,
                        Theme = new RealisticMapGenBlockTheme( MapGenTheme.Desert ),
                        MaxHeight = 12,
                        MaxDepth = 7,
                        FeatureScale = 2,
                        DetailScale = 3,
                        Roughness = .44f,
                        MarbledHeightmap = true,
                        InvertHeightmap = true
                    };
                    break;

                case RealisticMapGenTerrainType.Hills:
                    genParams = new RealisticMapGenParameters {
                        AddWater = false,
                        MaxHeight = 8,
                        MaxDepth = 8,
                        FeatureScale = 2,
                        TreeSpacingMin = 7,
                        TreeSpacingMax = 13
                    };
                    break;

                case RealisticMapGenTerrainType.Ice:
                    genParams = new RealisticMapGenParameters {
                        Theme = new RealisticMapGenBlockTheme( MapGenTheme.Arctic ),
                        AddTrees = false,
                        MaxHeight = 2,
                        MaxDepth = 2032,
                        FeatureScale = 2,
                        DetailScale = 7,
                        Roughness = .64f,
                        MarbledHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .3f,
                        MaxHeightVariation = 0
                    };
                    break;

                case RealisticMapGenTerrainType.Island:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 16,
                        MaxDepth = 39,
                        UseBias = true,
                        Bias = .7f,
                        MidPoint = 1,
                        LoweredCorners = 4,
                        FeatureScale = 3,
                        DetailScale = 7,
                        MarbledHeightmap = true,
                        DelayBias = true,
                        AddBeaches = true,
                        Roughness = 0.45f
                    };
                    break;

                case RealisticMapGenTerrainType.Lake:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 14,
                        MaxDepth = 20,
                        UseBias = true,
                        Bias = .65f,
                        MidPoint = -1,
                        RaisedCorners = 4,
                        FeatureScale = 2,
                        Roughness = .56f,
                        MatchWaterCoverage = true,
                        WaterCoverage = .3f
                    };
                    break;

                case RealisticMapGenTerrainType.Mountains:
                    genParams = new RealisticMapGenParameters {
                        AddWater = false,
                        MaxHeight = 40,
                        MaxDepth = 10,
                        FeatureScale = 1,
                        DetailScale = 7,
                        MarbledHeightmap = true,
                        AddSnow = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .5f,
                        Roughness = .55f,
                        CliffThreshold = .9f
                    };
                    break;

                case RealisticMapGenTerrainType.Defaults:
                    genParams = new RealisticMapGenParameters();
                    break;

                case RealisticMapGenTerrainType.River:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 22,
                        MaxDepth = 8,
                        FeatureScale = 0,
                        DetailScale = 6,
                        MarbledHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .31f
                    };
                    break;

                case RealisticMapGenTerrainType.Streams:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 5,
                        MaxDepth = 4,
                        FeatureScale = 2,
                        DetailScale = 7,
                        Roughness = .55f,
                        MarbledHeightmap = true,
                        MatchWaterCoverage = true,
                        WaterCoverage = .25f,
                        TreeSpacingMin = 8,
                        TreeSpacingMax = 14
                    };
                    break;

                case RealisticMapGenTerrainType.Peninsula:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 22,
                        MaxDepth = 12,
                        UseBias = true,
                        Bias = .5f,
                        MidPoint = -1,
                        RaisedCorners = 3,
                        LoweredCorners = 1,
                        TreeSpacingMax = 12,
                        TreeSpacingMin = 6,
                        InvertHeightmap = true,
                        WaterCoverage = .5f
                    };
                    break;

                case RealisticMapGenTerrainType.Flat:
                    genParams = new RealisticMapGenParameters {
                        MaxHeight = 0,
                        MaxDepth = 0,
                        MaxHeightVariation = 0,
                        AddWater = false,
                        DetailScale = 0,
                        FeatureScale = 0,
                        AddCliffs = false
                    };
                    break;

                default:
                    throw new ArgumentOutOfRangeException( "terrainType" );
            }

            genParams.Theme = new RealisticMapGenBlockTheme( theme );
            switch( theme ) {
                case MapGenTheme.Arctic:
                case MapGenTheme.Desert:
                case MapGenTheme.Grass:
                case MapGenTheme.Hell:
                    genParams.AddTrees = false;
                    break;
            }
            return genParams;
        }