From 4b0bc220e4da1173f742a4973939b139bef562db Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 21 Jul 2023 00:58:49 +1000 Subject: Support for changing the game's timescale Context-specific (like per-world) timescales can also be added later --- source/game/StarWorldServerThread.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/game/StarWorldServerThread.cpp') diff --git a/source/game/StarWorldServerThread.cpp b/source/game/StarWorldServerThread.cpp index c31ae84..e06221e 100644 --- a/source/game/StarWorldServerThread.cpp +++ b/source/game/StarWorldServerThread.cpp @@ -191,7 +191,7 @@ void WorldServerThread::run() { double storageInterval = root.assets()->json("/universe_server.config:worldStorageInterval").toDouble() / 1000.0; Timer storageTimer = Timer::withTime(storageInterval); - TickRateApproacher tickApproacher(1.0 / WorldTimestep, updateMeasureWindow); + TickRateApproacher tickApproacher(1.0 / ServerWorldTimestep, updateMeasureWindow); double fidelityScore = 0.0; WorldServerFidelity automaticFidelity = WorldServerFidelity::Medium; @@ -251,9 +251,10 @@ void WorldServerThread::update(WorldServerFidelity fidelity) { } } + float dt = ServerWorldTimestep * GlobalTimescale; m_worldServer->setFidelity(fidelity); if (!m_pause || *m_pause == false) - m_worldServer->update(); + m_worldServer->update(dt); for (auto& clientId : unerroredClientIds) { auto outgoingPackets = m_worldServer->getOutgoingPackets(clientId); -- cgit v1.2.3