Hey all, I created an AI with Roaming and Pawn Sensing. When I duplicated the character to add additional enemies to the game my AI movement broke. The character now just stays in place looping the movement animation. I added the movement/roaming blueprint script for reference. Any help is appreciated!
Hi,
(1) make sure you have a navmesh in your level and that there is a path from the AI location to the location you want the AI to move to (you can visualize the navmesh if you press “P” Navmesh Content Examples | Unreal Engine Documentation)
(2) If you have a navmesh, then do some prints in your code to see where it fails/ does something you did not expect it to do.
So at least print the return value of the “GetRandomPointInNavigableRadius”, if that is false, then it did not found any point and you need to check your navmesh. Further I would do a print after “On Fail” and one after “On Success” to see what happens there.
I do have a navmesh covering the entire level (checked with P) but am very new to Unreal in general, been following hours of tutorials to get started. I’ll figure out how to print the return value and get back to you on this. In the meantime, any resources for third-person level design basics/best practices would really help me out. Building a small fantasy 3rd person RPG for my friend and his fiance as a wedding present and could use all the help I can get!
Ok, then for AI you might wanna work through the behavior tree quickstart guide step by step Behavior Tree in Unreal Engine - Quick Start Guide | Unreal Engine 5.1 Documentation
If you want more complex behavior in the AI you might wanna take a look at EQS, and work through the EQS quickstart guide step by step Environment Query System Quick Start in Unreal Engine | Unreal Engine 5.1 Documentation
[HR][/HR]
As for animations, this video here helped me to get started with them https://www…com/watch?v=YVC-DL9Ibf0
[HR][/HR]
For level design you could take a look at the open world tools Open World Tools in Unreal Engine | Unreal Engine 5.1 Documentation, and especially at the “procedural foliage tool” Procedural Foliage Tool in Unreal Engine | Unreal Engine 5.1 Documentation (you can use that to place forests, rocks, … ) and how to use the landscape grass system Grass Quick Start in Unreal Engine | Unreal Engine 5.1 Documentation
[HR][/HR]
Otherwise unreals online learning videos are a good learning resource https://www.unrealengine.com/en-US/onlinelearning-courses
[HR][/HR][HR][/HR]
And generally speaking try to avoid executing logic every frame (using tick) as much as possible, better try to do it event driven. Or if you need to execute something permanently (for example something like health regeneration) most of those times you don’t need to execute this logic as frequently as tick and can/should use a timer https://docs.unrealengine.com/en-US/Gameplay/HowTo/UseTimers/Blueprints/index.html
Awesome advice and thank you for showing me the community learning videos! I am going to work through the game relevant learning paths. If I was trying to break into the industry do you feel that completing these would be a good starting point/ good to have on the resume? Sorry, I will also get back to the issue I am having with the AI but this seems to solve the larger issue of gaining knowledge with the tool and understanding overall development using UE4.
Did you create a child of the original Ai character? or just duplicated?
@MindfieldsTech I did not! just duplicated. Would that have given me an error?
When you just duplicate a character/actor, the code may sometimes be pointing to the original character/actor. If you create a CHILD, it retains the original code in the original and basically clones the first. So you can create children from the original, and it will make the instances feed off the original blueprint script.
Creating a child is easy as duplicate.
Right click on your original, then go up to top and click Create child. you can still modify it with different mesh and unique code, but it is basically a clone of the parent.
For example here is the game i am working on:
The Item pickups are all children of one base pickup parent actor.
and the crabs are all children of one parent actor that has a behavior tree and they are all using the same behavior tree and blackboard.
@MindfieldsTech This is super helpful! And awesome game!
Thanks if you need any more help let me know! Give the “create child” option a try and see if that helps! Good Luck!