Example #1
0
        public static MapLayerBase GetLandformMapGen(long seed, NoiseClimate climateNoise, ICoreServerAPI api)
        {
            MapLayerBase landforms = new MapLayerLandforms(seed + 12, climateNoise, api);

            landforms.DebugDrawBitmap(DebugDrawMode.LandformRGB, 0, 0, "Landforms 1 - Wobble Landforms");

            return(landforms);
        }
Example #2
0
        public static MapLayerBase GetClimateMapGen(long seed, NoiseClimate climateNoise)
        {
            MapLayerBase climate = new MapLayerClimate(seed + 1, climateNoise);

            climate.DebugDrawBitmap(0, 0, 0, "Climate 1 - Noise");

            climate = new MapLayerPerlinWobble(seed + 2, climate, 6, 0.7f, TerraGenConfig.climateMapWobbleScale, TerraGenConfig.climateMapWobbleScale * 0.15f);
            climate.DebugDrawBitmap(0, 0, 0, "Climate 2 - Perlin Wobble");

            return(climate);
        }
Example #3
0
        public MapLayerLandforms(long seed, NoiseClimate climateNoise, ICoreServerAPI api) : base(seed)
        {
            this.climateNoise = climateNoise;
            noiseLandforms    = new NoiseLandforms(seed, api);

            int   woctaves     = 2;
            float wscale       = 2f * TerraGenConfig.landformMapScale;
            float wpersistence = 0.9f;

            wobbleIntensity = TerraGenConfig.landformMapScale * 1.5f;
            noisegenX       = NormalizedSimplexNoise.FromDefaultOctaves(woctaves, 1 / wscale, wpersistence, seed + 2);
            noisegenY       = NormalizedSimplexNoise.FromDefaultOctaves(woctaves, 1 / wscale, wpersistence, seed + 1231296);
        }
Example #4
0
        public MapLayerLandforms(long seed, NoiseClimate climateNoise, ICoreServerAPI api) : base(seed)
        {
            this.climateNoise = climateNoise;

            float scale = TerraGenConfig.landformMapScale;

            if (GameVersion.IsAtLeastVersion(api.WorldManager.SaveGame.CreatedGameVersion, "1.11.0-dev.1"))
            {
                scale *= Math.Max(1, api.WorldManager.MapSizeY / 256f);
            }

            noiseLandforms = new NoiseLandforms(seed, api, scale);

            int   woctaves     = 2;
            float wscale       = 2f * TerraGenConfig.landformMapScale;
            float wpersistence = 0.9f;

            wobbleIntensity = TerraGenConfig.landformMapScale * 1.5f;
            noisegenX       = NormalizedSimplexNoise.FromDefaultOctaves(woctaves, 1 / wscale, wpersistence, seed + 2);
            noisegenY       = NormalizedSimplexNoise.FromDefaultOctaves(woctaves, 1 / wscale, wpersistence, seed + 1231296);
        }
Example #5
0
        public void GameWorldLoaded()
        {
            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;
            //noiseSizeDepositDistortion = api.WorldManager.RegionSize / TerraGenConfig.depositDistortionscale;

            NoiseClimate noiseClimate = new NoiseClimate(seed);

            climateGen = GetClimateMap(seed + 1, noiseClimate);
            forestGen  = GetForestMap(seed + 2, TerraGenConfig.forestMapScale);
            bushGen    = GetForestMap(seed + 109, TerraGenConfig.shrubMapScale);
            flowerGen  = GetForestMap(seed + 223, TerraGenConfig.forestMapScale);
            //depositDistortionGen = GetDepositDistortionMap(seed + 123123);

            geologicprovinceGen = GetGeologicProvinceMap(seed + 3, api);
            landformsGen        = GetLandformMap(seed + 4, noiseClimate, api);
        }
 public MapLayerClimate(long seed, NoiseClimate map) : base(seed)
 {
     this.map = map;
 }
