Utility AI Plugin

This is amazing stuff. I read Tom’s articles and am thrilled that you are doing this. I’ll definitely be following you and supporting you. I am interested in open-world stuff, adaptable AI and extensible systems… and I see how clunky BTs can be for this. I’m 100% BP in my skill-set so creating libs for this on the BP side is a God-send for someone like me :slight_smile:

Lots of challenged to overcome it looks like but just want you to know there is definitely an interest in this

Thanks :slight_smile: , been kind of side burning this when I can. I seriously need it for my own projects too, but man I’ve ran into some really weird issues getting this going. Found out one of them was an engine bug related to physics and now I’m pretty much fully into 4.23 and getting ready for 4.24.

Going to take another peak at the animation sharing system, but I think as far as my PC is concerned, I think I’ve hit the bottle neck on my i7 3770k and 980 ti classified. I guess that’s fine considering CPU is like 8 years old. Going to end up getting a ryzen or thread ripper I think because I want to see what top tier and low tier can look like with this.

Hey man so when I was testing out 50+ AI in my game, I noticed that the constant ticking is from the movement component thats default on the character. When the AI stops moving/pathing and is idle for a bit, the component would stop ticking and performance would jump. So figuring out how to better optimize the movement component would be huge. Plus the other performance fixes you’ve done and I think you’ll nail the problem.

I’ve also noticed that just having a navmesh, even if its only 1x1x1 in my map, causes the ram of my server to jump up to about 1gb. Removing the navmesh and the game is only about 150mb. Is this normal? Does the navmesh simply require a ton of resources? Maybe dependent on map size?

Awesome stuff, I hope it will work out in the end.

This would be very much needed for my project. But there’s an optimization possible. For example, when AI is in the rendering range, I would need more detailed set of scoring functions. For example, an NPC goes into a cafe where the player is. Now NPC has to evaluate if it wants to drink some coffee or to chat with the shop assistant or another NPC. But if the same AI is not visible, it should not run through those detailed scoring functions - the player only needs to know that an NPC agent left its home at 9 AM, visited a cafe for 10 minutes and continued its way. No need to run through all those “should I have one more coffee?” and “should I chat with the shop assistant?” scoring functions if the NPC is out of rendering range.

I guess, for this to happen, at first, we would need some abstract system to push/pop a set of scoring functions depending on some event. And if we have that done, we can treat “leave/enter rendering range” as one of those events and so developers can then decide which set of utility scoring functions to push/pop.

Would love to see this finished :slight_smile: Sounds awesome and seems like exactly what i would need for my game

I agree thats definitely a huge hit. Skeletal mesh was as well. I have a working version of the animation sharing set up going now and that has helped a ton.

I’ve been thinking about this a bit, but I don’t have an answer I’ve liked yet. Maybe some sort of data table only based stuff.

Hey thanks, I’ve been taking stabs at this when I can. Here’s a screenie from my last test. Sorry for the bad quality, had to dig it off of discord.

I got 200 AI running at 144 fps with the animation sharing plugin, but in blueprint only. I can’t wait to see what performance I get when it’s brought to c++.

Hey, I want to drop by and register my interest for this project.

This is one of the few resources that come up on google for utility ai in ue4 so I really want to see it succeed.

​​​​​​That being said, I can’t really wait for it to succeed, since a working AI is the cornerstone of my project. I’ve tried my hand and Ureal’s built in systems in BTs, but I always manage to break them way to easily and I feel like I need to jump trough flaming hoops to make the AI do what i want. Utility AI (in my head at least) seems like the magic pill solution to all my troubles.

I don’t want to hijack OPs thread, but there aren’t many places for discussion on this topic, especially not in the context of UE4. Like I mentioned, I can’t really work on my other game systems while a solution comes up, so I’ve started developing my own utiliy AI architecture. Now it’s not going to be nowhere near as extensive as what OP is building and I’ve never done marketplace plugins (nor have plans to), so I feel(hope) there isn’t much conflict of interest. I’m also doing BP only.

I just want to keep the discussion going and exchange ideas and maybe offer my experience on how to set up and layout your classes and such. I’m mostly going to stick to Dave Mark’s design (as if I have much of an alternative :D)

If the world is still around in 2022 and you find this thread, drop a message and see what happens :slight_smile:

yeah no worries man, been so busy I haven’t done much with this since. Honestly I kept running into weird engine issues as skeletal meshes are still absurdly expensive for whatever reason. I actually ended up buying a new pc so my workflow has sped up like crazy. Hoping to put more time into this and find a better basic structure, one that doesn’t go through blueprints as much as possible.

I think there’s a pretty good market for this as utility AI seems like a kinda hot topic at the moment.

Might be worth scrimping together something to put on marketplace because imo something is better than nothing and there seems to be nothing at all on the marketplace for utility AI yet.

