Skip to content

Commit

Permalink
Merge pull request godotengine#26 from Shatur95/player_proto
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
AndreaCatania authored May 28, 2021
2 parents 3f02478 + 54f340e commit d7995ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/network_synchronizer/networked_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ void ServerController::calculates_player_tick_rate(real_t p_delta) {
#ifdef DEBUG_ENABLED
const bool debug = ProjectSettings::get_singleton()->get_setting("NetworkSynchronizer/debug_server_speedup");
if (debug) {
print_line("Network poorness: " + rtos(net_poorness) + " optimal frame delay: " + itos(optimal_frame_delay) + " Deviation: " + rtos(deviation_receive_time));
print_line("Network poorness: " + rtos(net_poorness) + ", optimal frame delay: " + itos(optimal_frame_delay) + ", deviation: " + rtos(deviation_receive_time) + ", current frame delay: " + itos(consecutive_inputs));
}
#endif
}
Expand Down Expand Up @@ -1463,7 +1463,7 @@ void DollController::receive_batch(const Vector<uint8_t> &p_data) {
#ifdef DEBUG_ENABLED
const bool debug = ProjectSettings::get_singleton()->get_setting("NetworkSynchronizer/debug_doll_speedup");
if (debug) {
print_line("Net poorness: " + rtos(net_poorness) + " Optimal stored epochs: " + rtos(optimal_frame_delay) + " Deviation: " + rtos(deviation_receive_time));
print_line("Network poorness: " + rtos(net_poorness) + ", optimal stored epochs: " + rtos(optimal_frame_delay) + ", deviation: " + rtos(deviation_receive_time));
}
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions modules/network_synchronizer/networked_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class NetworkedController : public Node {
/// This margin of error is called `optimal_frame_delay` and it changes
/// depending on the connection health:
/// it can go from `min_frames_delay` to `max_frames_delay`.
int min_frames_delay = 1;
int min_frames_delay = 2;
int max_frames_delay = 6;

/// Rate at which the tick speed changes, so the `optimal_frame_delay` is
Expand All @@ -183,7 +183,7 @@ class NetworkedController : public Node {
/// This margin of error is called `optimal_frame_delay` and it changes
/// depending on the connection health:
/// it can go from `doll_min_frames_delay` to `doll_max_frames_delay`.
int doll_min_frames_delay = 1;
int doll_min_frames_delay = 2;
int doll_max_frames_delay = 5;

/// Max speedup / slowdown the doll can apply to recover its epoch buffer size.
Expand Down
6 changes: 6 additions & 0 deletions modules/network_synchronizer/scene_synchronizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,12 @@ void ClientSynchronizer::process() {
const real_t delta = scene_synchronizer->get_physics_process_delta_time();
const real_t iteration_per_second = Engine::get_singleton()->get_iterations_per_second();

#ifdef DEBUG_ENABLED
if (unlikely(Engine::get_singleton()->get_frames_per_second() < iteration_per_second)) {
WARN_PRINT("Current FPS is " + itos(Engine::get_singleton()->get_frames_per_second()) + ", but the minimum required FPS is " + itos(iteration_per_second) + ", the client is unable to generate enough inputs for the server.");
}
#endif

NetworkedController *controller = static_cast<NetworkedController *>(player_controller_node_data->node);
PlayerController *player_controller = controller->get_player_controller();

Expand Down

0 comments on commit d7995ef

Please sign in to comment.