Page 1 of 1
Interpolated Frame Number
Posted: 25 Oct 2009, 16:51
by KDR_11k
For some continuous animations in Lua it'd be helpful to get the frame number as a float with the current prediction distance added in (so if the currently visible state is interpolated half-way between frame 34 and 35 the result would be 34.5 instead of the 34 GetGameFrame would deliver). Obviously only in unsynced but would help greatly with smoothing stuff out. Maybe also gave a callout to get a unit's currently predicted position for effects that are attached to the units and shouldn't lag behind just to snap to the next position at every frame change?
Re: Interpolated Frame Number
Posted: 25 Oct 2009, 17:00
by aegis
can't you do this roughly with lua already? time the last frame or last X frames, use it as a rough frame time, then don't literally sync with the actual frames so there's no snapping... just average it out so it smoothly stays close to the actual frame.
Re: Interpolated Frame Number
Posted: 25 Oct 2009, 17:35
by jK
http://springrts.com/wiki/Lua_UnsyncedRead#Time
what do you think Spring.GetFrameTimeOffset() is doing?
Re: Interpolated Frame Number
Posted: 25 Oct 2009, 20:03
by KDR_11k
I assume it does what the topic is about since otherwise you wouldn't post it here but I wouldn't have known otherwise.