public void ProcessInput(GameTime gameTime, InputInformation inputInfo) { // Is it time to send outgoing network packets? bool sendPacketThisFrame = false; framesSinceLastSend++; if (framesSinceLastSend >= Application.CLIENT_UPDATE_RATE) { sendPacketThisFrame = true; framesSinceLastSend = 0; } // Process and fetch input from local player KeyboardMovementInput condensedInput = ProcessInputForLocalPlayer(gameTime, inputInfo); // Build an update packet from the input and player values PlayerUpdatePacket packet = _localPlayer.BuildUpdatePacket(); packet.DeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; packet.Input = condensedInput; packet.SequenceNumber = _packetNumber++; // Add it to the queue _updatePackets.Enqueue(packet); if (sendPacketThisFrame) { // Send the packet to the server SendMessageToTheServer(packet, MessageType.GI_ClientSend_PlayerUpdate); } }