Regarding that “situational awareness” - I just remembered some time ago I had a chat with Dave Mark (I guess, you can call him “the godfather of utility AI”) on gamedev.net forums and when I asked about this issue of possible situational optimizations, he directed me to one more awesome video:

https://www.gdcvault.com/play/102184…ter-Centaur-AI

It has a section about “Decision Maker Packages” and even mentions “situational packages” at 29 minutes of the video.

This might be a helpful idea to deal with situations when your AI considerations stack grows too large and gets difficult to tweak to avoid conflicts and inconsistencies and also for optimization to avoid running through the entire list of considerations. For example, when an NPC is at their home drinking a coffee, you don’t want them to suddenly decide to find the closest bartender and pay for the coffee. Instead of tweaking the considerations to avoid such behavior, actually, you don’t want to evaluate this option at all if the NPC’s location is not inside a coffee shop. So, that’s when those Decision Maker Packages might be very useful. We could categorize considerations and behaviors into distinct packages that should be evaluated in specific areas of the map and completely ignored in all the other areas and just use enter/leave volume events to trigger pushing/popping the situational packages.

I’ve been using that as a basis for this actually.

I recently got the Hierarchal Task Network system asset and a quick look at it shows that it may handle a lot of what I need already personally. I haven’t got into it too much though so maybe this is a simpler solution then that.

If this is the same HTN plugin I am thinking of, it does not have network replication, is that going to cause a problem for your project?

Edit: I spoke too soon, went back and looked at the Q&A for the plugin:

Replication IA

By Koleshy on October 7, 2020 2:06 PM - Edited on October 7, 2020 2:07 PM

Was this question helpful?

I was watching some of your videos but what about multiplayer support, I saw you use a “move to” integrated in your HTN, this is just for single player i think, how to convert this move to multiplayer, if you can give an example with it should be awesome and motivate me to buy this
Latest Answer from Publisher

By projectable on October 7, 2020 2:14 PM

3 people found this answer helpful

AI only needs to run on the server, so replicating it is not necessary, just like with behavior trees. As long as you make your custom tasks’ behavior correctly replicate during plan execution, you’ll be able to use this in a networked game.

The HTN “MoveTo” task works exactly the same during plan execution as the Behavior Tree “MoveTo” task.
That is, by making the character move, and character movement is replicated by default in Unreal Engine.

Just gonna throw out that I have an AI plugin on the marketplace that uses Utility Scoring. Didn’t wanna self promote but i saw another product named, and the statement wasn’t true… It uses Utility for the decision making, which is a huge portion of the work. Definitely different than a plain utility scoring system, but it still uses Utility as a core.

Docs and tuts are lacking because it’s grown so much in the past year, but that’s what i’m working on now as version 1.3 is ready for release.
[SUB]anyway feel free to delete this, ik this post is about another system :stuck_out_tongue: [/SUB]

That’s cool, I’ll check it out. Decision making and “thinking” for the ai was the easier part of the process here. What I’m doing with my package is a lot of systems, tools, helper nodes, and custom classes. I was going to rename the plugin to something more descriptive than utility AI as I want to include several example of AI set ups without going to crazy on the set up. AI is one of those things that is not a one size fits all so I’d rather do a “best practices” and working examples package.

There’s some stuff though that I personally use from free third party packs so I may need to do a git hub for those kinds of set ups as I can’t include those on the store.

I wouldn’t say that the decision making bit was easy for me, though I was designing a whole new theory.

VisAI actually includes a whole set of tools, systems, and features that make development smoother and faster as well. Sounds like we had something similar in mind :slight_smile: if you’re interest in working together, reach out to me!

I checked it out actually. I would be interested considering at this point I’ve come to just make a slew of useful tools more so than a one size fits all scenario. I just started adding examples for animation sharing, animation budgeting, and USkeletalMeshComponentBudgeted. Wrap that up with stuff like ai perception, eqs, HISM mesh pools, etc. Now I’m looking into how to get vertex animated static meshes to update their collision and have physical material masks so that you can do collision checks on different parts of static meshes with only one material.

My current goal is to be able to get hordes of AI into an oculus quest. With HISM I can have essentially infinite zombies here as they don’t cost any extra draw calls. I’ve tested on quest with 1000 no issue. If your behavior tree is efficient, it’s not an issue with cpu and it seems it’s not an issue with character movement either. What I’ve noticed is the most expensive part of a character is the skeletal mesh. I’m highly interested in figuring out a way to get an instanced skeletal mesh or something that would allow me to keep the draw calls low and then I can figure out tricks for ragdolls and such later.

Animation Shared and Budgeted Zombies:

https://media.discordapp.net/attachments/221799439008923648/787447105714388992/unknown.png?width=1243

HISM Vertex Animation Zombies ( ignore stat unit here, had to tab out of the engine to take a screenshot) :

cca5c7769c44832e7ea6def4e0c4c17c213542f5.jpeg

We should definitely talk, I’ve DM’d you back!

This never got released? Are there any similar alternatives?