Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ai behavior when avoiding ship and weapon shockwaves #6378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 10, 2024

  1. fix ai behavior when avoiding ship and weapon shockwaves

    The FreeSpace AI includes behavior to run away from shockwaves to try to avoid explosion damage.  This is implemented for both ships and missiles, although the missile implementation has been buggy ever since retail.  There are several issues:
    
    1. The AI attempts to evade a weapon immediately upon launch.  Many missiles have a period of free flight before they start homing on their target.  During the free flight period, the homing position is not set.  Consequently, the AI will not know the position to avoid and will make assumptions.
    2. The AI assumes the shockwave-producing weapon will detonate at the center of the ship it is targeting, although missiles detonate on the surface.  A capital ship is likely to be significantly larger than the weapon's blast radius, leading the AI to believe the detonation will be much farther away than it actually is.
    3. When avoiding ship shockwaves, the `shockwave_object` field is not cleared when avoiding is complete.  This can result in stale references (though not crashes, due to object type checks), causing AI to not avoid future explosions in certain cases.
    4. When avoiding ship shockwaves, the code does not check the correct ship for the amount of damage caused by the shockwave.
    
    All of these issues are now fixed.  Since this is a change in AI behavior, these fixes are tied to a new AI profiles flag.
    Goober5000 committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    73cff97 View commit details
    Browse the repository at this point in the history