PathfindingLagFix
Lethal Company mod to fix stutters caused by the AI of Brackens, Spore Lizards, and Snare Fleas.
Date uploaded | 3 months ago |
Version | 1.2.2 |
Download link | Zaggy1024-PathfindingLagFix-1.2.2.zip |
Downloads | 67571 |
Dependency string | Zaggy1024-PathfindingLagFix-1.2.2 |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
PathfindingLagFix
This modifies the Bracken, Snare Flea and Spore Lizard AI to prevent large stutters that can occur every 200ms in some situations, by spreading the load of checking hundreds of paths over multiple frames.
Details
- The EnemyAI.ChooseFarthestNodeFromPosition() function could end up checking 180+ nav mesh nodes for accessibility, if most or none of them were accessible. This could happen if the enemy was not on the nav mesh, or if the function call required line of sight and players were blocking most of the map from access. The following cases have been patched:
- This would occur for the Bracken if it spawned outside, since it has no outside nodes, or if the bracken was in a dead end with a player watching the exit.
- The Spore Lizard also uses the same function to check for a path away from the player out of line of sight.
- The Snare Flea searches for a location far from the main door if no players are targetable. This check could take some time even under normal circumstances due to trying to find a node midway through the accessible nodes. It would always occur if the Snare Flea fell out of the playable area.
- There may be other cases where this type of issue could occur. Please report any cases to investigate with steps to reproduce the lag.
Notes
FixCentipedeLag Compatibility
PathfindingLagFix is an alternative to FixCentipedeLag, which aims to remove the lag caused by Snare Fleas. PathfindingLagFix also prevents the stutters that FixCentipedeLag avoids, but does so in such a way that the AI's behavior should be unchanged, whereas FixCentipedeLag will kill Snare Fleas almost instantly if no players are inside the building where Snare Fleas can target them.
CHANGELOG
Version 1.4.0
- Brought back the patch for lag caused when the Bracken has no player target and is therefore pathing to the furthest position from the interior entrance. This would often occur when the player jumps.
Version 1.3.1
- Updated mod icon and Thunderstore summary.
Version 1.3.0
- Updated to support v60/v61, removing patches for the Bracken and Spore Lizard now that vanilla uses an async method for those AI.
Version 1.2.1
- Removed some debug spam that would happen while a Snare Flea is retreating with no target players.
Version 1.2.0
- Prevent stutters caused by Snare Fleas finding a far location when there are no players to target.
- This pathfinding would always happen if a Snare Flea spawned while no players are within the building.
- More often in normal gameplay, it would occur if the Snare Flea fell off the playable area, since this would make all players untargetable, as well as make the search for a far location eventually fail.
- NOTE: This may not cover all cases of lag caused by Snare Fleas. When they are running from a kill, they look for the nearest location that is accessible out of line of sight. If all line of sight checks fail, there may be stutters.
Version 1.1.0
- Fixed stutters that would happen when Spore Lizards run from the player.
Version 1.0.1
- Removed printing of the FlowermanAI.DoAIInterval() bytecode.
Version 1.0.0
- Fixed stutters that could occur when Brackens are retreating.
- Fixed stutters that always occur when Brackens spawn outside or are not on the nav mesh.