static void Main(string[] args) { //Start up the world! World world = new World(); world.Start(); //Update metrics in the window title every second. Like a boss. //TODO: Do this properly! DateTime lastCheck = DateTime.Now; TimeSpan interval = TimeSpan.FromSeconds(1); while (true) { TimeSpan delta = DateTime.Now - lastCheck; if (delta >= interval) { //Update every second or so Console.Title = "IN: [" + NetEntity.IN + " Req/s | " + (NetEntity.BIN / 1024) + " KB/s] OUT: [" + NetEntity.OUT + " Req/s | " + (NetEntity.BOUT / 1024) + " KB/s] CCU: [" + world.CCU + "] World Update Time: [" + world.LastUpdateDelta + "]"; NetEntity.IN = 0; NetEntity.OUT = 0; NetEntity.BOUT = 0; NetEntity.BIN = 0; lastCheck = DateTime.Now + (delta - interval); } Thread.Sleep(100); } }
void InitStuff() { Items.Start(); Jobs.Start(); Dialogue.Start(); World.Start(); // Create the quest marker questMarker = Instantiate(questMarker) as GameObject; // Create the textbox textbox = Instantiate(textbox, new Vector3(4.5f, 0.5f, 0f), Quaternion.identity) as GameObject; textManager = textbox.GetComponent <Textbox>(); textManager.Draw(); // Create the inventory box inventory = Instantiate(inventory, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject; inventoryManager = inventory.GetComponent <Inventory>(); inventoryManager.Setup(); // Create the info box GameObject textContainer = new GameObject(); textContainer = Instantiate(textContainer, new Vector3(6f, 9.5f, -1f), Quaternion.identity) as GameObject; textContainer.AddComponent <TextMesh>(); Vector3 oldScale = textContainer.transform.localScale; Vector3 newScale = new Vector3(oldScale.x * .25f, oldScale.y * .25f, oldScale.z * .25f); textContainer.transform.localScale = newScale; textMesh = textContainer.GetComponent <TextMesh>(); textMesh.alignment = TextAlignment.Left; textMesh.color = Color.white; textMesh.fontSize = 20; }
public void Start() { Settings.Start(); SQLite.Start(); World.Start(); Listener.Start(); }
public void Start() { hasClosed = false; gameLoop = new DispatcherTimerGameLoop(1000 / 100); gameLoop.Update += Update; gameWindow = new GameWindow(settings); gameWindow.Closed += (sender, args) => Stop(); SocketFactory socketGame = new SocketFactory(settings); socketGame.Cancel += Stop; socketManager = socketGame.CreateSocketManager(); GraphicManager graphicManager = new GraphicManager(gameWindow.Canvas); InputFactory inputFactory = new InputFactory(gameWindow.Canvas, socketManager); if (hasClosed) { return; } world = new World(settings, inputFactory, graphicManager); CompositionTarget.Rendering += (sender, args) => world.Draw(); world.Start(); gameWindow.Show(); gameLoop.Start(); }
private ServerBootstrap() { World = World.Start("vlingo-http-server"); var userResource = new UserResourceFluent(World); var profileResource = new ProfileResourceFluent(World); var r1 = userResource.Routes(); var r2 = profileResource.Routes(); var resources = Resources.Are(r1, r2); Server = Server.StartWith( World.Stage, resources, Filters.None(), 8081, Configuration.SizingConf.DefineWith(4, 10, 100, 10240), Configuration.TimingConf.DefineWith(3, 1, 100), "arrayQueueMailbox", "arrayQueueMailbox"); AppDomain.CurrentDomain.ProcessExit += (s, e) => { if (Instance != null) { Instance.Server.Stop(); Console.WriteLine("\n"); Console.WriteLine("=============================="); Console.WriteLine("Stopping vlingo/http Server..."); Console.WriteLine("=============================="); } }; }
public static void Host() { if (Self.GetTree().NetworkPeer != null) { if (Self.GetTree().IsNetworkServer()) { Console.ThrowPrint("Cannot host when already hosting"); } else { Console.ThrowPrint("Cannot host when connected to a server"); } return; } PeerList.Clear(); World.Start(); NetworkedMultiplayerENet Peer = new NetworkedMultiplayerENet(); Peer.CreateServer(Port, Game.MaxPlayers); Self.GetTree().SetNetworkPeer(Peer); Self.GetTree().SetMeta("network_peer", Peer); Console.Log($"Started hosting on port '{Port}'"); PeerList.Add(Self.GetTree().GetNetworkUniqueId()); Nicknames[ServerId] = Game.Nickname; Game.SpawnPlayer(Self.GetTree().GetNetworkUniqueId(), true); World.DefaultPlatforms(); }
public static TestWorld StartWithDefaults(string name) { lock (startWithDefaultMutex) { return(new TestWorld(World.Start(name, Configuration.Define()), name)); } }
public void StartNewGame(Vector2 size, MouseState ms, KeyboardState ks) { if (gameState == GameState.running) { return; } gameState = GameState.running; GL.ClearColor(0, 0, 0, 1); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); currentMod = null; if (argument.Length > 0 && argument.Contains("Mod")) { currentMod = ModManager.Instance.LoadSpecificMod(argument.GetArgumentParameter("Mod")); } else if (ModManager.Instance.Mods.Count > 0) { currentMod = ModManager.Instance.Mods.ElementAt(0).Value; } loadAssest(currentMod); world = new World(assetManager, currentMod, size, ms, ks); world.Start(); }
public static TestWorld Start(string name, Properties properties) { lock (startNamePropMutex) { var world = World.Start(name, properties); return(new TestWorld(world, name)); } }
// Start is called before the first frame update public static void Start() { Logger.InitializeLog(); CameraController.SetupCamera(); UIController.Start(); InputController.Start(); World.Start(); Lifeforms.Start(); }
public static Tuple <IClusterSnapshotControl, ILogger> ControlFor(string name) { if (_world != null) { throw new InvalidOperationException("Cluster snapshot control already exists."); } return(ControlFor(World.Start("vlingo-cluster"), name)); }
public void NotifySuccessConnect() //Run on client { Console.Log($"Connected to server at '{Ip}'"); World.Start(); PeerList.Add(Self.GetTree().GetNetworkUniqueId()); Game.SpawnPlayer(Self.GetTree().GetNetworkUniqueId(), true); RpcId(ServerId, nameof(RecieveNick), GetTree().GetNetworkUniqueId(), Game.Nickname); }
public GuidAddressTest() { var addressFactory = new GuidAddressFactory(IdentityGeneratorType.Random); _world = World.Start( "test-address", Configuration.Define().With(addressFactory)); }
public void TestStartWorldWithDefaultConfiguration() { var worldDefaultConfig = World.Start("defaults"); var testResults = new WorldTest.TestResults(1); var simple = worldDefaultConfig.ActorFor <ISimpleWorldForDefaultConfig>( Definition.Has <SimpleActor>( Definition.Parameters(testResults))); simple.SimplySay(); Assert.True(testResults.Invoked); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); services.AddServerSideBlazor(); services.AddScoped <World>((ctx) => { var world = new World(40, 80); world.Start(); return(world); }); }
static void Main(string[] args) { World world = new World(""); world.OnLog += Log; world.OnURLChange += SetURL; if (world.Init()) { if (args.Length == 1) { world.LoadMap(args[0]); } else { world.LoadMap(Map.DefaultFileName); } UpdaterResult update = Updater.CheckForUpdates(world); if (update.UpdateAvailable) { Console.WriteLine("** A new version of fCraft is available: v{0:0.000}, released {1:0} day(s) ago. **", Decimal.Divide(update.NewVersionNumber, 1000), DateTime.Now.Subtract(update.ReleaseDate).TotalDays); } System.Diagnostics.Process.GetCurrentProcess().PriorityClass = world.config.GetBasePriority(); if (world.Start()) { Console.Title = "fCraft " + Updater.GetVersionString() + " - " + world.config.GetString("ServerName"); string input = ""; Console.WriteLine("** To shut down the server, type /exit **"); while ((input = Console.ReadLine()) != "/exit") { Player.Console.ParseMessage(input, true); } world.ShutDown(); } else { Console.WriteLine("** Failed to start the server **"); world.ShutDown(); Console.ReadLine(); } } else { Console.WriteLine("** Failed to initialize the server **"); world.ShutDown(); Console.ReadLine(); } }
public void TestThatRingBufferIsUsed() { var world = World.Start("ring-mailbox-test"); var results = new TestResults(); var one = world.ActorFor <IOneBehavior>( Definition.Has <OneBehaviorActor>(Definition.Parameters(results), "ringMailbox", "one-behavior")); one.DoSomething(); results.until.Completes(); Assert.Equal(1, results.times); }
protected void RunWith(string mailboxType) { var world = World.Start($"{GetType().Name}-world"); var actor = world.ActorFor <ISingleOperation>( Definition.Has <SingleOperationActor>( Definition.NoParameters, mailboxType, "single-op")); Console.WriteLine("======================================"); Console.WriteLine("WARM UP: STARTING FOR MAILBOX TYPE: " + mailboxType); // warm up EndTime = DateTime.MinValue; SingleOperationActor.instance.totalValue = 0; for (int idx = 1; idx <= Max; ++idx) { actor.Keep(idx); } Console.WriteLine("WARM UP: SENT ALL, WAITING FOR COMPLETION"); while (EndTime == DateTime.MinValue) { Thread.Sleep(100); } //====================================== Console.WriteLine("SPEED TEST: START FOR MAILBOX TYPE: " + mailboxType); // speed test EndTime = DateTime.MinValue; SingleOperationActor.instance.totalValue = 0; StartTime = DateTime.UtcNow; for (int idx = 1; idx <= Max; ++idx) { actor.Keep(idx); } while (EndTime == DateTime.MinValue) { Thread.Sleep(500); } var totalTime = EndTime - StartTime; var totalSeconds = totalTime.TotalSeconds; Console.WriteLine("SPEED TEST: ENDED FOR MAILBOX TYPE: " + mailboxType); Console.WriteLine(" TOTAL TIME: " + totalTime); Console.WriteLine(" MESSAGES PER SECOND: " + (Max / totalSeconds)); }
// Start is called before the first frame update void Start() { World = new World(Threaded); //ActiveFeatures = SimFeature.All; //ActiveFeatures &= ~(SimFeature.Evaporation); // ActiveFeatures &= ~(SimFeature.TradeWinds); Data.Init(WorldGenData.Size); WorldGen.Generate(World, SpeciesSprites, Data, WorldGenData, Seed); CreateWorldMesh(); MainCamera.transform.position = new Vector3(World.Size / 2, World.Size / 2, MainCamera.transform.position.z); _windArrows = new GameObject[World.Size * World.Size]; for (int i = 0; i < World.Size; i++) { for (int j = 0; j < World.Size; j++) { var a = GameObject.Instantiate <GameObject>(ArrowPrefab, this.transform); a.transform.position = new Vector3(i, j, 0); a.SetActive(false); a.hideFlags = HideFlags.HideInHierarchy; _windArrows[i + j * World.Size] = a; } } _herdIcons = new HerdIcon[World.MaxHerds]; for (int i = 0; i < World.MaxHerds; i++) { var icon = HerdIcon.Instantiate <HerdIcon>(HerdIconPrefab, WorldIcons.transform); icon.gameObject.hideFlags = HideFlags.HideInHierarchy; icon.World = this; icon.gameObject.SetActive(false); _herdIcons[i] = icon; } _territoryMarkers = new GameObject[Herd.MaxActiveTiles]; for (int i = 0; i < Herd.MaxActiveTiles; i++) { var marker = GameObject.Instantiate <GameObject>(TerritoryMarker, WorldIcons.transform); marker.gameObject.hideFlags = HideFlags.HideInHierarchy; marker.gameObject.SetActive(false); _territoryMarkers[i] = marker; } WorldStartedEvent?.Invoke(); HerdSelected = -1; World.Start(); }
static void Main(string[] args) { var world = World.Start("playground"); var pinger = world.ActorFor <IPinger>(() => new PingerActor()); var ponger = world.ActorFor <IPonger>(() => new PongerActor()); pinger.Ping(ponger); Console.WriteLine("Press any key to end the world..."); Console.ReadKey(); world.Terminate(); }
public void TestPlayPingPong() { var world = World.Start("playground"); var until = TestUntil.Happenings(1); var pinger = world.ActorFor <IPinger>( Definition.Has <PingerActor>(Definition.Parameters(until))); var ponger = world.ActorFor <IPonger>( Definition.Has <PongerActor>( Definition.NoParameters)); pinger.Ping(ponger); until.Completes(); world.Terminate(); }
public static void StartRPG() { world.Start(); world.AutoLogin(); while (world.Running) { if ((int)(DateTime.Now - world.LastTime).TotalSeconds >= Config.Tick) { world.RPCheck(); } else { Thread.Sleep(Config.Tick * 1000); } } }
/// <summary> /// Loads a world to the server. If a world by that name is already loaded, will simply return that world. /// </summary> /// <param name="name">The name of the world.</param> /// <returns>A world object.</returns> public World LoadWorld(string name) { string nl = name.ToLowerFast(); for (int i = 0; i < LoadedWorlds.Count; i++) { if (LoadedWorlds[i].Name == nl) { return(LoadedWorlds[i]); } } WorldLoadPreEventArgs e = new WorldLoadPreEventArgs() { WorldName = name }; OnWorldLoadPreEvent.Fire(e); if (e.Cancelled) { return(null); } World world = new World() { Name = nl, TheServer = this }; WorldLoadEventArgs e2 = new WorldLoadEventArgs() { TheWorld = world }; OnWorldLoadEvent.Fire(e2); if (e.Cancelled) { world.UnloadFully(null); return(null); } LoadedWorlds.Add(world); OnWorldLoadPostEvent.Fire(new WorldLoadPostEventArgs() { TheWorld = world }); world.Start(); return(world); }
public static void Start(Window window) { Window = window; Debug.Init(); Debug.CSV.Start("fps", new string[] { "Time", "FPS" }); ModelManager.Start(); Seed = new Random().Next(int.MinValue, int.MaxValue); WorldGenerator generator = new WorldGenerator(new Vector3Int(0, 0, 0)); Player = new Player(new Vector3(0, generator.GetHeight(0, 0) + 3, 0)); World = new World(); World.Start(); InputManager = new InputManager(Window, Player); }
public void StartServer() { if (args.Length == 1) { world.LoadMap(args[0]); } else { world.LoadMap(Map.DefaultFileName); } System.Diagnostics.Process.GetCurrentProcess().PriorityClass = world.config.GetBasePriority(); if (!world.Start()) { world = null; } }
public DynamicResourceDispatcherTest(ITestOutputHelper output) { _output = output; var converter = new Converter(output); Console.SetOut(converter); _world = World.Start("test-dynamic-resource-dispatcher"); var fluentResource = new FluentTestResource(_world); var resource = fluentResource.Routes(); resource.AllocateHandlerPool(_world.Stage); var resources = Resources.Are(resource); _dispatcher = new TestDispatcher(resources, _world.DefaultLogger); }
public Form1() { InitializeComponent(); Img = new Bitmap(pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height); World = new World(pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height); World.OnUpdate += World_OnUpdate; World.OnError += World_OnError; GDI = Graphics.FromImage(Img); pictureBox1.Image = Img; CheckForIllegalCrossThreadCalls = false; DoubleBuffered = true; var nutrition = new Substance(World, 0.96, 1); World.AddInitialResource(nutrition, 100); World.Start(16); var life = new Life(World.CreateSpeciesID(), World); World.Birth(life, World.Width / 2, World.Height / 2); }
public override void Load() { //Load all entity data EntityManager.LoadEntities(); //Load the map TestMap = MapManager.LoadMap("test", 3); //Create the world TestWorld = new World("Test World"); //Create a player EEditorController ply = EntityManager.CreateEntity <EEditorController>(TestWorld); //Start simulating the world TestWorld.Start(); }
static void Main(string[] args) { var world = World.Start("playground"); var pinger = world.ActorFor <IPinger>( Definition.Has <PingerActor>( Definition.NoParameters)); var ponger = world.ActorFor <IPonger>( Definition.Has <PongerActor>( Definition.NoParameters)); pinger.Ping(ponger); Console.WriteLine("Press any key to end the world..."); Console.ReadKey(); world.Terminate(); }
public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add <App>("app"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddScoped <World>((ctx) => { var world = new World(50, 25); // 10x15 25x25 50x25 85x39 world.Start(); world.TogglePause(); return(world); }); await builder.Build().RunAsync(); }
public RealProg(Renderer renderer) { Shader myder = renderer.createBasicShader(); World physicsworld = new World(); //Uncomment for AABB collisions // physicsworld.testtype = CollisionTestType.AABB; myder.Draw(); Texture2D mtex = renderer.createTexture(512, 512); mtex.Draw(); Mesh[] meshes = Primitives.LoadMesh("test.obj"); collisiontester = new PhysicalObject(meshes[0].meshverts, 5, CollisionType.Dynamic, physicsworld); mainmesh = meshes[0]; foreach (Mesh mesh in meshes) { VertexBuffer tbuff = renderer.CreateVertexBuffer(mesh.meshverts, mesh.meshtexas, mesh.meshnorms); rotatingbuffer = tbuff; if (mesh.bitmap != null) { Console.WriteLine("BITMAP RENDER"); Texture2D tt = renderer.createTextureFromBitmap(mesh.bitmap); tt.Draw(); } tbuff.Draw(); } Mesh cube = Primitives.LoadMesh("playercube.obj")[0]; theobject = new PhysicalObject(cube.meshverts, 9, CollisionType.Dynamic, physicsworld); collisiontester.ownedVBO = rotatingbuffer; theobject.ownedVBO = renderer.CreateVertexBuffer(cube.meshverts, cube.meshtexas, cube.meshnorms); theobject.ownedVBO.Draw(); physicsworld.physicalobjects.Add(theobject); physicsworld.physicalobjects.Add(collisiontester); //theobject.Velocity = new Vector3D(-.01f, 0, 0); Mesh anothercube = Primitives.LoadMesh("playercube.obj")[0]; PhysicalObject mobject = new PhysicalObject(anothercube.meshverts.Clone() as Vector3D[], 1, CollisionType.Dynamic, physicsworld); mobject.ownedVBO = renderer.CreateVertexBuffer(anothercube.meshverts, anothercube.meshtexas, anothercube.meshnorms); physicsworld.physicalobjects.Add(mobject); mobject.ownedVBO.Draw(); mobject.Position = new Vector3D(30, 0, 0); //Set physics properties // collisiontester.Velocity = new Vector3D(.2f, 0, 0); theobject.Weight = 1; //Uncomment for an inelastic collision //collisiontester.mode = CollisionMode.Inelastic; collisiontester.Weight = 1; collisiontester.Velocity = new Vector3D(.05f, 0, 0); theobject.Position = new Vector3D(15, 0, 0); //collisiontester.Velocity = new Vector3D(-.2f, 0, 0); //End physics properties physicsworld.Start(); List<Vector3D> vectors = new List<Vector3D>(); List<Vector2D> texcoords = new List<Vector2D>(); List<Vector3D> normals = new List<Vector3D>(); for (int i = 0; i < 3; i++) { normals.Add(new Vector3D(1, 1, 1)); } vectors.Add(new Vector3D(0, 0, 0)); vectors.Add(new Vector3D(8, 0, 0)); vectors.Add(new Vector3D(8, 8, 0)); texcoords.Add(new Vector2D(0, 0)); texcoords.Add(new Vector2D(1, 0)); texcoords.Add(new Vector2D(1, 1)); VertexBuffer tribuffer = renderer.CreateVertexBuffer(vectors.ToArray(), texcoords.ToArray(), normals.ToArray()); tribuffer.DepthTesting = false; tribuffer.IsStatic = true; tribuffer.Draw(); renderer.cameraPosition.Z = -25; renderer.cameraPosition.X = -16; //Primitives.createRectangle(renderer, 0, 0, 0, 10, 10).Draw(); System.Threading.Thread mthread = new System.Threading.Thread(thetar); mthread.Start(); }