I'm programming my first multiplayer game loop and right now my loop consists of:
At what point in the loop is it best to send packets to the server?
My current game loop:
while (!key[KEY_ESC]) {
while (speed_counter > 0) {
update();
keyboard();
mouse();
speed_counter--;
}
if(game_time - old_time >= 10) {
fps = frames_done;
frames_done = 0;
old_time = game_time;
}
draw();
frames_done++;
}
You would want to send packets after input is received (in this case both keyboard and mouse) so that all moves can be updated at the same time. You would want a step 3.5 that was something like update other players
if I understand your question correctly