c++ - When to send packets in multiplayer game loop? -


I am programming my first multiplayer game loop and are now in my loop:

    < Li> Logic
  1. The process of keyboard input
  2. The process of mouse input
  3. Draw

    at which point in the loop Is the best server to send packets?

    My current game loop:

      while (! Key [KEY_ESC]) {while (speed_counter> 0) {update (); Keyboard (); Mouse (); Speed_counter--; } If (game_time - old_time & gt; = 10) {fps = frames_done; Frames_done = 0; Old_time = game_time; } Draw (); Frames_done ++; }    

    You want to send the packet after receiving the input (in this case both the keyboards And mouse) so that all moves can be updated at the same time.

Comments