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 : Remove unused personality calls in default skirmish AI code #6602

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

relent0r
Copy link
Contributor

@relent0r relent0r commented Dec 28, 2024

Description of the proposed changes

This PR removed unused code from the Skirmish AI factory and platoon former manager.
The personality function calls were present in both the factory manager and platoonformer manager.

In the factory manager they created a ptnsize variable that is unused.

In the platoonformer manager that are used twice in CanFormPlatoon and FormPlatoon as the platoon count parameter. I validated that in the default AI this is always returning 1. So I've removed the function calls and replaced with a static integer of 1.

Testing done on the proposed changes

Tested that this change has no bearing on the AI functionality, nor does it cause a desync when comparing an replay with and without the changes indicating it is doing nothing out of what has already been analyzed.

Additional context

The functions that are being modified are used by the AI multiple times per second so while removing the function calls may not seem like much it is saving some compute and memory.

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

@relent0r
Copy link
Contributor Author

@Dhomie These functions are also used in the campaign AI but I'm uncertain if they do anything. My understanding is that the personality system was never completed and required personality templates to be used (there was an example of this in an old piece of demo code in aipersonality.lua but to my knowledge this was never used by scfa.

@Dhomie
Copy link
Contributor

Dhomie commented Dec 28, 2024

It defaults to 1, I haven't encountered where it might be a different value.
The campaign AI is meant to be a blank template that the mission creator then customizes in the map files.
All in all this should be fine.

Edit: I have a modified campaign AI brain file in the works, but that's probably due for the next year, so if you want to, you can go ahead and adjust campaign-ai.lua.

@relent0r relent0r requested a review from Garanas December 29, 2024 04:56
@lL1l1 lL1l1 added the area: AI related to AI functions label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: AI related to AI functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants