X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclientiface.cpp;h=a3c44fb9e17468532e545dd5e3792b76f4925ae9;hb=549cfd9db80c858bdc8d23a237ea57ccf5f68400;hp=404ce0d4ed020339c7f1eba0ad676bebc4b97040;hpb=cdedaac5e299f71df72c2eb49ec52506467af831;p=dragonfireclient.git diff --git a/src/clientiface.cpp b/src/clientiface.cpp index 404ce0d4e..a3c44fb9e 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -125,7 +125,7 @@ void RemoteClient::GetNextBlocks ( if (playerspeed.getLength() > 1.0f * BS) playerspeeddir = playerspeed / playerspeed.getLength(); // Predict to next block - v3f playerpos_predicted = playerpos + playerspeeddir*MAP_BLOCKSIZE*BS; + v3f playerpos_predicted = playerpos + playerspeeddir * (MAP_BLOCKSIZE * BS); v3s16 center_nodepos = floatToInt(playerpos_predicted, BS); @@ -196,19 +196,28 @@ void RemoteClient::GetNextBlocks ( s16 wanted_range = sao->getWantedRange() + 1; float camera_fov = sao->getFov(); - const s16 full_d_max = std::min(m_max_send_distance, wanted_range); - const s16 d_opt = std::min(m_block_optimize_distance, wanted_range); + const s16 full_d_max = std::min(adjustDist(m_max_send_distance, camera_fov), wanted_range); + const s16 d_opt = std::min(adjustDist(m_block_optimize_distance, camera_fov), wanted_range); const s16 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE; //infostream << "Fov from client " << camera_fov << " full_d_max " << full_d_max << std::endl; s16 d_max = full_d_max; - s16 d_max_gen = std::min(m_max_gen_distance, wanted_range); + s16 d_max_gen = std::min(adjustDist(m_max_gen_distance, camera_fov), wanted_range); - // Don't loop very much at a time - s16 max_d_increment_at_time = 2; + // Don't loop very much at a time, adjust with distance, + // do more work per RTT with greater distances. + s16 max_d_increment_at_time = full_d_max / 9 + 1; if (d_max > d_start + max_d_increment_at_time) d_max = d_start + max_d_increment_at_time; + // cos(angle between velocity and camera) * |velocity| + // Limit to 0.0f in case player moves backwards. + f32 dot = rangelim(camera_dir.dotProduct(playerspeed), 0.0f, 300.0f); + + // Reduce the field of view when a player moves and looks forward. + // limit max fov effect to 50%, 60% at 20n/s fly speed + camera_fov = camera_fov / (1 + dot / 300.0f); + s32 nearest_emerged_d = -1; s32 nearest_emergefull_d = -1; s32 nearest_sent_d = -1;