Update sync plus vite.

This commit is contained in:
MarcEricMartel 2023-12-13 13:01:52 -05:00
parent 5ef6ab5006
commit a6b6ac870a
2 changed files with 8 additions and 8 deletions

View File

@ -91,8 +91,8 @@ void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*
outs += out.timestamp + last; outs += out.timestamp + last;
if (outs >= 1000) { if (outs >= 200) {
outs -= 1000; outs -= 200;
Sync sync; Sync sync;
sync.hp = player->GetHP(); sync.hp = player->GetHP();
sync.timestamp = out.timestamp; sync.timestamp = out.timestamp;

View File

@ -1453,8 +1453,8 @@ void Engine::Render(float elapsedTime) {
cmod_acc += tstamp - last; cmod_acc += tstamp - last;
last = tstamp; last = tstamp;
if (sync_acc >= 1000) { if (sync_acc >= 200) {
sync_acc -= 1000; sync_acc -= 200;
sync.sid = id; sync.sid = id;
sync.timestamp = tstamp; sync.timestamp = tstamp;
sync.position = m_player.GetPositionAbs(); sync.position = m_player.GetPositionAbs();
@ -1466,9 +1466,9 @@ void Engine::Render(float elapsedTime) {
m_syncs[sync.timestamp] = sync; m_syncs[sync.timestamp] = sync;
} }
if (cmod_acc >= 3000) { if (cmod_acc >= 2000) {
while (cmod_acc >= 3000) while (cmod_acc >= 2000)
cmod_acc -= 3000; cmod_acc -= 2000;
if (!m_chunkmod_manifest.empty()) { if (!m_chunkmod_manifest.empty()) {
ChunkMod* cmod = m_chunkmod_manifest.front(); ChunkMod* cmod = m_chunkmod_manifest.front();
m_chunkmod_manifest.pop_front(); m_chunkmod_manifest.pop_front();
@ -1511,7 +1511,7 @@ void Engine::Render(float elapsedTime) {
Sync comp = m_syncs[sync.timestamp]; Sync comp = m_syncs[sync.timestamp];
std::cout << sync.hp << std::endl; std::cout << sync.hp << std::endl;
m_otherplayerpos = sync.position;
m_player.InflictDamage(sync.hp - comp.hp); m_player.InflictDamage(sync.hp - comp.hp);
Vector3f diff = sync.position - comp.position; Vector3f diff = sync.position - comp.position;