Interleaved Thinking optimization: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Angua (talk | contribs)
No edit summary
m categorised
Line 11: Line 11:


The settings can be overwritten using cvars (for testing).
The settings can be overwritten using cvars (for testing).
{{ai}} {{coding}}

Revision as of 18:02, 20 May 2008

This optimization is used to reduce the effect of the AI's thinking routine on game performance. Depending on the distance to the player, AI will only think once in a certain number of frames. This includes the Mind (States and Tasks), path finding and physics. Multiply AI will think on different frames (started randomly). Interleaved thinking is switched off if the AI is in the player's view (it doesn't look good since the animations are not played properly, and AI alertness is reduced)

The settings can be adjusted for each AI via spawnargs.

  • min_interleave_think_dist: If the distance to the player is smaller than this, the AI will think every frame.
  • max_interleave_think_dist: If the distance to the player is larger than this, the AI will only think once in the number of frames given by max_interleave_think_frames. The thinking frequency decreases linearly between min and max dist.
  • max_interleave_think_frames: The AI will only think once in this number of frames if the distance to the player is larger than max_interleave_think_dist. Setting this to 1 will make the AI think every frame.


IMPORTANT! Do not set max_interleave_think_frames to high values (above 30). This will lead to path finding and physics problems, the AI might run into a wall and get damaged or even die.

The settings can be overwritten using cvars (for testing).