コード例 #1
0
        private void generate(Stopwatch watcher)
        {
            Random.Seed(Options.MapSeed);

            biomesData = Map5BiomesSystem.applyDefaultBiomesSystem();
            nameBases  = NamesGenerator.getNameBases();
            Names      = new NamesGenerator(this);
            Routes     = new Map6Routes(this);

            grid = new Grid();
            _placePoints();
            Debug.Log($"1 placePoints {Random.NextDouble()} number:{Options.PointsNumber} => points:{grid.points.Count}");

            _calculateVoronoi(grid, grid.points, grid.boundary);
            Debug.Log($"2 calculateVoronoi {Random.NextDouble()}");

            new HeightmapGenerator(this).generate();
            Debug.Log($"3 HeightmapGenerator {Random.NextDouble()}");

            var feature = new Map1Features(this);

            feature.markFeatures();
            Debug.Log($"4 markFeatures {Random.NextDouble()}");

            feature.openNearSeaLakes();
            Debug.Log($"5 openNearSeaLakes {Random.NextDouble()}");

            map1OceanLayers = new Map1OceanLayers(this);
            map1OceanLayers.generate();
            Debug.Log($"6 Map1OceanLayers {Random.NextDouble()}");

            double mapSize = 0, latitude = 0;

            defineMapSize(Options.MapTemplate, grid, ref mapSize, ref latitude);
            Debug.Log($"7 defineMapSize {Random.NextDouble()}");

            mapCoordinates = calculateMapCoordinates(Options.Width, Options.Height, mapSize, latitude);
            Debug.Log($"8 calculateMapCoordinates {Random.NextDouble()}");

            map1Temperatures = new Map1Temperatures(this);
            map1Temperatures.calculateTemperatures();
            //Debug.SaveArray("temp.txt", grid.cells.temp);
            map1Temperatures.generate();
            Debug.Log($"9 calculateTemperatures {Random.NextDouble()} {Options.TemperatureEquator.value} {Options.TemperaturePoleInput} {Options.HeightExponentInput}");

            map2Precipitation = new Map2Precipitation(this);
            map2Precipitation.generatePrecipitation();
            Debug.Log("map2Precipitation winds => " + Debug.toString(Options.WindsInput));
            Debug.Log($"10 generatePrecipitation {Random.NextDouble()} modifier:{Options.PrecipitationInput / 100d}");
            //Debug.SaveArray("prec.txt", grid.cells.prec);
            //Debug.SaveArray("grid.cells.h.txt", grid.cells.h);

            pack = new Grid();
            reGraph();
            Debug.Log($"11 reGraph {Random.NextDouble()}");
            //Debug.SaveArray("pack.cells.area.txt", pack.cells.area);

            new Map3Features(this).reMarkFeatures();

            map4Coastline = new Map4Coastline(this);
            map4Coastline.generate();
            Debug.Log($"12 drawCoastline {Random.NextDouble()}");

            new Map4Lakes(this).elevateLakes();
            Debug.Log($"13 elevateLakes {Random.NextDouble()}");
            //Debug.SaveArray("Map4Lakes.h.txt", pack.cells.r_height);

            Random.Seed(Options.MapSeed);
            var rivers = new Map4Rivers(this);

            rivers.generate();
            Debug.Log($"14 Map4Rivers {Random.NextDouble()}");

            map5Biomes = new Map5BiomesSystem(this);
            map5Biomes.defineBiomes();
            Debug.Log($"15 defineBiomes {Random.NextDouble()}");

            map5Biomes.rankCells();
            map5Biomes.generate();
            //Debug.SaveArray("pack.cells.biome.txt", pack.cells.biome);
            //Debug.SaveArray("pack.cells.s.txt", pack.cells.s);
            //Debug.SaveArray("pack.cells.pop.txt", pack.cells.pop);
            Debug.Log($"16 rankCells {Random.NextDouble()} rankCells: {elapsed(watcher)}ms");

            map5Cultures = new Map5Cultures(this);
            map5Cultures.generate();
            Debug.Log($"17 Cultures {Random.NextDouble()} cultures.generate: {elapsed(watcher)}ms");

            map5Cultures.expand();
            Debug.Log($"18 Cultures.expand {Random.NextDouble()} neutralInput:{Options.NeutralInput}");
            //Debug.SaveArray("pack.cells.culture.txt", pack.cells.culture);

            var burgs = map6BurgsAndStates = new Map6BurgsAndStates(this);

            burgs.generate();
            Debug.Log($"19 Map6BurgsAndStates.generate {Random.NextDouble()} {elapsed(watcher)}ms");

            map6Religions = new Map6Religions(this);
            map6Religions.generate();
            Debug.Log($"20 Map6Religions.generate {Random.NextDouble()} {elapsed(watcher)}ms");

            burgs.defineStateForms();
            burgs.generateProvinces();
            burgs.defineBurgFeatures();
            Debug.Log($"21 Map6BurgsAndStates.defineBurgFeatures {Random.NextDouble()} {elapsed(watcher)}ms");

            burgs.generateProvincesPath();
            burgs.generateStatesPath();
            burgs.generateStateLabels();
            burgs.generateBorders();
            Debug.Log($"22 Map6BurgsAndStates.drawStateLabels {Random.NextDouble()} {elapsed(watcher)}ms");
        }