mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +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:
@@ -16,6 +16,7 @@
|
||||
#include "NetEventCallback.hpp"
|
||||
|
||||
class NetEventCallback;
|
||||
class Level;
|
||||
class LevelChunk;
|
||||
|
||||
enum ePacketType : uint8_t
|
||||
@@ -32,6 +33,8 @@ enum ePacketType : uint8_t
|
||||
PACKET_REQUEST_CHUNK,
|
||||
PACKET_CHUNK_DATA,
|
||||
PACKET_PLAYER_EQUIPMENT,
|
||||
|
||||
PACKET_LEVEL_DATA = 200,
|
||||
};
|
||||
|
||||
class Packet
|
||||
@@ -227,6 +230,19 @@ public:
|
||||
LevelChunk* m_pChunk;
|
||||
};
|
||||
|
||||
class LevelDataPacket : public Packet
|
||||
{
|
||||
public:
|
||||
LevelDataPacket() {}
|
||||
LevelDataPacket(Level* level) : m_pLevel(level) {}
|
||||
void handle(const RakNet::RakNetGUID&, NetEventCallback* pCallback) override;
|
||||
void write(RakNet::BitStream*);
|
||||
void read(RakNet::BitStream*);
|
||||
public:
|
||||
RakNet::BitStream m_data;
|
||||
Level* m_pLevel;
|
||||
};
|
||||
|
||||
class PlayerEquipmentPacket : public Packet
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user