Download

Utility AI Plugin

UtilityAI_284x284.png

Light weight, modular, and scalable AI solution. Comes with examples.

Utility AI plugin skips behavior trees entirely for a system that makes decisions based on scoring likelihood of performing certain tasks.

The goal for the end product is to have multi-threading, async, c++ base classes, exposed blueprint functions, replication, and some experimental ideas I want to try out.

May also write a new movement component.

Trello Board: Trello

I’d like to start taking requests for what kind of tools should be included in this package. I’ve been building custom nodes and classes for game usage and testing.

This is what is included so far:

Classes c++:

  • Utility AI detour crowd ai controller
  • Utility AI base Character
  • Async mini-timer
  • UA_Function Library

Blueprints:

  • noise emitter test actor
  • Example characters: civilian, zombie, shooter
  • Example Controllers: civilian, zombie, shooter
  • VERY Custimizeable Spawners
  • Spawner Manager
  • Thinker , this is a controller manager. Will process provided info in async and or multithread for additional performance gains when number of AI becomes too great
  • HotSpot volumes, not the same as native UE4 hotspots, might rename this to heatmap or something

Components:

-extended character movement component ( performance gains )

Functions:

  • Random Spawn Location in navigable radius with fallback
  • Destroy Controller
  • get actor’s skeletal mesh
  • generic array sort, sorts by given parameters

Macros:

  • compare Tasks
  • check task priority levels
  • set desired movement speed ( does a lot of checks )

Misc:

  • example scored task library ( move to, investigate sound, wander, etc.)
  • Tasking Interface
  • Tools interface

Planned Features:

  • “behavior system” , evaluate task sets based on something like an alertness level or by enum of current behavior, allows overriding same task for different outcomes

  • aysnc find spawn location

  • async find cover/hiding spot

  • work locations

  • patrol routes

  • boid system

  • “vertex animation blueprint” , I don’t know how much work will go into this but I’d like to give it a shot. Would be great for using instanced static mesh actors instead of skeletal. Really isn’ an animation blueprint, more of a quality of life set up for artists working with vertex animations. THIS IS NOT MEANT FOR COMPLEX CHARACTERS

  • Works with faction system

Thats cool, something im definitively going to get if it comes out! Just one question though, Will it have like a ”cover” like behind obsticals and such? Cause that would be awesome. Thanks

//N1LSS0N

This sound really good and if it cover my needs ill be sure to pick it up, I’m working on a survival game and the main issue I run into is performance issues when there are to many NPCs active at a time, I would like to do hordes, If you code this to handle different types of AI and code it so you can customize to should be tops, keep up the good work :).

Can you Show US a Video from the current state?

I will get that set up yeah. sorry been juggling life, contracts, my own projects, etc. Still trying to work out this one kink with the varying reaction times of the AI. it’s the only issue I’m having so far. Also trying out the animation sharing plugin to see what gains it gives. Will provide an example if I get it working.

Think I may approach the reaction time problem by switching what AI are thinking based on distance or something like that.

Hi, is there an estimation for when this might be released to the Marketplace?

hmm been debating in my head if I want to release at a lower price and increase price as more features get added or give UA a real stress test before putting it public. Plus I want to write up a wiki for documentation and add some examples.

Another thing, I’m trying to use as much in engine functionality as possible. The problems I keep running into seem to be rooted in epic’s unfinished systems, like AI perception, so I may be forced to write my own perception system based off line and sphere traces. This could run a lot better so I may do that down the line anyway.

I’m not that great with time estimations, but If I take a wild stab at it I’d say this: If I can get perception system working well I’ll start having some trial runs done and if those goes smooth then I could submit to the market in like a month maybe two? ( I work a main job and do dev on the side) If I hit every brick wall along the way getting the basics together it could be 3 months or more.

Bonus: this pic is a bit dated now, but here is a test I did at one point.

Here’s a test inside the new update for End of Days

Ok did some testing with a packaged project finally. Non nativized blueprint gives me a total game time of 7ms with 100 ai. Haven’t been able to get it to nativize to see further results, but I’m in the process of moving a lot over to c++ and then adding in something like batching/pooling for task processing so as to avoid too many ai thinking at once.

Now that I’m moving a lot over to c++ I’ve been thinking about use cases for UAI and I’m not certain that every user will want a perception system or a crowd controller by default. Ideally I would do all this processing stuff in a component that you could throw on your controller and stuff, but I actually would lose some of the “free replication” by doing that.

Soooo going to have to make this hierarchy have a bit more depth … somehow. Would really help me a ton if I could gather some information from the community about how they would want to use UAI. For example, do you even need a health variable? A perception system? For AI to continue operating even though they are out of the rendering range of the player? I’ve been running into these situations myself in End of Days.

I suppose I could iron this out across some plugin updates as I gather more information from the community. That would kind of suck for anyone building their game with the first update though. Going back and remaking things is always a pain. I’ll put together a survey or something so I can get more info.

Ok put together a survey. It would help a ton if anyone would be willing to take it. It’s only 8 questions long. Utility AI Usage Query Survey

