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

AI - Increase distance limits for Naval Area marker generation #6048

Open
wants to merge 8 commits into
base: deploy/fafdevelop
Choose a base branch
from

Conversation

relent0r
Copy link
Contributor

@relent0r relent0r commented Apr 4, 2024

Description of changes

This PR increases the distance limits when the navmesh is generating Naval Area markers for the AI. This allows larger maps where the distance from water is greater than smaller maps allowing AI to still have a naval presence.

Testing method
Start a 20km then 40km map and check the locations of the Naval Area markers using the Map Utilities window (see game key bindings under debug).

Notes
The decision to limit and decide which expansion should be used falls to the AI.

I would ideally like to be able to have another parameter for the GenerateForExpansion that can perform a sort by distance and allow the developer to select a Naval Area maximum count taking the closest first per marker type. That would minimize the number of markers generated and still provide flexibility for the various map types.

Known maps that had issues include Flooded Strip Mine, Liberiam Battles. There is also a 40km remake of The Wilderness which comes from the LOUD mod which was used for testing as this map featured navy but the initial distance to water for certain start positions was very high.

Testing :
Open map utilities window and set Naval Area markers as visible. Test with and without PR on a map like seraphim glaciers to see the difference with expansion markers. Then another map like flooded strip mine where the naval areas are further away to see the difference between the two.

@relent0r relent0r marked this pull request as draft April 5, 2024 03:19
@relent0r
Copy link
Contributor Author

relent0r commented Apr 5, 2024

@Garanas I had to pop this back into draft and it produced some crazy numbers of naval areas on certain maps.

Are you able to either assist or suggest how I could go about updating the GenerateForExpansion to support a count of markers that would sort the locations by distance then return just the closest count. I've got a good idea on how to do it but I'm not sure if I'll potentially add a big chunk of overhead to the marker generation.

e.g
GenerateForExpansion(largeExpansions[k], thresholdDistance, thresholdSize, thresholdArea, maximumCount)

Then within that function add all the markers to an intermediate table, sort by distance, then loop through based on the count if specified starting from the closest adding to the Markers table.

I've done a POC in this branch so you can see what I was thinking of.

edit : Looking at the results perhaps having a maximum count for the other marker types would be useful as well. Testing on seraphim glaciers and it looks like it would be useful for the center island etc.

@relent0r relent0r marked this pull request as ready for review April 5, 2024 23:03
@Garanas
Copy link
Member

Garanas commented Apr 7, 2024

Are you able to either assist or suggest how I could go about updating the GenerateForExpansion to support a count of markers that would sort the locations by distance then return just the closest count. I've got a good idea on how to do it but I'm not sure if I'll potentially add a big chunk of overhead to the marker generation.

If it is done once at the start of the game then a tiny bit of overhead is fine!

@relent0r relent0r marked this pull request as draft April 9, 2024 19:56
@relent0r relent0r marked this pull request as ready for review April 9, 2024 19:57
@relent0r relent0r added the area: AI related to AI functions label Apr 9, 2024
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.

None yet

2 participants