bitDecayGames / haxeflixel-template

Basic game template with FMOD and Bitlytics tie-ins ready to build from
3 stars 1 forks source link

Behavior tree and state machines #79

Open Kenoshen opened 2 months ago

Kenoshen commented 2 months ago

It should be "easy" to add AI to the game. Or at least there should be as few barriers as possible. We could probably implement basic states for enemies like chasing the player or a customizable target, idling, etc. And just get to a basic level of AI as a foundation of the template. Then make it easy to customize when using in a jam implementation.

MondayHopscotch commented 2 months ago

After our talks of this stuff last time, I did some research and some of the stuff I found more or less is summarized as "state machines are good for decisions, behavior trees are good for how to achieve a goal." I think the idea here was that you can combine the two patterns: Have a high-level FSM that handles the high-level decisions of what state an entity should be in, and within those states, behavior trees are running to achieve the goals of that state.

I think the best way for us to really build this is to learn it during a game jam of some sort. Building it out to actually create AI for something we are making feels way easier than use theory crafting enemy types without a game to actually explore them.

All that said, once we find a pattern that we like, we should be able to make pretty clean and reusable chunks that we can apply to future games.

Kenoshen commented 1 month ago

That sound complicated, but I can see how it would be good to get really elaborate AI behaviors with combining all the rules and whatnot.

This is probably two parts:

  1. the basic FSM and Behavior Tree as util libraries
  2. the genre-specific implementation of some common enemy behaviors

I might try and go back to my Devil's Dial game and see if I can add some more complicated behaviors and try and come up with a generic thing that could be library-ified.

MondayHopscotch commented 1 month ago

No FSM in here, but I've got this: https://github.com/bitDecayGames/BehaviorTree

I'm thinking it makes sense to have generic genre-type things in the flixel-utils project, or perhaps even in the behavior tree repo, itself.

I would like to see what it looks like to put some enemies into Devil's Dial. It seems like it's in a good place to experiment with enemy design to at least build out a simple understanding of how to implement this kind of thing.