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

Medical - Improve injured sound by exiting the function earlier if no player is around #7521

Merged
merged 5 commits into from
Jun 20, 2020

Conversation

Vdauphin
Copy link
Contributor

@Vdauphin Vdauphin commented Feb 11, 2020

I notice ace_medical_feedback_fnc_playInjuredSound take an average time of execution around 300µs (~1000 call) even when no player is around the injured AI.

Sans titre

The idea of this PR is to reduce this value by exiting the function earlier.

When merged this pull request will:

  • Describe what this pull request will do
    • Exit the ace_medical_feedback_fnc_playInjuredSound earlier if no player is around
  • Each change in a separate line
    • Get the hearing distance
    • Check if players are around
    • Exit if no players

@commy2
Copy link
Contributor

commy2 commented Feb 11, 2020

This does not seem like a good idea to me.

Co-Authored-By: commy2 <commy-2@gmx.de>
Copy link
Contributor

@commy2 commy2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not work as expected.

If any player is inside the area then the _targets will not be empty. This also handle the case where player is inside a vehicle or _unit is a player.
@Vdauphin Vdauphin requested a review from commy2 May 22, 2020 11:23
@jonpas jonpas added the kind/optimization Release Notes: **IMPROVED:** label May 22, 2020
@jonpas jonpas added this to the 3.13.3 milestone May 22, 2020
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
@commy2
Copy link
Contributor

commy2 commented Jun 13, 2020

I don't get the handling z part. We don't want to mute all moans if you are 70 or whatever meters above the ground. Just leave the z out and it will handle all untis in the cylinder.

commy2
commy2 previously requested changes Jun 13, 2020
Copy link
Contributor

@commy2 commy2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PabstMirror
Copy link
Contributor

PabstMirror commented Jun 13, 2020

it's a distance check between the audio source and a player
adding the extra params makes it a 3d sphere search, instead of a 2d cylinder

e.g. player in a helicopter, 100m above a target, there is no reason to send the say3d event

@PabstMirror PabstMirror requested a review from commy2 June 18, 2020 16:36
Copy link
Member

@jonpas jonpas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@PabstMirror PabstMirror merged commit e9c1f5e into acemod:master Jun 20, 2020
@Vdauphin Vdauphin deleted the FIX-playInjuredSound_too_far branch June 20, 2020 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/optimization Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants