Download

Basic AI Progress. Opinions please. Still learning basics.

Ok, so I’ve been getting a good grip on casting and how the AI system can work. I haven’t gone into blackboards and behavior trees yet, but I’m taking stepping stones to get used to using casting, variable storing and functions in the blueprint system. I was hoping someone with some experience can tell me if what I’m doing is in the right direction or not. Everything works fine as intended, but I want to save ticks and resources while keeping it as efficient as I can manage. I’m sure I will evolve this code over time as it’s just a learning prototype for what I’m planning to do later, but I’d love some community feedback.

I have a path node actors scattered throughout the level and the player walks around slowly between then all using a newly made AI Controller. What I have here is a basic AI for the actual AI Character with the following steps:

  1. Use an Overlap to check if the player is in the bounds of safety for the AI character.
  2. If the player is within those bounds, turn on consistent checking to see if the player is actually visible by using a line trace to see if there are objects blocking you from the AI character.
  3. If there is nothing between the player and the AI character, turn on RunningScared(bool), increase their speed and set their path node to an escape zone.
  4. If the player leaves the boundries with EndOverlap, stop line tracing on every tick to save resources.

Basic AI Event Graph.jpg

Sorry the rest of the image on the right gets cut off unless you zoom out enough. The rest I can’t see here is pretty much set a RunningScared bool to true and setting the node for the AI Controller to move to is as the specified Escape Node. So far it’s working really well. I’d just like to have some opinions on how I’m coding it. Right now I’m keeping it basic for learning and using a regular Sphere collider for the boundries of safety on the AI. I’m going to evolve it eventually with a different trigger (probably a cone shape or something) to check just in front of them instead of all around. I don’t know how to get into sound detection and stuff yet, but one day at a time. :slight_smile: The blackboards and behavior trees are still confusing the heck out of me.

Thanks for the read. I appreciate it!