For example, top level tree could be something like "If patrol is set, then patrol, otherwise idle", where "patrol" would be "follow patrol route unless enemy spotted then pursue" and "idle" would be "stay in one lace unless enemy spotted then pursue". There are going to be patterns, and all characters will end up following same general patterns. Is there a design pattern that allows to do something similar?Ĭlick to expand.You need to break down trees into components. Like amending the generic tree with a different masking of variants cards. What I want is to find a way to have a generic tree of behavior, but selectively override cards anywhere in the hierarchy, such that I don't need to duplicate the tree, and thus don't pay the cost of updating every hundreds of character. A card is said to be substituted if we modify the actions list but not the hierarchy (we don't replace card in the list of action), replacement is when we switch the card and the whole hierarchy. Inhibitions and Insertion lead to substitution or replacement of cards. Each card has a check and a list of actions, but cards being type of actions themselves, they can be nested forming the tree. In some way we can see the structure as a metaphore of cards. Insertion and inhibition, basically the equivalent of adding a check in the node for if ischaracter(name) or !ischaracter(name). The problem is that they are by the nature of the domain, all over the tree and I wasn't able to generalize. I would want to move the named character exception in their own file. The core of the problem is that currently, I have a generic tree, with tons of exception rules for named character. At least without ruining the neat workflow. Now the problem is that, if I want to override a node to make varients per character, I no longer have a flat method list to selectively replace. When I tried breaking the tree into subtree and method, that was useless, because it just shifted the complexity to the file folder without any benefit, and if I keep it in a single file, the node method list became ridiculously long and impossible to navigate, while obfuscating the logic. When there is an error I get send to the exact line, and just walking the hierarchy I have all the context needed. Even if a block go up to hundreds of line, I can just copy paste by collapsing first, even in the most simple IDE. Reading, editing and debugging has never been easier given the power afforded. IDE has collapsing blocks ui, which allows the code to be neatly organized like folder with if blocks. The benefit is that, on the current form, it's KISS and KILL. That mean I have actions that can run at every level of the hierarchy, which allows pre processing for further actions down the tree, and many actions don't opt out a node entirely (typically called concurrency in BT), that was the key that allowed the structure to maintain flexibility and authorship. That was too rigid, so I just used the pattern (sequence and priority) to organize the code. I have issue make variations for each character without resorting to have a single tree for all character.Ī regular BT only run one action at a time, actions opt out a node on fail or success, and all actions are on leaf. The main issue is in the BT like structure. And that's where I have architecture problems. It works pretty great, except one single things. That is a mix of reactive ai, with persistent named character with unique behavior and top down directions for situations, using time table. The game is similar to yandere simulator meet Buffy the last vampire. With a world blackboard that is queried by a utility tree that match to perceptual concepts instead of actions, an if tree that select state variables, and states machine for the actions. Over time I evolve to a kind of ai sandwich that takes the best lesson of all of them. The problem is that the usual pattern were highly unsatisfying and didn't reach the right balance of control and flexibility. I'm name droppings people so you know I did diligence. And I mean I read everything I could about the literature, from Alex j chapendard (aigamedev site, killzone ai programmer) to Mark Dave and Kevin Mill ( popularizing utility ai in game, worked on the sims). I have been experimenting for a long time with various pattern for making complex characters simulation that would work with simulated story. I posted the questions originally on script, but I noticed open ended architecture questions seems to have more luck here.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |