Transferring over from BP to C++ (AI)
I have a relatively general question about how to transfer over AI in Blueprints to AI in C++. I have been messing around with these awesome tutorials found HERE and I have gotten to the part where I have the four main parts of AI set up and working. But I was wondering, if I wanted to turn this into C++ code, how would I go about doing that?
I right now have AI that can: use the Behavior Tree, the Black Board Component, can move to a TargetPoint, can sense the player, can attack the player, pretty much the whole nine. But that is in Blueprints, and while I know it's powerful, I would like to to things in C++ instead.
How would I go about doing this? How could I set up the AI? How could I have it use the Behavior Tree/Blackboard? How can I use Services to make the AI properly follow along the Nodes in the Behavior Tree? How can I get it to move to a Target Point, or Sense the player, or Attack the player? Is this even possible through C++, or is this even recommended?
Basically, I would like some basics on getting this same kind of AI, that I created in Blueprints, for C++. But I don't really know where to begin (the Engine looks like a beast, and to be honest, I'm a little intimidated by it). Mind you I am using 4.6, I've heard there were some changes between pre 4.6 and after in the C++ realm. I've Googled and found A tutorial on this...The only problem is that none of the code seems to work for me (could it have been created on an older version of UE4?). Either way, I'm pretty much lost, I don't see much documentation for anyone interested in creating AI in the C++ side, and without knowing any basics of how everything works together on the C++ side, you can imagine how discouraging it could get.
Could anyone help me figure this out?
asked Feb 26 '15 at 04:25 AM in C++ Programming
My personal opinion is that if you should not try to do your AI fully in C++, especially if it's based on blueprints. Instead, you should try to know exactly what needs to be computed in C++, implement it in C++, and then expose it to the blueprint system.
For example, let's suppose you want to have a very complex function
Now, why did I recommend NOT to do behavior trees in C++? Because you are going to lose the single greatest tool that UE4 Editor offers you : the visualization of your BT. Not only will your BT be much clearer to visualize, you will also be able to debug it live (with the yellow arrows)
Follow this question
Once you sign in you will be able to subscribe for any updates here