mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-11 20:11:18 +03:00
* Improve the level sending mechanism in the game.
Instead of sending a request for each chunk one by one, and in sequence, send all the level data in one block. I know this is not the best solution since we are working with UDP here, but it's way faster than loading the level chunk by chunk. In a blink of an eye, the level has already loaded.
This commit is contained in:
@@ -113,7 +113,7 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LoginPacke
|
||||
sgp.field_10 = pPlayer->m_pos.x;
|
||||
sgp.field_14 = pPlayer->m_pos.y - pPlayer->field_84;
|
||||
sgp.field_18 = pPlayer->m_pos.z;
|
||||
sgp.m_version = 1;
|
||||
sgp.m_version = 2;
|
||||
sgp.m_time = m_pLevel->getTime();
|
||||
|
||||
RakNet::BitStream sgpbs;
|
||||
@@ -292,6 +292,12 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, RequestChu
|
||||
{
|
||||
puts_ignorable("RequestChunkPacket");
|
||||
|
||||
if (packet->m_x == -9999)
|
||||
{
|
||||
m_pRakNetInstance->send(guid, new LevelDataPacket(m_pLevel));
|
||||
return;
|
||||
}
|
||||
|
||||
LevelChunk* pChunk = m_pLevel->getChunk(packet->m_x, packet->m_z);
|
||||
if (!pChunk)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user