Done, hope it helps!

It does, thanks my dude. I’ve got a pretty good idea of how I should approach it long term, but I want to make sure enough use cases are addressed for the initial launch.

What I’m doing now for my character and controller c++ classes is just creating a child of character and detour crowd ai controller and overriding stuff and adding other stuff. What I probably should do is raise this up to a pawn base class and ai controller base class and then create copies of the standard child classes that would inherit from my custom pawn and ai controller class instead. That could be a ton of work though considering how much goes into character alone. I’d have to copy the movement component for example and then replace the references with my custom character and blah blah and i don’t know where else in the engine references could be that are needed. It’s why I’ve been going back and forth debating if I should make a lot of the logic in a component or something instead. Would lose a lot of the free replication though as I said, but thats probably still a lot less work to do and the performance hit could be negligible.

I should probably do some sort of beta type thing too, but I have no idea how I should approach that. Gumroad or something?

I volunteer as guinea pig! :smiley: Happy to chip in some donations to help speed development of this. (just did the survey)

I’d greatly appreciate that. There’s a patreon link in my signature.

I’m not really sure where the bottleneck I’m hitting right now is coming from. I have a friend who claims his behavior tree set up can have 400 zombies chasing him in his vr title and still have over 90 fps on an i5 and 1050 ti combo. At this point, Utility AI Plugin isn’t yet batching/pooling the AI processes and isn’t multi threaded like behavior trees. Those two things alone shouldn’t cause the massive reported performance gap of the alleged 400 ai BT set up and the UAI set up.

If I packaged up a shipping build of UAI, I can run 50 ai at around 120 fps with volumetric fog, Post process, dynamic nav, eqs, and all the other resource eaters turned on; on an i7 3770k and 980 ti classified.

That being said I’m getting some incredibly weird results in the profiler when I look for places to optimize. You get the expected big three at the top of the list: skeletal, animation, character movement.

If you go into `stat game however the world tick time is freaking huge at over 50 ms. I don’t have a single thing, that I have made, with tick turned on at this point. So this is something native to the engine that is eating up performance? Simply looking away from the AI drops the tick time to nothing so what might that be then? something in animation? well that doesn’t make much sense because even running the ai without a mesh and animation shoots the tick time up.

I’ll save you the headache and say that the AI SIMPLY EXISTING at all causes the tick time to go up and substantially more when you look in their direction. Even without overlaps, mesh, logic, or literally anything that you’d be able to see from the blueprint side of things. This makes me think that something deeper in the engine is wrong here and it’s been driving me nuts for weeks on end now.

i hope see this in a video, my game will have a few npc in screen because i use the open world spawn system so will fit my needs in all my games! i’ve already have a bp from marketplace and use Utility AI. But with a controller manager will increase my performance, also i hope is easy to create new behavior, goals for AI and reuse this same behavior in others NPC. A simple comp where enabled behaviors to the NPC, will be welcome!

My idea is to make behavior evaluations stored in a bp function library. I’ve seen other people use straight UObjects, which is more efficient I admit, but doesn’t allow for much sharing unless it was super generic like a BT task/service (whatever word goes there). It’s going to take time playing around with the system and getting feedback from testers to get the set up feeling right so I’m going to see if I can make the system accept both UObjects and functions library’s ( should be not much trouble since everything stems from UObjects and my system is looking for an output of a struct anyway )

Something is still somewhat odd about the performance results I am getting. A packaged project gives me 110ish fps with 50 ai and it really should be much more than that. since behavior trees can get higher than that. I’m starting to think it’s an accumulation of several things that gives me this result. My PC is leaning on the old side now, theres a lot of stress of built in Unreal Engine features, I haven’t brought everything over to c++, and I haven’t added the batching type stuff yet. Also starting to consider that the models/animations I’m testing with could be unfavorable.

I have some time on my hands now so I will be digging into this much more. First things first though, going to update the beta version of my game so I can get back on track with my community. Day job has really taken me away from the dev life lately. Going to make an attempt at full time dev again.

HEY! I’ve made some progress here as to figuring out what the performance issues are. Ok so turns out having a physics asset on the meshes even if not in use will still be ticking. I’ve gone ahead and removed them from my meshes, if I want to do rag dolls I’ll have to come up with some sort of method of spawning them or having a pool set aside for them. Next up, I changed my mesh reduction settings in the lods to have 2 bone influences at LOD 1 and every lod after than is only 1 bone influence. I had huge performance increases with these two things in place.

Some ideas on how to increase performance: Have all my AI share 1 material, fix the animation sharing plugin and animate through c++( it’s broken in 4.22.3 ), add all those logic improvements I’ve been talking about (pooling, async, threading, blah blah), make some sort of impostor set up for distant AI, something with movement component ( possibly not require nav mesh ), look into switching physx broadphase settings to MBP, and IDK maybe look into what octrees can do here. I don’t know anything about them, but it seems to be what most AI heavy systems are using.

Small update, got some more ideas from Tom Looman’s articles and I think I’m going to refactor a bit.