Пример #1
0
        /// <summary>
        /// The actual world generation process
        /// </summary>
        protected override void DoOperation()
        {
            // Generate empty world object
            var world = new World(this.WorldDimensions, this.Seed);

            this.SignalNextStage("Generating height map..", 0.0);
            var heightMap = new HeightMap(this.WorldDimensions, this.Seed, this.Parameters);

            this.SignalNextStage("Generating temperature map..", 0.25);
            var temperatureMap = new TemperatureMap(this.WorldDimensions, this.Seed, this.Parameters, heightMap);

            this.SignalNextStage("Generating drainage map..", 0.30);
            var drainageMap = new DrainageMap(this.WorldDimensions, this.Seed, this.Parameters, heightMap);

            this.SignalNextStage("Generating rainfall map..", 0.45);
            var rainfallMap = new RainfallMap(this.WorldDimensions, this.Seed, this.Parameters, heightMap);

            // Generate rivers, readjust rainfall map and rebuild levels
            this.SignalNextStage("Generating biomes..", 0.60);
            var biomeMapper = new BiomeMapper(this.WorldDimensions, this.Seed, heightMap, rainfallMap, drainageMap, temperatureMap);

            this.SignalNextStage("Generating rivers..", 0.70);
            var riverGenerator = new RiverGenerator(this.WorldDimensions, this.Seed, heightMap, temperatureMap, rainfallMap, biomeMapper.TerrainTypes);

            riverGenerator.GenerateRivers();

            this.SignalNextStage("Placing resources..", 0.75);
            var resourceGenerator = new ResourceGenerator(this.WorldDimensions, this.Seed, biomeMapper.TerrainTypes, this.Parameters);

            this.SignalNextStage("Storing data..", 0.80);
            world.DetailedMap.Temperature   = temperatureMap.TemperatureTiles;
            world.DetailedMap.Drainage      = drainageMap.DrainageTiles;
            world.DetailedMap.Rainfall      = rainfallMap.RainfallTiles;
            world.DetailedMap.Terrain       = biomeMapper.TerrainTypes;
            world.DetailedMap.RiverTileInfo = riverGenerator.RiverTileInfo;
            world.DetailedMap.Resources     = resourceGenerator.Resources;

            this.SignalNextStage("Updating terrain tiles..", 0.85);
            world.UpdateTiles();

            this.SignalNextStage("Finding start continent..", 0.90);
            world.DiscoverInitialContinent();

            this.SignalNextStage("Building overview map..", 1.0);
            world.BuildOverview();



            // Signal that world generation has finished
            this.SignalFinished(world);
        }
Пример #2
0
        /// <summary>
        /// Construct a new biome mapper instance.
        /// </summary>
        public BiomeMapper(Size dimensions, int seed, HeightMap elevation, RainfallMap rainfall, DrainageMap drainage,
                           TemperatureMap temperature)
        {
            this.Seed        = seed;
            this.Dimensions  = dimensions;
            this.Elevation   = elevation;
            this.Rainfall    = rainfall;
            this.Drainage    = drainage;
            this.Temperature = temperature;

            this.TerrainTypes = new TerrainType[dimensions.Width, dimensions.Height];

            this.MapBiomes();
        }