Example #1
0
 public SquintProtocolXML()
 {
     ProtocolMetaData           = new ProtocolMetaDataDefinition();
     Structures                 = new StructuresDefinition();
     Components                 = new ComponentsDefinition();
     DVHConstraints             = new DVHConstraintListDefinition();
     ConformityIndexConstraints = new ConformityIndexConstraintListDefinition();
 }
Example #2
0
        public MainGame()
        {
            this.InactiveSleepTime     = TimeSpan.Zero;
            this.IsMouseVisible        = true;
            this.graphicsDeviceManager = new GraphicsDeviceManager(this);
            this.graphicsDeviceManager.GraphicsProfile = GraphicsProfile.HiDef;
            this.renderSystem          = new RenderSystem(this.graphicsDeviceManager);
            this.Content.RootDirectory = "Assets";

            ComponentsDefinition componentsDefinition = new ComponentsDefinition();

            componentsDefinition.RegisterComponentType <SpatialComponent>();
            componentsDefinition.RegisterComponentType <PhysicsComponent>();
            componentsDefinition.RegisterComponentType <ColorComponent>();

            this.hasServer = !Environment.GetCommandLineArgs().Any((arg) => arg.Equals("-ns", StringComparison.OrdinalIgnoreCase));
            if (this.hasServer)
            {
                this.networkServer = new NetworkServer("1", MainGame.maxClients, 4000, 19876);
                this.gameServer    = new GameServer <CommandData>(this.networkServer.ClientNetworkConnections, 20, 30,
                                                                  componentsDefinition, new IServerSystem[] { new ClientCommandSystem(), new SpinnerSystem(), new PhysicsSystem() }, this.updateCommandingEntityID);

                // Make some dummy entities that we'll remove to have a gap in entity IDs
                this.gameServer.EntityArray.TryCreateEntity(out Entity dummy1);
                this.gameServer.EntityArray.TryCreateEntity(out Entity dummy2);

                // Add some stuff to the world
                for (int x = -1; x <= 1; x++)
                {
                    for (int z = -1; z <= 1; z++)
                    {
                        this.gameServer.EntityArray.TryCreateEntity(out Entity entity);
                        entity.AddComponent <SpatialComponent>().Position = new Vector3(x * 5, 0, z * 5);
                        if (entity.ID == 11)
                        {
                            entity.AddComponent <ColorComponent>().Color = new Color(1.0f, 0.5f, 0.5f);
                        }
                        else if (entity.ID == 12)
                        {
                            entity.AddComponent <ColorComponent>().Color = new Color(0.0f, 1.0f, 0.5f);
                        }
                    }
                }

                // Remove those dummy entities to have a gap in entity IDs
                this.gameServer.EntityArray.RemoveEntity(dummy1);
                this.gameServer.EntityArray.RemoveEntity(dummy2);
                this.gameServer.EntityArray.EndUpdate();
            }

            this.networkClient = new NetworkClient("1", 4000);
            this.gameClient    = new GameClient <CommandData>(this.networkClient, 20, 30,
                                                              componentsDefinition, new IClientSystem[] { new ClientCommandSystem(), new PhysicsSystem(), this.renderSystem });
        }
Example #3
0
        public MainForm()
        {
            this.InitializeComponent();

            this.clientServerNetworkConnection = new TestNetworkConnection()
            {
                SimulatedLatency    = 10,
                SimulatedJitter     = 0,
                SimulatedPacketLoss = 0,
            };

            ComponentsDefinition componentsDefinition = new ComponentsDefinition();

            componentsDefinition.RegisterComponentType <PositionComponent>();
            componentsDefinition.RegisterComponentType <SpinComponent>();

            this.gameClient = new GameClient <TestCommandData>(this.clientServerNetworkConnection, 10, 5,
                                                               componentsDefinition, new IClientSystem[] { new MovementSystem() });
            this.gameServer = new GameServer <TestCommandData>(new[] { this.clientServerNetworkConnection }, 10, 5,
                                                               componentsDefinition, new IServerSystem[] { new SpinSystem(), new MovementSystem() }, this.updateCommandingEntityID);
            {
                this.gameServer.EntityArray.TryCreateEntity(out Entity entity1);
                this.gameServer.EntityArray.TryCreateEntity(out Entity entity2);
                entity2.AddComponent <PositionComponent>().Position = new Vector3(0, 0, 0);
                entity2.AddComponent <SpinComponent>();
                this.gameServer.EntityArray.TryCreateEntity(out Entity entity3);
                this.gameServer.EntityArray.TryCreateEntity(out Entity entity4);
                this.gameServer.EntityArray.RemoveEntity(entity1);
                this.gameServer.EntityArray.RemoveEntity(entity3);
                entity4.AddComponent <PositionComponent>().Position = new Vector3(99, 99, 0);
            }

            this.clientServerNetworkConnection.GameClient = this.gameClient;
            this.clientServerNetworkConnection.GameServer = this.gameServer;

            this.clientGroupBox.Tag = ClientServerContext.Client;
            this.serverGroupBox.Tag = ClientServerContext.Server;

            this.clientPacketTimelineDisplay.NetworkConnection   = this.clientServerNetworkConnection;
            this.clientPacketTimelineDisplay.ClientServerContext = ClientServerContext.Client;
        }