서버-사이드 충돌판정 구현 중

This commit is contained in:
2025-06-21 00:36:50 +09:00
parent 66dc91dab3
commit 3a526edcf4
3 changed files with 45 additions and 3 deletions

View File

@@ -10,6 +10,7 @@
#include "utils/snowflake.h"
#include "utils/utils.h"
#include "vulkan_engine/asset/object/model.h"
#include "vulkan_engine/vulkan/physics.h"
#define LISTENIP "::"
#define LISTENPORT 9010
@@ -46,9 +47,12 @@ void EchoClient(utils::ThreadPool* tp, Network::IOCP* iocp,
std::lock_guard lock(MODELS_MUTEX);
auto ID = model.ID;
if (MODELS.find(ID) == MODELS.end())
if (MODELS.find(ID) == MODELS.end()) {
spdlog::info("model received: {}:{}", model.name, ID.snowflake);
MODELS[ID] = std::move(model);
MODELS[ID] = std::move(model);
} else {
MODELS[ID].Deserialize(recv_data);
}
MODELS[ID].needsUpdate = true;
} break;
default:
@@ -112,6 +116,7 @@ void ClientRefresher(utils::ThreadPool* tp, Network::IOCP* iocp) {
for (auto& model : MODELS) {
if (model.second.name == "camera_lag") continue;
model.second.Update(delta_time);
veng::Physics::invokeOnColisionEvent(tp, MODELS);
for (auto& client : CLIENTS) {
if (client->sock == 0) continue;
std::vector<char> send_data;