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

Rework monster decision code #109

Open
demoth opened this issue Jan 16, 2024 · 0 comments
Open

Rework monster decision code #109

demoth opened this issue Jan 16, 2024 · 0 comments
Labels
ai Enemy or Character behavior gamemod game logic related

Comments

@demoth
Copy link
Owner

demoth commented Jan 16, 2024

Implement a composable monster ai decisioning using Behavior Trees

Character behaviors:

  • idle states - fidget/stand
  • react to damage - pain/dead state
  • walking/running
  • melee attack
  • ranged attack
  • TODO: "sliding"
  • TODO: jump
  • TODO: flying / swimming
  • TODO: specials (medic)
  • TODO: path target and combat target
  • TODO: bosses

Priorities:

  1. if triggered & has combat point -> go to combat point
  2. if triggered & see enemy & fired at -> duck
  3. if triggered & see enemy -> attack enemy
  4. if triggered & !see enemy -> chase
  5. if !triggered & has path-target -> goto path-target
  6. else: Idle
@demoth demoth added ai Enemy or Character behavior gamemod game logic related labels Jan 16, 2024
demoth added a commit that referenced this issue Jan 16, 2024
follower ai - follows the attacker, work only along straight lines
demoth added a commit that referenced this issue Jan 16, 2024
demoth added a commit that referenced this issue Jan 16, 2024
demoth added a commit that referenced this issue Jan 16, 2024
Instead of boolean. Support for continuous node execution
demoth added a commit that referenced this issue Jan 16, 2024
Leaf nodes now can return a continuous task: `BtActionTask`(for a certain number of frames) and `BtWaitingTask` (until an event is received).
 This is a way of saving a state of the BT which was completely stateless before (previously each execution of BT could result in a different decision every frame, even though the character's state machine is unlikely to change so quickly).

 BT is now wrapped into a `BtContext`, which is a combination of a BT and a current task (if exists).

 As an example, when the BT decides to initiate an attack, it would keep this decision until the attack is finished.
demoth added a commit that referenced this issue Jan 16, 2024
Monster can now decide to shoot or run for a certain duration towards the target. Previously, continuous running was possible only as a fallback (because there was no state, no place to store current decision).

Plus some random docs & comments
demoth added a commit that referenced this issue Jan 27, 2024
move enemy knowledge variables to `.monsterinfo` structure from Game object into the Entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai Enemy or Character behavior gamemod game logic related
Projects
None yet
Development

No branches or pull requests

1 participant