public void run(List <string> input) { if (input.Count > 0) { WorldStorage.SaveName = input[0]; Server.Load(); WorldGenerationSettings wset = SettingsHandler.WorldGenerationSettings.Settings; Util.WriteLine("Generating world!"); World.Initialize(wset.DimensionWidth, wset.DimensionHeight, new GrassAndDirt(0)); Util.WriteLine("World generated!"); Util.WriteLine("Initializing networking!"); int port = SettingsHandler.NetworkSettings.Settings.Port; ServerSendRecieve.Initialize(new NetworkSettings(port)); ServerSendRecieve.TCPServer.Server.ClientConnected += Server_ClientConnected; ServerSendRecieve.TCPServer.Server.ClientDisconnected += Server_ClientDisconnected; Util.WriteLine("Done!"); } else { Util.WriteLine("Invalid command parameters"); } }
public void Run(List <string> input) { if (input.Count > 0) { World.Mode = EngineMode.ServerOnly; WorldStorage.SaveName = input[0]; Server.Load(); WorldGenerationSettings wset = SettingsHandler.WorldGenerationSettings.Settings; Util.WriteLine(DedicatedServer.GeneratingWorld); World.Initialize(wset.DimensionWidth, wset.DimensionHeight, WorldGeneratorRegistry.Generators[0], "Main"); Util.WriteLine(DedicatedServer.WorldGenerated); Util.WriteLine(DedicatedServer.InitializingNetwork); int port = SettingsHandler.NetworkSettings.Settings.Port; ServerSendRecieve.Initialize(new NetworkSettings(port)); ServerSendRecieve.TCPServer.Server.ClientConnected += Server_ClientConnected; ServerSendRecieve.TCPServer.Server.ClientDisconnected += Server_ClientDisconnected; Util.WriteLine(DedicatedServer.Done); } else { Util.WriteLine(DedicatedServer.InvalidCommandParameters); } }
/// <summary> /// Creates a new world /// </summary> /// <param name="settings">Settings to generate the world with</param> public GameWorld(WorldGenerationSettings settings) : this() { PlayerSpecies = CreatePlayerSpecies(); Map = PatchMapGenerator.Generate(settings, PlayerSpecies); if (!Map.Verify()) { throw new ArgumentException("generated patch map with settings is not valid"); } // Apply initial populations Map.UpdateGlobalPopulations(); }
public void run(List <string> input) { Server.Load(); WorldGenerationSettings wset = SettingsHandler.WorldGenerationSettings.Settings; Util.WriteLine("Generating world!"); World.Initialize(wset.DimensionWidth, wset.DimensionHeight, new GrassAndDirt(0)); Util.WriteLine("World generated!"); Util.WriteLine("Initializing networking!"); int port = SettingsHandler.NetworkSettings.Settings.Port; ServerSendRecieve.Initialize(new NetworkSettings(port)); ServerSendRecieve.TCPServer.Server.ClientConnected += Server_ClientConnected; ServerSendRecieve.TCPServer.Server.ClientDisconnected += Server_ClientDisconnected; Util.WriteLine("Done!"); }
public void run(List <string> input) { Server.Load(EngineMode.ServerOnly); WorldGenerationSettings wset = SettingsHandler.WorldGenerationSettings.GetSettings(); Util.WriteLine("Generating world!"); World.Initialize(wset.DimensionWidth, wset.DimensionHeight, new StoneSprinkle(0)); Util.WriteLine("World generated!"); Util.WriteLine("Initializing networking!"); int port = SettingsHandler.NetworkSettings.GetSettings().Port; ServerSendRecieve.Initialize(new NetworkSettings(port)); Util.WriteLine("Done!"); Server.StartGame(); Util.WriteLine("Game started!"); }
public GameWorld(WorldGenerationSettings settings) { mutator = new Mutations(); PlayerSpecies = CreatePlayerSpecies(); Map = PatchMapGenerator.Generate(settings, PlayerSpecies); if (!Map.Verify()) { throw new ArgumentException("generated patch map with settings is not valid"); } // Apply initial populations Map.UpdateGlobalPopulations(); TimedEffects = new TimedWorldOperations(); // Register glucose reduction TimedEffects.RegisterEffect("reduce_glucose", new WorldEffectLambda((elapsed, total) => { foreach (var key in Map.Patches.Keys) { var patch = Map.Patches[key]; foreach (var compound in patch.Biome.Compounds.Keys) { if (compound == "glucose") { var data = patch.Biome.Compounds[compound]; // TODO: verify that this change is picked up by the patch manager data.Density *= Constants.GLUCOSE_REDUCTION_RATE; } } } })); }
public static PatchMap Generate(WorldGenerationSettings settings, Species defaultSpecies) { // TODO: implement actual generation based on settings _ = settings; var map = new PatchMap(); // Predefined patches Patch patch0 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_VENTS"), 0, GetBiomeTemplate("aavolcanic_vent")); patch0.Depth[0] = 2500; patch0.Depth[1] = 3000; patch0.AddSpecies(defaultSpecies); patch0.ScreenCoordinates = new Vector2(100, 400); map.AddPatch(patch0); Patch patch1 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_MESOPELAGIC"), 1, GetBiomeTemplate("mesopelagic")); patch1.Depth[0] = 200; patch1.Depth[1] = 1000; patch1.ScreenCoordinates = new Vector2(200, 200); map.AddPatch(patch1); Patch patch2 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_EPIPELAGIC"), 2, GetBiomeTemplate("default")); patch2.Depth[0] = 0; patch2.Depth[1] = 200; patch2.ScreenCoordinates = new Vector2(200, 100); map.AddPatch(patch2); Patch patch3 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_TIDEPOOL"), 3, GetBiomeTemplate("tidepool")); patch3.Depth[0] = 0; patch3.Depth[1] = 10; patch3.ScreenCoordinates = new Vector2(300, 100); map.AddPatch(patch3); Patch patch4 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_BATHYPELAGIC"), 4, GetBiomeTemplate("bathypelagic")); patch4.Depth[0] = 1000; patch4.Depth[1] = 4000; patch4.ScreenCoordinates = new Vector2(200, 300); map.AddPatch(patch4); Patch patch5 = new Patch(TranslationServer.Translate("PATHCH_PANGONIAN_ABYSSOPELAGIC"), 5, GetBiomeTemplate("abyssopelagic")); patch5.Depth[0] = 4000; patch5.Depth[1] = 6000; patch5.ScreenCoordinates = new Vector2(300, 400); map.AddPatch(patch5); Patch patch6 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_COAST"), 6, GetBiomeTemplate("coastal")); patch6.Depth[0] = 0; patch6.Depth[1] = 200; patch6.ScreenCoordinates = new Vector2(100, 100); map.AddPatch(patch6); Patch patch7 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_ESTUARY"), 7, GetBiomeTemplate("estuary")); patch7.Depth[0] = 0; patch7.Depth[1] = 200; patch7.ScreenCoordinates = new Vector2(70, 160); map.AddPatch(patch7); Patch patch8 = new Patch(TranslationServer.Translate("PATCH_CAVE"), 8, GetBiomeTemplate("underwater_cave")); patch8.Depth[0] = 200; patch8.Depth[1] = 1000; patch8.ScreenCoordinates = new Vector2(300, 200); map.AddPatch(patch8); Patch patch9 = new Patch(TranslationServer.Translate("PATCH_ICE_SHELF"), 9, GetBiomeTemplate("ice_shelf")); patch9.Depth[0] = 0; patch9.Depth[1] = 200; patch9.ScreenCoordinates = new Vector2(200, 30); map.AddPatch(patch9); Patch patch10 = new Patch(TranslationServer.Translate("PATCH_PANGONIAN_SEAFLOOR"), 10, GetBiomeTemplate("seafloor")); patch10.Depth[0] = 4000; patch10.Depth[1] = 6000; patch10.ScreenCoordinates = new Vector2(200, 400); map.AddPatch(patch10); // Connections patch0.AddNeighbour(patch10); patch1.AddNeighbour(patch4); patch1.AddNeighbour(patch2); patch1.AddNeighbour(patch8); patch2.AddNeighbour(patch1); patch2.AddNeighbour(patch3); patch2.AddNeighbour(patch6); patch2.AddNeighbour(patch9); patch3.AddNeighbour(patch2); patch4.AddNeighbour(patch5); patch4.AddNeighbour(patch1); patch4.AddNeighbour(patch10); patch5.AddNeighbour(patch10); patch5.AddNeighbour(patch4); patch6.AddNeighbour(patch2); patch6.AddNeighbour(patch7); patch7.AddNeighbour(patch6); patch8.AddNeighbour(patch1); patch9.AddNeighbour(patch2); patch10.AddNeighbour(patch4); patch10.AddNeighbour(patch5); patch10.AddNeighbour(patch0); map.CurrentPatch = patch0; return(map); }
public static PatchMap Generate(WorldGenerationSettings settings, Species defaultSpecies) { // TODO: implement actual generation based on settings _ = settings; var map = new PatchMap(); // Predefined patches Patch patch0 = new Patch("Pangonian vents", 0, GetBiomeTemplate("aavolcanic_vent")); patch0.Depth[0] = 2500; patch0.Depth[1] = 3000; patch0.AddSpecies(defaultSpecies); patch0.ScreenCoordinates = new Vector2(100, 400); map.AddPatch(patch0); Patch patch1 = new Patch("Pangonian Mesopelagic", 1, GetBiomeTemplate("mesopelagic")); patch1.Depth[0] = 200; patch1.Depth[1] = 1000; patch1.ScreenCoordinates = new Vector2(200, 200); map.AddPatch(patch1); Patch patch2 = new Patch("Pangonian Epipelagic", 2, GetBiomeTemplate("default")); patch2.Depth[0] = 0; patch2.Depth[1] = 200; patch2.ScreenCoordinates = new Vector2(200, 100); map.AddPatch(patch2); Patch patch3 = new Patch("Pangonian Tidepool", 3, GetBiomeTemplate("tidepool")); patch3.Depth[0] = 0; patch3.Depth[1] = 10; patch3.ScreenCoordinates = new Vector2(300, 100); map.AddPatch(patch3); Patch patch4 = new Patch("Pangonian Bathypelagic", 4, GetBiomeTemplate("bathypelagic")); patch4.Depth[0] = 1000; patch4.Depth[1] = 4000; patch4.ScreenCoordinates = new Vector2(200, 300); map.AddPatch(patch4); Patch patch5 = new Patch("Pangonian Abyssopelagic", 5, GetBiomeTemplate("abyssopelagic")); patch5.Depth[0] = 4000; patch5.Depth[1] = 6000; patch5.ScreenCoordinates = new Vector2(300, 400); map.AddPatch(patch5); Patch patch6 = new Patch("Pangonian Coast", 6, GetBiomeTemplate("coastal")); patch6.Depth[0] = 0; patch6.Depth[1] = 200; patch6.ScreenCoordinates = new Vector2(100, 100); map.AddPatch(patch6); Patch patch7 = new Patch("Pangonian Estuary", 7, GetBiomeTemplate("estuary")); patch7.Depth[0] = 0; patch7.Depth[1] = 200; patch7.ScreenCoordinates = new Vector2(70, 160); map.AddPatch(patch7); Patch patch8 = new Patch("Cave", 8, GetBiomeTemplate("underwater_cave")); patch8.Depth[0] = 200; patch8.Depth[1] = 1000; patch8.ScreenCoordinates = new Vector2(300, 200); map.AddPatch(patch8); Patch patch9 = new Patch("Ice Shelf", 9, GetBiomeTemplate("ice_shelf")); patch9.Depth[0] = 0; patch9.Depth[1] = 200; patch9.ScreenCoordinates = new Vector2(200, 30); map.AddPatch(patch9); Patch patch10 = new Patch("Pangonian Sea Floor", 10, GetBiomeTemplate("seafloor")); patch10.Depth[0] = 4000; patch10.Depth[1] = 6000; patch10.ScreenCoordinates = new Vector2(200, 400); map.AddPatch(patch10); // Connections patch0.AddNeighbour(patch10); patch1.AddNeighbour(patch4); patch1.AddNeighbour(patch2); patch1.AddNeighbour(patch8); patch2.AddNeighbour(patch1); patch2.AddNeighbour(patch3); patch2.AddNeighbour(patch6); patch2.AddNeighbour(patch9); patch3.AddNeighbour(patch2); patch4.AddNeighbour(patch5); patch4.AddNeighbour(patch1); patch4.AddNeighbour(patch10); patch5.AddNeighbour(patch10); patch5.AddNeighbour(patch4); patch6.AddNeighbour(patch2); patch6.AddNeighbour(patch7); patch7.AddNeighbour(patch6); patch8.AddNeighbour(patch1); patch9.AddNeighbour(patch2); patch10.AddNeighbour(patch4); patch10.AddNeighbour(patch5); patch10.AddNeighbour(patch0); map.CurrentPatch = patch0; return(map); }
public static PatchMap Generate(WorldGenerationSettings settings, Species defaultSpecies) { // TODO: implement actual generation based on settings _ = settings; var map = new PatchMap(); // Predefined patches var vents = new Patch("PATCH_PANGONIAN_VENTS", 0, GetBiomeTemplate("aavolcanic_vent")) { Depth = { [0] = 2500, [1] = 3000, }, ScreenCoordinates = new Vector2(100, 400), }; vents.AddSpecies(defaultSpecies); map.AddPatch(vents); var mesopelagic = new Patch("PATCH_PANGONIAN_MESOPELAGIC", 1, GetBiomeTemplate("mesopelagic")) { Depth = { [0] = 200, [1] = 1000, }, ScreenCoordinates = new Vector2(200, 200), }; map.AddPatch(mesopelagic); var epipelagic = new Patch("PATCH_PANGONIAN_EPIPELAGIC", 2, GetBiomeTemplate("default")) { Depth = { [0] = 0, [1] = 200, }, ScreenCoordinates = new Vector2(200, 100), }; map.AddPatch(epipelagic); var tidepool = new Patch("PATCH_PANGONIAN_TIDEPOOL", 3, GetBiomeTemplate("tidepool")) { Depth = { [0] = 0, [1] = 10, }, ScreenCoordinates = new Vector2(300, 100), }; map.AddPatch(tidepool); var bathypelagic = new Patch("PATCH_PANGONIAN_BATHYPELAGIC", 4, GetBiomeTemplate("bathypelagic")) { Depth = { [0] = 1000, [1] = 4000, }, ScreenCoordinates = new Vector2(200, 300), }; map.AddPatch(bathypelagic); var abyssopelagic = new Patch("PATHCH_PANGONIAN_ABYSSOPELAGIC", 5, GetBiomeTemplate("abyssopelagic")) { Depth = { [0] = 4000, [1] = 6000, }, ScreenCoordinates = new Vector2(300, 400), }; map.AddPatch(abyssopelagic); var coast = new Patch("PATCH_PANGONIAN_COAST", 6, GetBiomeTemplate("coastal")) { Depth = { [0] = 0, [1] = 200, }, ScreenCoordinates = new Vector2(100, 100), }; map.AddPatch(coast); var estuary = new Patch("PATCH_PANGONIAN_ESTUARY", 7, GetBiomeTemplate("estuary")) { Depth = { [0] = 0, [1] = 200, }, ScreenCoordinates = new Vector2(70, 160), }; map.AddPatch(estuary); var cave = new Patch("PATCH_CAVE", 8, GetBiomeTemplate("underwater_cave")) { Depth = { [0] = 200, [1] = 1000, }, ScreenCoordinates = new Vector2(300, 200), }; map.AddPatch(cave); var iceShelf = new Patch("PATCH_ICE_SHELF", 9, GetBiomeTemplate("ice_shelf")) { Depth = { [0] = 0, [1] = 200, }, ScreenCoordinates = new Vector2(200, 30), }; map.AddPatch(iceShelf); var seafloor = new Patch("PATCH_PANGONIAN_SEAFLOOR", 10, GetBiomeTemplate("seafloor")) { Depth = { [0] = 4000, [1] = 6000, }, ScreenCoordinates = new Vector2(200, 400), }; map.AddPatch(seafloor); // Connections LinkPatches(vents, seafloor); LinkPatches(seafloor, bathypelagic); LinkPatches(seafloor, abyssopelagic); LinkPatches(bathypelagic, abyssopelagic); LinkPatches(bathypelagic, mesopelagic); LinkPatches(mesopelagic, epipelagic); LinkPatches(mesopelagic, cave); LinkPatches(epipelagic, tidepool); LinkPatches(epipelagic, iceShelf); LinkPatches(epipelagic, coast); LinkPatches(coast, estuary); map.CurrentPatch = vents; return(map); }