View Issue Details

IDProjectCategoryView StatusLast Update
0006703The Dark ModCodingpublic09.05.2026 17:56
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeveritynormalReproducibilityhave not tried
Status resolvedResolutionfixed 
Product VersionTDM 2.14 
Target VersionTDM 2.15Fixed in VersionTDM 2.15 
Summary0006703: Sharp movements in AI animation transitions on high FPS
DescriptionWhen guards go on patrol and turn on path_corner, they often do quick and weird movement on high FPS.
It does not happen on FPS < 60 though.
Steps To ReproduceExecute "map turn" on SVN assets.
Additional InformationOriginally reported here:
  https://forums.thedarkmod.com/index.php?/topic/23142-npcs-swaying-from-side-to-side-while-turning-procedural-animation/#comment-507684
TagsNo tags attached.

Relationships

related to 0006701 resolvedstgatilov Broken AI with vsync off, uncap FPS on and high FPS 
related to 0001450 closedgreebo Stutter in animation upon reaching path_corner 

Activities

stgatilov

stgatilov

20.04.2026 15:01

administrator   ~0017266

Most likely caused by waits of 16 ms instead of one frame in animation script code.

During 0004772, nbohr1more replaced all waitFrame with wait(16 ms) in r15198, r15199
I guess now it's time to go through these waits one by one and replace most of them back to waitFrame.
stgatilov

stgatilov

20.04.2026 15:02

administrator   ~0017267

Also note that in svn rev 11287 I changed behavior of waitFrame, so that it always waits for 1 frame.
For some reason previously it waited 16 ms for normal threads, but "until next call" for the so-called "manual-control" frames, which include Actor/AI threads.
stgatilov

stgatilov

09.05.2026 11:01

administrator   ~0017310

Last edited: 09.05.2026 12:06

Note: I have reverted svn revs 15198-15199 in revs 17547-17548.
Reviewed all the changed, did not find anything bad related to bow.
Moreover, I can't see any difference in bow shooting between 500 FPS and the old "capped FPS" mode.

Found some bad code in tdm_util.script (fadeOutEnt, interpolateShaderParm and similar).
Fixed in svn rev 17550.

Unfortunately, the sharp movement on turn is still there.
There are some extra waits in Legs_Idle and Torso_Turn, maybe will try to play around with them later.

Also, here is an interesting observation: animation logically runs at 24 frames per second in the engine.
So if someone sets e.g. "6 blend frames" between animations, it is actually 1/4 seconds =)
stgatilov

stgatilov

09.05.2026 14:11

administrator   ~0017311

Last edited: 09.05.2026 14:11

Wow, I think this issue is caused by the same error as in 0006701: trying to estimate velocity based on frame numbers and frame deltas:
    // Position last time this task was executed, used for path prediction
    idVec3 _lastPosition;
    // Frame this task was last executed
    int _lastFrameNum;
    // Whether to anticipate the AI reaching path corners
    bool _usePathPrediction;
stgatilov

stgatilov

09.05.2026 17:54

administrator   ~0017312

Fixed in svn rev 11325.

In fact, these stutters have a history: 0001450.
The stutters were fixed before the first TDM release =)
with a rather weird "predition" hack I referenced just above.

The true cause of the issue is the optimization of AI mind's subsystems.
As far as I see, the optimization is completely useless (at least today), so I have have simply disabled it along with the prediction hack.
You can enable it back by setting "tdm_ai_opt_interleave_subsystems 1".

Issue History

Date Modified Username Field Change
20.04.2026 15:00 stgatilov New Issue
20.04.2026 15:00 stgatilov Status new => assigned
20.04.2026 15:00 stgatilov Assigned To => stgatilov
20.04.2026 15:01 stgatilov Note Added: 0017266
20.04.2026 15:02 stgatilov Note Added: 0017267
09.05.2026 11:01 stgatilov Note Added: 0017310
09.05.2026 12:06 stgatilov Note Edited: 0017310
09.05.2026 14:10 stgatilov Relationship added related to 0006701
09.05.2026 14:11 stgatilov Note Added: 0017311
09.05.2026 14:11 stgatilov Note Edited: 0017311
09.05.2026 14:18 stgatilov Relationship added related to 0001450
09.05.2026 17:54 stgatilov Note Added: 0017312
09.05.2026 17:56 stgatilov Status assigned => resolved
09.05.2026 17:56 stgatilov Resolution open => fixed
09.05.2026 17:56 stgatilov Fixed in Version => TDM 2.15