Example #7
0
        void GenMap(IServerPlayer player, CmdArgs arguments)
        {
            if (arguments.Length < 2)
            {
                player.SendMessage(groupId, "/wgen genmap [climate|forest|wind|gprov|landform|ore]", EnumChatType.CommandError);
                return;
            }

            int      seed = api.World.Seed;
            BlockPos pos  = player.Entity.ServerPos.XYZ.AsBlockPos;

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

            NoiseClimate noiseClimate = new NoiseClimate(seed);

            MapLayerBase climateGen          = GenMaps.GetClimateMap(seed + 1, noiseClimate);
            MapLayerBase forestGen           = GenMaps.GetForestMap(seed + 2, TerraGenConfig.forestMapScale);
            MapLayerBase bushGen             = GenMaps.GetForestMap(seed + 109, TerraGenConfig.shrubMapScale);
            MapLayerBase flowerGen           = GenMaps.GetForestMap(seed + 223, TerraGenConfig.forestMapScale);
            MapLayerBase geologicprovinceGen = GenMaps.GetGeologicProvinceMap(seed + 3, api);
            MapLayerBase landformsGen        = GenMaps.GetLandformMap(seed + 4, noiseClimate, api);

            int regionX = pos.X / api.WorldManager.RegionSize;
            int regionZ = pos.Z / api.WorldManager.RegionSize;



            NoiseBase.Debug = true;

            switch (arguments[1])
            {
            case "climate":
            {
                int startX = regionX * noiseSizeClimate - 256;
                int startZ = regionZ * noiseSizeClimate - 256;


                climateGen.DebugDrawBitmap(0, startX, startZ, "climatemap");
                player.SendMessage(groupId, "Climate map generated", EnumChatType.CommandSuccess);
            }
            break;

            case "forest":
            {
                //forestGen.SetInputMap(climateGen, new IntMap() { Size = 512 });

                // forestGen.DebugDrawBitmap(1, 0, 0, "Forest 1 - Forest");
                player.SendMessage(groupId, "Forest map gen not added yet", EnumChatType.CommandSuccess);
            }
            break;


            case "ore":
            {
                /*NoiseOre noiseOre = new NoiseOre(seed);
                 * MapLayerBase climate = GenMaps.GetOreMap(seed, noiseOre);
                 *
                 * climate.DebugDrawBitmap(0, 0, 0, 1024, "Ore 1 - Ore");
                 * player.SendMessage(groupId, "ore map generated", EnumChatType.CommandSuccess);*/
            }
            break;

            case "gprov":
            {
                int startX = regionX * noiseSizeGeoProv - 256;
                int startZ = regionZ * noiseSizeGeoProv - 256;

                geologicprovinceGen.DebugDrawBitmap(3, startX, startZ, "gprovmap");
                player.SendMessage(groupId, "Province map generated", EnumChatType.CommandSuccess);
                break;
            }

            case "landform":
            {
                int startX = regionX * noiseSizeLandform - 256;
                int startZ = regionZ * noiseSizeLandform - 256;

                landformsGen.DebugDrawBitmap(2, startX, startZ, "landformmap");
                player.SendMessage(groupId, "Landforms map generated", EnumChatType.CommandSuccess);
            }
            break;


            default:
                player.SendMessage(groupId, "/wgen testmap [climate|forest|wind|gprov]", EnumChatType.CommandError);
                break;
            }


            NoiseBase.Debug = false;
        }
Example #8
0
        void TestMap(IServerPlayer player, CmdArgs arguments)
        {
            if (arguments.Length < 2)
            {
                player.SendMessage(groupId, "/wgen testmap [climate|forest|wind|gprov|landform|ore]", EnumChatType.CommandError);
                return;
            }

            Random rnd  = new Random();
            long   seed = rnd.Next();

            switch (arguments[1])
            {
            case "climate":
            {
                NoiseBase.Debug = true;
                NoiseClimate noiseClimate = new NoiseClimate(seed);
                MapLayerBase climate      = GenMaps.GetClimateMap(seed, noiseClimate);
                player.SendMessage(groupId, "Climate map generated", EnumChatType.CommandSuccess);
            }
            break;

            case "forest":
            {
                NoiseBase.Debug = false;
                NoiseClimate noiseClimate = new NoiseClimate(seed);
                MapLayerBase climate      = GenMaps.GetClimateMap(seed, noiseClimate);
                MapLayerBase forest       = GenMaps.GetForestMap(seed + 1, TerraGenConfig.forestMapScale);

                IntMap climateMap = new IntMap()
                {
                    Data = climate.GenLayer(0, 0, 512, 512), Size = 512
                };

                forest.SetInputMap(climateMap, new IntMap()
                    {
                        Size = 512
                    });

                NoiseBase.Debug = true;
                forest.DebugDrawBitmap(1, 0, 0, "Forest 1 - Forest");
                player.SendMessage(groupId, "Forest map generated", EnumChatType.CommandSuccess);
            }
            break;


            case "ore":
            {
                NoiseBase.Debug = false;
                NoiseOre     noiseOre = new NoiseOre(seed);
                MapLayerBase climate  = GenMaps.GetOreMap(seed, noiseOre);
                NoiseBase.Debug = true;
                climate.DebugDrawBitmap(0, 0, 0, 1024, "Ore 1 - Ore");
                player.SendMessage(groupId, "ore map generated", EnumChatType.CommandSuccess);
            }
            break;

            case "wind":
                NoiseBase.Debug = true;
                NoiseBase wind = GenMaps.GetDebugWindMap(seed);
                player.SendMessage(groupId, "Wind map generated", EnumChatType.CommandSuccess);
                break;

            case "gprov":
                NoiseBase.Debug = true;
                MapLayerBase provinces = GenMaps.GetGeologicProvinceMap(seed, api);

                player.SendMessage(groupId, "Province map generated", EnumChatType.CommandSuccess);
                break;

            case "landform":
            {
                NoiseBase.Debug = true;
                NoiseClimate noiseClimate = new NoiseClimate(seed);
                MapLayerBase landforms    = GenMaps.GetLandformMap(seed + 1, noiseClimate, api);

                player.SendMessage(groupId, "Landforms map generated", EnumChatType.CommandSuccess);
            }
            break;


            default:
                player.SendMessage(groupId, "/wgen testmap [climate|forest|wind|gprov]", EnumChatType.CommandError);
                break;
            }

            NoiseBase.Debug = false;
        }