Drive animation clocks from real frame time

Water, network-actor, flying-effect and weapon-trace clocks used
frames*0.033 or frames/60, and the sky box, effect.Update, fly.Update and
render-target previews advanced a fixed 1/30 or 1/60 s per call, so their
speed followed the frame rate. They now use the measured frame delta
(game_clock = sum of dt in main; GetGameFrameDelta for the Python-driven
paths; elapsed SDL ticks for render targets). --frames runs keep their
fixed 0.033 s step. The SpeedTree wind update is left unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-12 17:44:04 +09:00
co-authored by Claude Opus 5.5
parent 71f393bbd1
commit 6282199179
7 changed files with 23 additions and 12 deletions
+1
View File
@@ -485,6 +485,7 @@ PyObject* app_set_guild_mark_path(PyObject*, PyObject* args) {
void GetCameraInput(int& rotate,int& pitch,int& zoom) { rotate=cameraRotateInput; pitch=cameraPitchInput; zoom=cameraZoomInput; }
void StopCameraInput() { cameraRotateInput=cameraPitchInput=cameraZoomInput=0; }
void SetGameFrameDelta(float dt) { gameFrameDelta = std::clamp(dt, 0.001f, 0.25f); }
float GetGameFrameDelta() { return gameFrameDelta; }
std::int32_t GetServerTimeStamp() { return server_clock.timestamp(unix_seconds()); }
void SetServerTime(std::int32_t time) { server_clock.set(time,local_milliseconds(),unix_seconds()); }
std::uint32_t GetLocalMSec() { return local_milliseconds(); }
+1
View File
@@ -20,6 +20,7 @@ unsigned GetDefaultCodePage();
bool LoadLocaleData(const std::string& localePath);
float GetCameraZoomSpeed();
void SetGameFrameDelta(float dt);
float GetGameFrameDelta();
void GetCameraInput(int& rotate,int& pitch,int& zoom);
void StopCameraInput();
bool ConsumeCameraSetting(float& distance,float& pitch,float& yaw,float& height);
+2 -1
View File
@@ -1,4 +1,5 @@
#include "python_background.h"
#include "python_app.h"
#include "python_minimap.h"
#include "python_runtime.h"
#include "python_system.h"
@@ -596,7 +597,7 @@ void CPythonBackground::Update(float fCenterX, float fCenterY, float fCenterZ) {
m_mapObjects->SetLoadingCenter(fCenterX, fCenterZ, std::max(5000.0f, CPythonSystem::Instance().GetObjectDistance()));
}
if (m_skybox) {
m_skybox->Update(0.033f);
m_skybox->Update(GetGameFrameDelta());
}
if (m_forest) {
m_forest->UpdateSystem(0.033f);
+4 -2
View File
@@ -750,7 +750,7 @@ static PyObject* effect_RegisterIndexedFlyData(PyObject*, PyObject* args) {
}
static PyObject* effect_Update(PyObject*, PyObject*) {
ava2::EffectManager::Instance().Update(1.0f / 60.0f);
ava2::EffectManager::Instance().Update(ava2::GetGameFrameDelta());
Py_RETURN_NONE;
}
@@ -795,7 +795,9 @@ void initeffect() {
}
static PyObject* fly_Update(PyObject*, PyObject*) {
ava2::FlyingManager::Instance().Update(1.0f / 60.0f, 0.0f);
static float flyingTime = 0.0f;
flyingTime += ava2::GetGameFrameDelta();
ava2::FlyingManager::Instance().Update(ava2::GetGameFrameDelta(), flyingTime);
Py_RETURN_NONE;
}