Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

123 Neutral

About midix

  • Rank

Personal Information

  • Role
  • Interests
  1. Oh, I see, yes, I can fall back to boolean inputs for considerations for cases when I clearly need opt-in / opt-out. I guess, my brain switched into curves mode and failed to think in simple booleans; or maybe I felt that boolean considerations are evil in utility AI because of being too strict and breaking the "fuzzy logic" feeling of it
  2. Thanks, yes, that makes sense. So, one solution for unique targets might be to treat their behaviors as standalone because there is no need to evaluate GoToWork for other targets if the agent has only one unique workplace to go to.
  3. Let's say I have a bunch of NPCs that need to go to work every weekday. There will be additional considerations for cases when they would choose to stay home (low health etc.). So, the basic logic is as follows: Behavior "GoToWork", should be considered only if it's Monday to Friday AND only if clock time is after 6:00 AM, applying random shift of up to 3 hours to prevent all NPCs rushing out at the same time. The world clock and calendar is knowledge base and I can map clock (minutes) to input range. But days and random shifting are not that straight forward. I could map minutes for entire week as a single input and build a custom piecewise curve with sharp transitions (because it's essentially yes/no decision - I don't want to consider it at night or on Sundays at all) and use that as the second consideration for GoToWork. But still I'm not sure how it is supposed to be implemented "the right way" with utility AI. Which condition checks belong where and how to add that random offset for each NPC separately?
  4. I was experimenting with Apoch's curvature project and everything made sense, until I got to the point where I had to think about how it automatically chose the target for behavior. The code fragment in question is the ChooseBehavior method here: https://github.com/apoch/curvature/blob/master/Scenarios/ScenarioAgent.cs#L86 That got me thinking if that's what I want and how to deal with it in cases when automatic target choice is not appropriate. On one hand, it makes sense to iterate over all possible targets and evaluate scores and then pick not only the winning behavior but also the winning target for the behavior. On the other hand, there might be a huge number of possible targets even for a simple "MoveTo" behavior. I definitely would want to somehow filter them, but the filter criteria cannot always be strictly defined. Sometimes I might want an NPS to consider MoveTo for visible targets only. Sometimes I might want it to consider moving to its home location, which might happen to be on the other side of the game world. And sometimes a behavior might be executable even without any target at all (for example, some Idle activity), but Curvature for this case gets stuck with "Stalled" message because it expects to always receive the winning context from ChooseBehavior. For example, if I try to implement GoHome behavior as a MoveTo behavior using some IsHome flag as an input, it would be very inefficient to run MoveTo behavior on every target to find if the target is marked as a IsHome for the NPC. After all, the NPC might have a property HomeLocation which could be immediately used as an input for MoveTo. But there is no way to pass it as an input for consideration (and it makes no sense - HomeLocation is a vector pointer and not some numeric value to use for consideration and scoring). So, my guess is that abstract MoveTo with automatic target choice might be appropriate when choosing among multitude similar items. But in cases when I want my NPC to navigate to some special or unique object, I have to create a very specific behavior (GoHome instead of MoveTo) which contains the logic for extracting the HomeLocation form the NPC agent. Or is there any other elegant way to solve target (context) filtering for behaviors without getting too specific and creating lots of behaviors like GoHome, GoToWork, GoToEnemy ... but without evaluating every possible item in the world?
  5. midix

    need help?

    Hm, this topic is suspicious. Is it some bot? It seems like the author just copied and renamed my topic from here: And Google gives a bunch of search results for user anhnn1234 with topic "NEED HELP?" on different forums, and topic contents is always a duplicate of somebody else's. Something seems fishy...
  6. Thanks, so, I guess Apoch's Curvature is the best I can get at this moment. I started experimenting with it, works nicely; still lots to learn to comprehend its possibilities and integrate into Unreal.
  7. I guess I secretly hoped for some lazy option - like a GitHub project in C++ with full documentation and examples, that can be dropped into Unreal Engine (or any other engine). A quick GitHub search found only C# projects of good quality (and some of them more or less tied to Unity). C++ - not so much luck. Anyway, I could port something from C# to C++, unless the original code is too "C#-specific" and architecturally complex. https://github.com/apoch/curvature seems really good starting point.
  8. Oh, thanks, I somehow missed that one out. Now looking at the Decision Maker Packages section, it seems totally relevant to what I was talking about, and it even mentions "situational packages" on the slide. Except that in the video it is more about pushing additional decisions to the stack of currently available decisions (and popping it off when not needed) instead of limiting the full list. But at the end it achieves the same purpose - optimization through limitation of available decisions. Which means that my reasoning about that "situational stuff" was not that bad as I thought. So, there's just one crucial piece to implement - decisions for pushing/popping new decisions (almost getting recursive here), when reacting to a situation. And how to wire it all into Unreal Engine...
  9. I'm playing around in Unreal Engine with intention to create some kind of a small town scale Sims-like simulation. I don't need that much micro-managing as in Sims. At first, I want to start with a bunch of simple NPCs that walk their route (using NavMesh, most probably) between work and home, based on time of day. But, depending on different factors, NPCs might choose to visit a shop or a cafe while on their way. Also, there are different jobs that require some flexible behaviors for cases when I closely follow an NPC or interact with it. Unreal Engine has Behavior Trees for AI but I find it somewhat limiting for my purposes, therefore I started looking into Utility AI. Currently I'm watching the GDC lecture videos about Utility AI and trying to figure out how do I go about implementing it in Unreal and to apply to my sandbox-like simulation. By the way, are there any Utility AI code projects that could be plugged into UE4? As my town will have many citizens (hundreds? thousands? the more, the better, as long as my PC can handle) and I want to track them all on a world map (just dots), I would like to make it work efficiently. Of course, I will turn off animations and meshes (with their collisions and physics) when an NPC gets offscreen. But what about AI? How do I switch to narrower set of parameters and actions to choose from when NPC is offscreen? And does it really matter in practice? Should I leave the AI evaluating all the possible action scores and apply some checking only inside the action itself (if NPC is offscreen, then I do simple waiting for some sensible time instead of doing the full simulation)? These thoughts led me to some other questions and ideas that might be useful for optimization, but I'm not sure how they would work in practice. So, I hope somebody else has already thought about this and tried it out and can share the experience. In essence, the idea is a new abstraction I call Situation. It could also be considered just some kind of a context, but that word is so overused, that's why "situation" was my choice. Basically, a Situation is something like a filter that contains a predefined (at design time) set of parameters and actions that are available, adequate and make sense at the particular Situation. For example, if an NPC enters a cafe, there is no need to continue evaluating the entire list of utility actions for being on a street or at a workplace. I don't want an NPC to decide that it should start running home as soon as possible (because of some not so carefully tweaked parameters) while waiting for an order in a cafe. Instead, I would want to make such action not available in that particular situation. Less actions to choose from = less parameters to tweak to prevent an NPC from doing something totally weird, right? I guess, this could also be visualized as a tree of utilities. Or it could turn into a hybrid of utility AI (for high level actions, like "Where should I go next?") and behavior trees ("What sequence of predictable, adequate actions I should attempt to perform while being in this situation?"). But I would like to avoid mixing multiple systems just to keep it less confusing. Or am I totally wrong here and I shouldn't attempt to use Utility AI for cases when an NPC should be very predictable, almost following a well-known scenario? Next, I was wondering, how an NPC would enter/exit the situations. How do we, humans, limit ourselves to some subset of activities to avoid doing something stupid "just because we can" or "I really wanted to do that at that very moment, even if that was highly inappropriate"? I guess, we do that based on our reaction and reminding about the environment we are in. "Hush, you are in a church now" - a mother reminds again and again to a child who starts to become too active. The rough idea is as follows. Unreal Engine has good environment query system and I can leverage that. Although, for performance reasons, I'll try to do it in reverse to human sense. If a human being sees a cafe and enters it, he/she is doing the query: "Am I in a cafe now?" In my case, it might be the cafe itself (through a trigger volume) triggering an event on the NPC: "You are in a cafe now." and NPC has the logic: "I should limit my activities to something I can normally do in a cafe and completely forget actions that are not sensible in a cafe." And when the NPC exits the cafe, it again receives a trigger volume "exit" event, which in turn removes the filtered restrictions and allows to execute evaluation of the full set of actions. If we assume that an NPC can be only in one situation at once, it looks like a simple stack with push/pop. Enter the cafe? Push the list of cafe actions and run utility AI evaluations on them. Exit the cafe? Pop the action list and now you are where you were before (with possibly some updated state parameters - you spent some money in the cafe and you reduced your hunger). But is it good enough? Can there be a combination of situations where I need a set of actions for multiple situations at once? In this case my idea breaks down because a stack is not enough anymore. So, trying to combine multiple situations can get messy really fast and I'd better go with evaluating the entire list of utility functions instead of trying to combine all those multiple situations. Still, I could use this approach in cases when I 100% know that I need a limited set of actions. What do you think about this rambling? Am I overcomplicating things (actually, because of trying to simplify them through not evaluating entire set of utility actions all the time)?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!