Contains parameters for advanced map generation.
Inheritance: MapGeneratorParameters
Ejemplo n.º 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;
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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;
        }