Interleaved Thinking optimization: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Angua (talk | contribs)
No edit summary
Fidcal (talk | contribs)
No edit summary
Line 10: Line 10:


The settings in the spwan args can be overwritten using [[Cvars]] (for testing only). It is also possible to switch the PVS check off so that AI can also do interleaved thinking while in the player's view.
The settings in the spwan args can be overwritten using [[Cvars]] (for testing only). It is also possible to switch the PVS check off so that AI can also do interleaved thinking while in the player's view.
'''(These are default values as at August 2009:'''
max_interleave_think_frames 10
min_interleave_think_dist 1000
max_interleave_think_dist 3000
      ''AI think every 10 frames''
3000 -----------------------------------------------------
      ''AI think every 1 to 10 frames (proportional to distance)''
1000 -----------------------------------------------------
      ''AI think every frame''
0000 -----------------------------------------------------


{{ai}} {{sdk}} {{editing}}
{{ai}} {{sdk}} {{editing}}

Revision as of 07:01, 27 August 2009

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. Multiple 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 (in the def file or on the entity in the map).

  • 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 in the spwan args can be overwritten using Cvars (for testing only). It is also possible to switch the PVS check off so that AI can also do interleaved thinking while in the player's view.


(These are default values as at August 2009:

max_interleave_think_frames 10

min_interleave_think_dist 1000

max_interleave_think_dist 3000


     AI think every 10 frames
3000 -----------------------------------------------------

     AI think every 1 to 10 frames (proportional to distance)

1000 -----------------------------------------------------
     AI think every frame
0000 -----------------------------------------------------