Skip to content

Add new option for 'better combat collision avoidance'#7036

Merged
wookieejedi merged 1 commit into
scp-fs2open:masterfrom
wookieejedi:enhance-combat-collision-avoidance
Sep 15, 2025
Merged

Add new option for 'better combat collision avoidance'#7036
wookieejedi merged 1 commit into
scp-fs2open:masterfrom
wookieejedi:enhance-combat-collision-avoidance

Conversation

@wookieejedi

Copy link
Copy Markdown
Member

The $better combat collision avoidance for fightercraft: flag is incredibly useful in preventing AI from hitting large ships while attacking, and the ability to tune the collision avoidance aggression factor further helps mods tune behavior based on their ship speeds (tuning that value is via +combat collision avoidance aggression for fightercraft: ). Nevertheless, the improve collision avoidance still is not performed for that actual fightercraft's actual target, so there can be situations where a fast fighter attacks a large ship with high speed, and then when that fighter break off from the attack they turn directly into the large ship's hull. Allowing the target to be incorporated into the better_collision_avoidance_triggered check prevents this from happening. To allow the target to be a part of the checks we just simply need to not pass an 'ignor_shipargument tomaybe_avoid_big_ship`.

This PR adds that ability via flag. This new flag is tested and works as expected. For example, without the flag a squadron of TIEs in FotG would literally ram themselves to death attacking some of our larger capital ships because they would break off attack too late, but with this flag they no longer accidentally collide at all. In discussion with Asteroth it was decided to make this enhanced behavior behind a flag, too.

This PR also fixes a small oversight from the original #2810 where next_check_time was never actually used within the else block of maybe_avoid_big_ship.

The `$better combat collision avoidance for fightercraft:` flag is incredibly useful in preventing AI from hitting large ships while attacking, and the ability to tune the collision avoidance aggression factor further helps mods tune behavior based on their ship speeds (tuning that value is via `+combat collision avoidance aggression for fightercraft:` ). Nevertheless, the improve collision avoidance still is not performed for that actual fightercraft's actual target, so there can be situations where a fast fighter attacks a large ship with high speed, and then when that fighter break off from the attack they turn directly into the large ship's hull. Allowing the target to be incorporated into the `better_collision_avoidance_triggered` check prevents this from happening. To allow the target to be a part of the checks we just simply need to not pass an 'ignor_ship` argument to `maybe_avoid_big_ship`.

This PR adds that ability via flag. This new flag is tested and works as expected. For example, without the flag a squadron of TIEs in FotG would literally ram themselves to death attacking some of our larger capital ships because they would break off attack too late, but with this flag they no longer accidentally collide at all. In discussion with Asteroth it was decided to make this enhanced behavior behind a flag, too.

This PR also fixes a small oversight from the original scp-fs2open#2810 where `next_check_time` was never actually used within the `else` block of `maybe_avoid_big_ship`.
@wookieejedi wookieejedi added enhancement A new feature or upgrade of an existing feature to add additional functionality. cleanup A modification or rewrite of code to make it more understandable or easier to maintain. ai A feature or issue related to the AI algorithms Requested by Active Mod A feature request that has been requested by a mod that is actively in development. labels Sep 14, 2025
@wookieejedi wookieejedi merged commit d42789d into scp-fs2open:master Sep 15, 2025
20 checks passed
@wookieejedi wookieejedi deleted the enhance-combat-collision-avoidance branch September 15, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai A feature or issue related to the AI algorithms cleanup A modification or rewrite of code to make it more understandable or easier to maintain. enhancement A new feature or upgrade of an existing feature to add additional functionality. Requested by Active Mod A feature request that has been requested by a mod that is actively in development.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants