-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Behavior tree special attack integration #40555
Behavior tree special attack integration #40555
Conversation
1fbde55
to
73275e9
Compare
Tested out fine, the only thing I might add here is documentation on how behavior -> special attack correspondence works, but if you merge it before that goes in I'll just add it in another PR. |
Hooray, weird crash in tests I didn't encounter locally. |
73275e9
to
976567c
Compare
…e with first special
976567c
to
23551fe
Compare
The crash is legit. I've resolved it now it was a data error and I've also corrected the issue that escalated the data issue to be a crash. |
CHECK( monster_goals.tick( &oracle ) == "idle" ); | ||
for( const tripoint &near : g->m.points_in_radius( monster_location, 1 ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is ridiculous, but you can't use near
as variable name in VS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gah, yes I've seen that before, I need to add a lgtm filter or something to warn on this and other VS reserved words.
Summary
SUMMARY: None
Purpose of change
Continuing #39810
tl;dr the monster AI code is inflexible and difficult to extend, this is part of the process of migrating the whole thing to use behavior trees to make it more legible and flexible.
Describe the solution
This addresses most of the major blockers to onboarding special attacks to behavior trees.
Extends the behavior predicate API to accept an optional argument and use it to specify a special id to check for. This avoids having to add a predicate for each special, and I anticipate this sort of thing coming up repeatedly.
Adds predicates as needed to determine whether the target special is triggerable.
Added code to inject the behavior tree definition into monster types that have the special.
Added code to invoke the special attack if selected.
Testing
Extended the unit test I added previously.
Need to spawn in a locust and induce it to nibble some plants.
Additional context
Great resource for behavior trees: http://www.gameaipro.com/GameAIPro/GameAIPro_Chapter06_The_Behavior_Tree_Starter_Kit.pdf