public MapLayerPerlinWobble(long seed, MapLayerBase parent, int octaves, float persistence, float scale, float intensity = 1) : base(seed, parent)
        {
            noisegenX = NormalizedSimplexNoise.FromDefaultOctaves(octaves, 1 / scale, persistence, seed);
            noisegenY = NormalizedSimplexNoise.FromDefaultOctaves(octaves, 1 / scale, persistence, seed + 1231296);

            this.scale     = scale;
            this.intensity = intensity;
        }
        public MapLayerBlur(long seed, MapLayerBase parent, int range) : base(seed)
        {
            if ((range & 1) == 0)
            {
                throw new InvalidOperationException("Range must be odd!");
            }

            this.parent = parent;
            this.range  = range;
        }
        public static MapLayerBase magnify(long seed, MapLayerBase parent, int zoomLevels)
        {
            MapLayerBase genlayer = parent;

            for (int i = 0; i < zoomLevels; ++i)
            {
                genlayer = new MapLayerFuzzyZoom(seed + i, genlayer);
            }


            return(genlayer);
        }
示例#4
0
        public void initWorldGen()
        {
            long seed = api.WorldManager.Seed;

            noiseSizeClimate  = api.WorldManager.RegionSize / TerraGenConfig.climateMapScale;
            noiseSizeForest   = api.WorldManager.RegionSize / TerraGenConfig.forestMapScale;
            noiseSizeShrubs   = api.WorldManager.RegionSize / TerraGenConfig.shrubMapScale;
            noiseSizeGeoProv  = api.WorldManager.RegionSize / TerraGenConfig.geoProvMapScale;
            noiseSizeLandform = api.WorldManager.RegionSize / TerraGenConfig.landformMapScale;
            noiseSizeBeach    = api.WorldManager.RegionSize / TerraGenConfig.beachMapScale;

            ITreeAttribute worldConfig = api.WorldManager.SaveGame.WorldConfiguration;
            string         climate     = worldConfig.GetString("worldClimate");
            NoiseClimate   noiseClimate;

            float tempModifier = 1;

            float.TryParse(worldConfig.GetString("globalTemperature", "1"), NumberStyles.Any, GlobalConstants.DefaultCultureInfo, out tempModifier);
            float rainModifier = 1;

            float.TryParse(worldConfig.GetString("globalPrecipitation", "1"), NumberStyles.Any, GlobalConstants.DefaultCultureInfo, out rainModifier);

            switch (climate)
            {
            case "realistic":
                noiseClimate = new NoiseClimateRealistic(seed, (double)api.WorldManager.MapSizeZ / TerraGenConfig.climateMapScale / TerraGenConfig.climateMapSubScale);
                break;

            default:
                noiseClimate = new NoiseClimatePatchy(seed);
                break;
            }

            noiseClimate.rainMul = rainModifier;
            noiseClimate.tempMul = tempModifier;

            // dominionsmod
            worldMap = new WorldMap(api);

            climateGen = GetClimateMapGen(seed + 1, noiseClimate);
            forestGen  = GetForestMapGen(seed + 2, TerraGenConfig.forestMapScale);
            bushGen    = GetForestMapGen(seed + 109, TerraGenConfig.shrubMapScale);
            flowerGen  = GetForestMapGen(seed + 223, TerraGenConfig.forestMapScale);
            beachGen   = GetBeachMapGen(seed + 2273, TerraGenConfig.beachMapScale);

            geologicprovinceGen = GetGeologicProvinceMapGen(seed + 3, api);
            landformsGen        = GetLandformMapGen(seed + 4, noiseClimate, api);
        }
 public MapLayerTransformBase(long seed, MapLayerBase parent) : base(seed)
 {
     this.parent = parent;
 }
 public MapLayerFuzzyZoom(long currentSeed, MapLayerBase parent) : base(currentSeed)
 {
     this.parent = parent;
 }
示例#7
0
 public MapLayerExactZoom(MapLayerBase parent, int zoomLevel) : base(0)
 {
     this.parent    = parent;
     this.zoomLevel = zoomLevel;
 }