make chunks delay less for dedi

This commit is contained in:
sylvessa 2026-03-15 00:25:50 -05:00
parent 5f4b038d54
commit 189ff3e038
2 changed files with 22 additions and 14 deletions

View file

@ -2375,6 +2375,9 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
{ {
if( player == nullptr ) return false; if( player == nullptr ) return false;
#ifdef MINECRAFT_SERVER_BUILD
return true;
#else
int time = GetTickCount(); int time = GetTickCount();
DWORD currentPlayerCount = g_NetworkManager.GetPlayerCount(); DWORD currentPlayerCount = g_NetworkManager.GetPlayerCount();
if( currentPlayerCount == 0 ) return false; if( currentPlayerCount == 0 ) return false;
@ -2386,6 +2389,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
} }
return false; return false;
#endif
} }
void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer *player) void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer *player)

View file

@ -376,6 +376,9 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
// connection->done); // connection->done);
// } // }
#ifdef MINECRAFT_SERVER_BUILD
if (dontDelayChunks || (canSendToPlayer && !connection->done))
#else
if( dontDelayChunks || if( dontDelayChunks ||
(canSendToPlayer && (canSendToPlayer &&
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
@ -390,21 +393,22 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
#endif #endif
//(tickCount - lastBrupSendTickCount) > (connection->getNetworkPlayer()->GetCurrentRtt()>>4) && //(tickCount - lastBrupSendTickCount) > (connection->getNetworkPlayer()->GetCurrentRtt()>>4) &&
!connection->done) ) !connection->done) )
{ #endif
lastBrupSendTickCount = tickCount; {
okToSend = true; lastBrupSendTickCount = tickCount;
MinecraftServer::chunkPacketManagement_DidSendTo(connection->getNetworkPlayer()); okToSend = true;
MinecraftServer::chunkPacketManagement_DidSendTo(connection->getNetworkPlayer());
// static unordered_map<wstring,int64_t> mapLastTime; // static unordered_map<wstring,int64_t> mapLastTime;
// int64_t thisTime = System::currentTimeMillis(); // int64_t thisTime = System::currentTimeMillis();
// int64_t lastTime = mapLastTime[connection->getNetworkPlayer()->GetUID().toString()]; // int64_t lastTime = mapLastTime[connection->getNetworkPlayer()->GetUID().toString()];
// app.DebugPrintf(" - OK to send (%d ms since last)\n", thisTime - lastTime); // app.DebugPrintf(" - OK to send (%d ms since last)\n", thisTime - lastTime);
// mapLastTime[connection->getNetworkPlayer()->GetUID().toString()] = thisTime; // mapLastTime[connection->getNetworkPlayer()->GetUID().toString()] = thisTime;
} }
else else
{ {
// app.DebugPrintf(" - <NOT OK>\n"); // app.DebugPrintf(" - <NOT OK>\n");
} }
} }
if (okToSend) if (okToSend)