From a6b6ac870a176c16608c0ba1f0d673fc7bc383a3 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Wed, 13 Dec 2023 13:01:52 -0500 Subject: [PATCH] Update sync plus vite. --- SQCSim-srv/connection.cpp | 4 ++-- SQCSim2021/engine.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SQCSim-srv/connection.cpp b/SQCSim-srv/connection.cpp index 669ae8f..1c823ce 100644 --- a/SQCSim-srv/connection.cpp +++ b/SQCSim-srv/connection.cpp @@ -91,8 +91,8 @@ void Connection::sendPacks(SOCKET sock, std::unordered_map= 1000) { - outs -= 1000; + if (outs >= 200) { + outs -= 200; Sync sync; sync.hp = player->GetHP(); sync.timestamp = out.timestamp; diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 5a7a186..b22fd26 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -1453,8 +1453,8 @@ void Engine::Render(float elapsedTime) { cmod_acc += tstamp - last; last = tstamp; - if (sync_acc >= 1000) { - sync_acc -= 1000; + if (sync_acc >= 200) { + sync_acc -= 200; sync.sid = id; sync.timestamp = tstamp; sync.position = m_player.GetPositionAbs(); @@ -1466,9 +1466,9 @@ void Engine::Render(float elapsedTime) { m_syncs[sync.timestamp] = sync; } - if (cmod_acc >= 3000) { - while (cmod_acc >= 3000) - cmod_acc -= 3000; + if (cmod_acc >= 2000) { + while (cmod_acc >= 2000) + cmod_acc -= 2000; if (!m_chunkmod_manifest.empty()) { ChunkMod* cmod = m_chunkmod_manifest.front(); m_chunkmod_manifest.pop_front(); @@ -1511,7 +1511,7 @@ void Engine::Render(float elapsedTime) { Sync comp = m_syncs[sync.timestamp]; std::cout << sync.hp << std::endl; - + m_otherplayerpos = sync.position; m_player.InflictDamage(sync.hp - comp.hp); Vector3f diff = sync.position - comp.position;