Interleaved Thinking optimization: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Angua (talk | contribs)
No edit summary
Tels (talk | contribs)
m fix typo
 
(2 intermediate revisions by 2 users not shown)
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 (August 2009):'''
<pre>
max_interleave_think_frames 10
min_interleave_think_dist 1000
max_interleave_think_dist 3000
</pre>
So if the distance to the player is less than 1000 units, the AI thinks every frame, if it is between 1000 and 3000 units, it thinks every 1 .. 10 frames (proportional to distance), and if it is further away than 3000 units it thinks every 10 frames.


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

Latest revision as of 15:48, 14 December 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 (August 2009):

max_interleave_think_frames 10

min_interleave_think_dist 1000

max_interleave_think_dist 3000

So if the distance to the player is less than 1000 units, the AI thinks every frame, if it is between 1000 and 3000 units, it thinks every 1 .. 10 frames (proportional to distance), and if it is further away than 3000 units it thinks every 10 frames.