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 hooks and navmesh rebaking modifiers #515

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

Conversation

read-0nly
Copy link

@read-0nly read-0nly commented May 22, 2024

Adds the following hooks:

  • AI\OnAICaresAbout
  • AI\OnAIInitialize
  • NPC\OnGetBestRoamPoint
  • Turret\OnTurretCheckHostile
  • Turret\OnTurretShouldTarget

Adds the following modifiers:

  • BaseNavigator::defaultArea
  • BaseNavigator::navMeshQueryFilter
  • DungeonNavmesh::HasBuildOperationStarted
  • DungeonNavmesh::agentTypeId
  • DynamicNavMesh::HasBuildOperationStarted
  • DynamicNavMesh::agentTypeId
  • MonumentNavMesh::HasBuildOperationStarted
  • MonumentNavMesh::agentTypeId

The modifiers are just to allow rebaking navmesh so NPCs can roam freely. Niche application but would be nice to not have to custom patch each time

The AI hooks allow insertion of custom state behaviors as well as custom control of AI targeting (both to filter out normal targets and to inject abnormal ones). The NPC GetBestRoampoint lets you change how roam points are picked so they're not tied to AIInformationZones for free-roaming. The turret hooks allow custom targeting logic (like targeting NPCs and animals)

Usecase plugins:
Psilocybin and cordyceps are utility plugins that allow custom event-state mapping and injection of custom state behaviors, AIZLiberator lets them free-roam and changes aspects of combat and chase behaviors, as well as hijacks takecover to mostly make them pick nearby spots because otherwise they try to run across the map to get to some AIZ-tied cover point. Navmesher rebackes the navmesh and tries to add some obstacles to things like cactii so the NPC stop running into them repeatedly. Admittedly, that lat part isn't working as ell as I hoped, it's a WIP. The full thing is built in layers and I've only added the lowest layers as a minimum-viable example
Example usecase.zip

Hooks in isolation:
AIPlus.opj.txt

Adds the following hooks:
- AI\OnAICaresAbout
- AI\OnAIInitialize
- NPC\OnGetBestRoamPoint
- Turret\OnTurretCheckHostile
- Turret\OnTurretShouldTarget

Adds the following modifiers:
- BaseNavigator::defaultArea
- BaseNavigator::navMeshQueryFilter
- DungeonNavmesh::HasBuildOperationStarted
- DungeonNavmesh::agentTypeId
- DynamicNavMesh::HasBuildOperationStarted
- DynamicNavMesh::agentTypeId
- MonumentNavMesh::HasBuildOperationStarted
- MonumentNavMesh::agentTypeId

The modifiers are just to allow rebaking navmesh so NPCs can roam freely. 
Niche application but would be nice to not have to custom patch each time

The AI hooks allow insertion of custom state behaviors as well as custom control of AI targeting.
The NPC GetBestRoampoint lets you change how roam points are picked so they're not tied to AIInformationZones for free-roaming
The turret hooks allow custom targeting logic (like targeting NPCs and animals)
@read-0nly
Copy link
Author

read-0nly commented May 22, 2024

This is my first time trying to contribute hooks, please let me know if there's anything wrong with how I did it. These hooks have been tested pretty extensively over the last 2 years lol, since the whole concept is starting to come together nicely I thought it was time to try to get them merged so I can start distributing plugins.

Psilocybin and Cordyceps are useful starting points if you wanna play with these yourselves, look at AIZ Liberator to see how to use cordyceps for state injection. Psilocybin is fully run off a config json, doesn't need to be hooked into by other plugins. Here's the JSON I've been using as an example, it's got some behavior loops that get stuck still, but it makes for a decent example of how to use it

Psilocybin.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant