diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index fa8d97b..fb26dcc 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -168,7 +168,6 @@ void ClientApplication::applicationInit(ApplicationControllerPtr appController) m_guiContext = make_shared(m_mainMixer->mixer(), appController); - appController->setTargetUpdateRate(1.0f / WorldTimestep); auto configuration = m_root->configuration(); bool vsync = configuration->get("vsync").toBool(); @@ -178,6 +177,16 @@ void ClientApplication::applicationInit(ApplicationControllerPtr appController) bool borderless = configuration->get("borderless").toBool(); bool maximized = configuration->get("maximized").toBool(); + float updateRate = 1.0f / WorldTimestep; + if (auto jUpdateRate = configuration->get("updateRate")) { + updateRate = jUpdateRate.toFloat(); + WorldTimestep = 1.0f / updateRate; + } + + if (auto jServerUpdateRate = configuration->get("serverUpdateRate")) + ServerWorldTimestep = 1.0f / jServerUpdateRate.toFloat(); + + appController->setTargetUpdateRate(updateRate); appController->setApplicationTitle(assets->json("/client.config:windowTitle").toString()); appController->setVSyncEnabled(vsync); diff --git a/source/game/StarGameTypes.cpp b/source/game/StarGameTypes.cpp index 0ea2c6e..e1069d5 100644 --- a/source/game/StarGameTypes.cpp +++ b/source/game/StarGameTypes.cpp @@ -2,8 +2,10 @@ namespace Star { -float WorldTimestep = 1.0f / 120.0f; -float ServerWorldTimestep = 1.0f / 20.0f; +float WorldTimestep = 1.0f / 60.0f; + +// This is used to correct interpolation. It must match the timestep of the server you are connected to. +float ServerWorldTimestep = 1.0f / 60.0f; EnumMap const DirectionNames{ {Direction::Left, "left"},