コード例 #1
0
        public static void Generate()
        {
            //while (true)
            //    Test.Show(RenderNoiseBmp(500, 500));
            while (true)
            {
                int seed = Environment.TickCount;
                seed = new Random().Next(8, 16777216); // 16777216 = 8^8
                DateTime asdf = System.DateTime.Now;
                seed = asdf.Millisecond + asdf.Minute + asdf.Hour + asdf.Year;
                Random     rand = new Random(seed);
                PolygonMap map  = new PolygonMap(rand.Next());

                Console.Out.WriteLine("Generating map...");
                map.Generate(Size * 15);

                Console.Out.WriteLine("Creating terrain...");
                var dat = CreateTerrain(rand.Next(), map);

                Console.Out.WriteLine("Computing biomes...");
                new Biome(rand.Next(), map).ComputeBiomes(dat);


                new TerrainDisplay(dat).ShowDialog();
                //Test.Show(RenderMoistBmp(dat));
                //Test.Show(RenderEvalBmp(dat));

                map = null;
                dat = null;
                GC.WaitForFullGCComplete(-1);
                GC.Collect();
            }
        }
コード例 #2
0
ファイル: Terrain.cs プロジェクト: Zeroeh/PrivateServerOld
        public const int Size = 1024; //Size of world maps

        #endregion Fields

        #region Methods

        public static void Generate()
        {
            //while (true)
            //    Test.Show(RenderNoiseBmp(500, 500));
            while (true)
            {
            int seed = Environment.TickCount;
            seed = new Random().Next(8, 16777216); // 16777216 = 8^8
            DateTime asdf = System.DateTime.Now;
            seed = asdf.Millisecond + asdf.Minute + asdf.Hour + asdf.Year;
            Random rand = new Random(seed);
            PolygonMap map = new PolygonMap(rand.Next());

            Console.Out.WriteLine("Generating map...");
            map.Generate(Size * 15);

            Console.Out.WriteLine("Creating terrain...");
            var dat = CreateTerrain(rand.Next(), map);

            Console.Out.WriteLine("Computing biomes...");
            new Biome(rand.Next(), map).ComputeBiomes(dat);

            new TerrainDisplay(dat).ShowDialog();
            //Test.Show(RenderMoistBmp(dat));
            //Test.Show(RenderEvalBmp(dat));

            map = null;
            dat = null;
            GC.WaitForFullGCComplete(-1);
            GC.Collect();
            }
        }