Reliable channel used to finalize component updates

This commit is contained in:
Yousef Khadadeh 2025-10-01 08:59:44 +03:00
parent 14c6e7ceac
commit 278792a0ff
11 changed files with 36 additions and 28 deletions

View file

@ -172,13 +172,14 @@ MainServer::MainServer(World& initWorld, const std::string& serverLocalID):
DrawComponent::server_send_transform_many(*this, transformsToSend);
});
netServer->add_recv_callback(SERVER_UPDATE_COMPONENT, [&](std::shared_ptr<NetServer::ClientData> client, cereal::PortableBinaryInputArchive& message) {
bool isFinalUpdate;
ServerClientID idToUpdate;
message(idToUpdate);
message(isFinalUpdate, idToUpdate);
auto it = data.idToComponentMap.find(idToUpdate);
if(it != data.idToComponentMap.end()) {
std::shared_ptr<DrawComponent>& comp = it->second;
message(*comp);
comp->server_send_update(*this);
comp->server_send_update(*this, isFinalUpdate);
}
});
netServer->add_recv_callback(SERVER_RESOURCE_INIT, [&](std::shared_ptr<NetServer::ClientData> client, cereal::PortableBinaryInputArchive& message) {