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

Monster behavior tree #39810

Merged
merged 2 commits into from
Apr 27, 2020

Conversation

kevingranade
Copy link
Member

Summary

SUMMARY: Infrastructure "Integrate behavior tree implementation into monster AI."

Purpose of change

The existing tactical monster AI is kind of a mess of if statements with careful early termination and special casing scattered all over the place, we can do better.

Describe the solution

Start integrating the behavior tree implementation into the monster tactical AI.

Describe alternatives you've considered

Magic.
I cut it of at essentially a minimum viable implementation for coment and to shakedown the implementation, there's still a significant amount of top-level infrastructure to add.

Testing

Added some very abbreviated unit tests.
Need to spawn a shoggoth or other item eating monster and verify that their ability still triggers.

Additional context

This is just the first step, hopefully it's fairly clear how this gets extended and it's going to be fairly routine to move the rest of this monster decision making into the behavior tree implementation.

@curstwist curstwist added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Monsters Monsters both friendly and unfriendly. labels Apr 22, 2020
@ZhilkinSerg ZhilkinSerg added the Code: Tests Measurement, self-control, statistics, balancing. label Apr 23, 2020
@kevingranade kevingranade marked this pull request as draft April 23, 2020 07:23
@kevingranade
Copy link
Member Author

My integration is incomplete, will try to get that fixed tonight.

@kevingranade kevingranade marked this pull request as ready for review April 23, 2020 09:00
@kevingranade
Copy link
Member Author

Back in business, everything is wired up, shoggoth successfully munched items, but do check behind me.

static void build_behavior_tree( mtype &type )
{
type.set_strategy();
if( type.has_flag( MF_ABSORBS ) || type.has_flag( MF_ABSORBS_SPLITS ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we will replace flags with goals in monster definition later (or maybe add monster flags to goals definitions)?

Copy link
Member Author

Choose a reason for hiding this comment

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

This should probably get unified around special attacks, or maybe rename them to "abilities", but I haven't thought about that too much yet.
The behavior elements could even be inlined along with metadata about the attack itself.

@ZhilkinSerg
Copy link
Contributor

Shoggoths are still eating items, so that's correct.

@ZhilkinSerg ZhilkinSerg merged commit 342d2e7 into CleverRaven:master Apr 27, 2020
Drewscriver pushed a commit to Drewscriver/Cataclysm-DDA that referenced this pull request Apr 30, 2020
* Initial integration of behavior tree into monster AI.

* Extract character oracle to its own module
@kevingranade kevingranade deleted the monster-behavior-tree branch June 28, 2020 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. [JSON] Changes (can be) made in JSON Monsters Monsters both friendly and unfriendly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants