public BaseClient() { FrameCounter = new FrameCounter(); Camera = new Camera(); World = new GameWorld(); Client = new NetworkClient(); InputHistory = new CircularArray <InputState>(1000); Content.RootDirectory = "Content"; IsFixedTimeStep = false; Window.AllowUserResizing = true; Window.ClientSizeChanged += new EventHandler <EventArgs>(OnResize); GraphicsDeviceManager = new GraphicsDeviceManager(this) { PreferredBackBufferHeight = ViewportHeight, PreferredBackBufferWidth = ViewportWidth, SynchronizeWithVerticalRetrace = VsyncEnabled, PreferMultiSampling = false, }; CurrentGameState = GameState.MainMenu; #region Listener Bindings Client.AddListener <SPConnectAccept>(Protocol.S_ConnectOK, OnServerAccept); Client.AddListener <SPConnectDeny>(Protocol.S_ConnectDeny, OnServerDeny); Client.AddListener <SPChat>(Protocol.S_Chat, OnServerChatMsg); Client.AddListener <SPAssignPlayerID>(Protocol.S_AssignPlayerID, OnAssignedPlayerID); Client.AddListener <SPPingReply>(Protocol.S_PingReply, OnServerPingReply); Client.AddListener <SPAddBullet>(Protocol.S_AddBullet, OnAddBullet); Client.AddListener <SPAddPlayer>(Protocol.S_AddPlayer, OnAddPlayer); Client.AddListener <SPDeleteEntity>(Protocol.S_DeleteEntity, OnDeleteEntity); Client.AddListener <SLeaderboardLayoutHeader, SLeaderboardLayoutSlice> (Protocol.S_LeaderboardLayout, OnLeaderboardLayout); Client.AddListener <SGameStateHeader, SGameStateSlice> (Protocol.S_GameState, OnGameStateUpdate); Client.AddListener <SMapHeader, SMapSlice> (Protocol.S_MapData, OnReceiveMapData); #endregion World.OnPhysicsStep += PhysicsCallback; TaskManager.Register(new IntervalTask(1.0f, PingServer)); TaskManager.Register(new IntervalTask(20.0f, SendInputState)); }