In this multi-part series, Ian Shadden and Alexander Paschall show you how to use all of the relevant systems and features (Behavior Trees, EQS, Navigation Meshes, AnimBlueprints, AnimMontages, and more) to design, create, and optimize AI for use in a game environment with all of the requirements and restrictions that go along with that.
In Part 8, Ian and Alexander will be diving back into the stats system for the AI to setup a proper health-stamina-hunger relationship, while discussing why proper commenting or extensive notes are important even if you are mostly working alone.
Feel free to ask any questions on the topic in the thread below, and remember, while we try to give attention to all inquiries, it’s not always possible to answer everyone’s questions as they come up. This is especially true for off-topic requests, as it’s rather likely that we don’t have the appropriate person around to answer. Thanks for understanding!
So I’m trying to create a custom generator like you did in part 5 except the work-around you use to get the AI character will only work for a single AI character. How would I go about this if I have multiple AI on the map? I know Mieszko put exposing the “owner” on his todo list, and hopefully he’s able to get it implemented for 4.11 but in the mean time, there has got to be some way to know who is calling the query? Any work-around for multiple AI characters/controllers? Would it be best to forego using a query at this time and implement the logic, including getting distances and perception component, in a normal task? I would think that eqs performs better than a regular task (why else would it be there?) so ideally I know it should be run in here. Any thoughts and solutions would be much appreciated!
Also, you mentioned early on that you were going to implement some C++ logic into your AI. While I know very little of C++ at this point, I was hoping that you guys could show how to create a simple custom behavior tree task, service and/or decorator in C++. Ian has said in the past that by simply creating your BT Tasks in C++, you would optimize your performance 10-fold. I think this would be very useful for everyone to learn how to do and expose to blueprints!
I watched the first few videos of the series over the holiday and did a C++ implementation of the (so far) first four parts of the training stream. Well, I should perhaps say a reinterpretation of the solution in C++ because translating the Blueprints as literally as possible (which was my original intention) resulted in pretty unpleasant C++ code. Not really surprising, since Blueprints and C++ are two rather different beasts.
However some parts of my implementation still correspond rather closely to the training stream and the C++ versions of, e.g., the [FONT=Lucida Console]ChooseRandomLocationand [FONT=Lucida Console]UseItem Behavior Tree tasks might help some of you pass the time while waiting for the more C+±heavy videos. There are also implementations of EQS generators (all actors implementing a user-selectable interface) and EQS tests (test items for their utility for the character) as well as some other features you might find interesting e.g., data-table based configuration of the stats system.
2 small blueprints may have slightly higher overhead than 1, but it all depends on if you’ll need to have them communicate to each other and how you implement that. Mostly it should be inconsequential.
Strings are heavier. Anytime you have 2 strings that are the same you are wasting memory, as they are duplicated. Names that are the same are referenced from one place in memory.