public AirlockServer(int port) { Server = new UDPServer(port); Server.IncomingConnectionLimit = MaxPlayers; Clients = new List <AirlockHostedClient>(); NetDefs = new NetDefinitions(); NetDefs.LoadEntityTypes(); WorldContent = new OutgoingSyncPool(NetDefs, (ushort)SyncPoolID.WorldContent); Entities = new List <Entity>(); Grid = MapGrid.StartingMap(); AddEntity(new DroppedItem(new Vector2(200, -200))); foreach (MapRoom room in Grid.Rooms) { WorldContent.AddEntity(room); } }
public AirlockClient(IPAddress address, int destport, int srcport) { Network = new NetworkClient(new UDPConnection(address, destport, srcport)); NetDefinitions netDefs = new NetDefinitions(); netDefs.LoadEntityTypes(); WorldContent = new IncomingSyncPool(netDefs, (ushort)AirlockServer.SyncPoolID.WorldContent); ReturnContent = new OutgoingSyncPool(netDefs, (ushort)AirlockServer.SyncPoolID.ReturnContent); ClientContent = new IncomingSyncPool(netDefs, (ushort)AirlockServer.SyncPoolID.ClientContent); ClientContent.LinkedPools.Add(WorldContent); Network.Attach(WorldContent); Network.Attach(ReturnContent); Network.Attach(ClientContent); Network.SetState(NetworkClient.ConnectionState.Open); LocalPlayer = new LocalPlayer(); ReturnContent.AddEntity(LocalPlayer); Inputs = new ClientInputs(); Grid = new MapGrid(); }