test content
What is the Arc Client?
Install Arc

Ambient with Combat Behavior Explanation of Variables

SystemSystem Member, NoReporting Posts: 178,019 Arc User
There has been some confusion about the meaning and use of the variables in the "Ambient with Combat" Behavior, so here is an explanation!

The first one is fairly simple:
Combat Entry Text: This text is what the NPC says upon entering combat.

The others form the basis of our ambient/default behaviors. It is a state driven AI that bounces between a "Chat", "Jobs", "Wander", and "Idle". "Idle" is always active, and the others have their own enabler variable (Enable Chat, Enable Wander, and Enable Jobs).

The way the Behavior works is that every state lasts for a specified duration (Wander Duration, Idle Duration, Chat Duration, and Jobs Duration). Once that state is completed, the code randomly selects another state, using the weights provided by the user (Wander Weight, Idle Weight, Chat Weight and Jobs Weight). If a state is disabled, its weight is effectively 0 since it cannot be chosen. Likewise, if a state's weight is 0, it will not be chosen. Otherwise, a weighted random choice is selected and the AI does that state's behavior.

The "Idle" state is fairly simple and always enabled. For Idle Duration seconds, the Idle Animation is played.

The "Chat" state allows the NPC to say something. The NPC will pop up a chat bubble with the Chat Text in it, play the Chat Animation, and wait Chat Duration seconds.

The "Wander" state lets the NPC move around a bit. It does the random wandering that many of the NPCs in the game already do (in fact, they use the same code). The "Wander" state creates a random path for the NPC to walk, after which the NPC idles, after which the NPC creates a new path to walk, and so on. Wander Idle Time defines how long the NPC waits between creating paths. Wander Path Nodes determines how many path nodes are in the path - generally speaking, a larger number of path nodes creates a longer path. You can use this to strike the balance you want between "moving" and "stationary". Wander Distance is probably the least intuitive - it is NOT the distance of the random path created. It is the maximum distance from the NPC's spawn point that he will wander. So if you want a guy to stick close to his spawn position, keep wander distance low. Wander Speed is another fine tuning factor: it specifies the speed with which the NPC moves during the "Wander" state.

The final state, "Jobs", is more of an automated state than the others. For Jobs Duration seconds, the NPC will interact with nearby objects that have been set up to allow such automated interaction. This is wholly dependent on there being Cryptic designated ambient-interactable objects nearby, as opposed to UGC designated objects. Many of the objects have these designations enabled.

WARNING
"Wander" is limited in functionality until your map's first publish. After that, the navigation information will be generally up-to-date, with each publish updating it. Previewing (aka "Play Map" button) BEFORE the first publish will result in Wander doing nothing. New maps will need to go through the publish phase as well before they are wander-enabled. And if you drastically change your map (say, by adding 200 buildings to it), NPC movement will get a bit confused till the next publish.

Enjoy!
Post edited by baddmoonrizin on
«1

Comments

  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Oh! That makes sense! Thanks :D
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    A lot of useful info that I barely understand here.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Awesome, that all makes sense, though none of it solves my particular issue (making friendly and hostile NPCs fight each other). :p

    Any chance we can get some kind of list or general idea of what Cryptic-designated objects get interacted with during a Jobs cycle?
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    I can't seem to get this feature to work, at least not when I test a map. The NPCs with "enable wander = true" just stand there...even after I wait quite a while.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    I cranked all the variables up (weight and duration to max), but it still only happened very sparingly. I have a sneaking suspicion it's tied into the current issue that NPC pathing is atrocious at best, and the "wander" command comes back with being unable to establish a path to wander along or something.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Can some explain this in plain English? What is this used for?
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Kirkfat wrote: »
    Can some explain this in plain English? What is this used for?

    It's about doing stuff.

    Some stuff can be more important than other stuff.

    If you want your NPC group to be hard working Dozers, you enable Jobs, and give the Job Weight a high number. And they'll go scurrying between nearby consoles happily tapping away.

    If you'd rather they be Fraggles, you disable Jobs, and set the Idle Weight really high. You may optionally give them an idle animation to Dance their cares away.

    Say you've got a weight of 15 for Idle and 5 for Jobs. That's a total of 20 with a 75%/25% ratio.

    The AI picks a random activity, that is three times more likely to be Idle than Jobs. The chosen activity plays for the set duration time, and then a different activity is chosen. Again, with the same 75%/25% ratio.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Alright, I'll try to break it down a little more, as I understand it (I could be off as well).
    The first one is fairly simple:
    Combat Entry Text: This text is what the NPC says upon entering combat.
    Straightforward, this is what they'll say when they start fighting something.

    The way the Behavior works is that every state lasts for a specified duration (Wander Duration, Idle Duration, Chat Duration, and Jobs Duration). Once that state is completed, the code randomly selects another state, using the weights provided by the user (Wander Weight, Idle Weight, Chat Weight and Jobs Weight). If a state is disabled, its weight is effectively 0 since it cannot be chosen. Likewise, if a state's weight is 0, it will not be chosen. Otherwise, a weighted random choice is selected and the AI does that state's behavior.
    NPCs are programmed to randomly select from a list of actions they can perform at certain intervals. Let's say you've got Wander and Idle set on an NPC. They're standing at Idle, and the Duration you've set determines how long they're just going to stand around (I'm not sure what the unit of measurement is, but I'd guess seconds). Once that Duration runs out, the NPC goes back to the list of available actions and randomly chooses another one. So if they choose Wander this time, they'll move around.

    In terms of Weight, you're essentially setting the priority of that given action, and increasing the odds it'll be selected each time. So an NPC with a Wander Weight of 20 and an Idle Weight of 1 means they're almost always going to choose to Wander, and once in a while they'll stand around. If the Weight values for all actions are the same, then it's an even chance any of them will be picked.

    The "Idle" state is fairly simple and always enabled. For Idle Duration seconds, the Idle Animation is played.
    Also straightforward. The Idle animation can be almost anything you want, so that gives you a good variety of actions and traits you can display (and make it extremely handy for Demo Recordings :D).

    The "Chat" state allows the NPC to say something. The NPC will pop up a chat bubble with the Chat Text in it, play the Chat Animation, and wait Chat Duration seconds.
    The NPC, if they choose the Chat action from the list of possible actions, will say something you designate. If you have them set to basically only Chat, then they'll say the phrase pretty much constantly. If you want an NPC to just stand around and occasionally say something, then set the Idle Weight for a higher value than Chat (obviously, the higher you set it, the less frequently they'll say the phrase).

    The "Wander" state lets the NPC move around a bit. It does the random wandering that many of the NPCs in the game already do (in fact, they use the same code). The "Wander" state creates a random path for the NPC to walk, after which the NPC idles, after which the NPC creates a new path to walk, and so on. Wander Idle Time defines how long the NPC waits between creating paths. Wander Path Nodes determines how many path nodes are in the path - generally speaking, a larger number of path nodes creates a longer path. You can use this to strike the balance you want between "moving" and "stationary". Wander Distance is probably the least intuitive - it is NOT the distance of the random path created. It is the maximum distance from the NPC's spawn point that he will wander. So if you want a guy to stick close to his spawn position, keep wander distance low. Wander Speed is another fine tuning factor: it specifies the speed with which the NPC moves during the "Wander" state.
    Essentially, every time the Wander option gets chosen, the NPC creates a random path for itself to walk along. Again, Weight affects how often this happens. When they reach each path node, they'll pause for a moment (how long they wait can be changed with Wander Idle). If they've reached the end of the path they've created, they'll go back to the list of actions. Otherwise, they'll go to the next node (so the more nodes, the longer and farther they'll wander around). Wander Distance, you can pretty much think of like an electric collar. The spawn point is the grey circle the NPCs are arranged around when you first create their groups, so the Wander Distance is a radius around that which determines how far away from that point they can wander.

    The final state, "Jobs", is more of an automated state than the others. For Jobs Duration seconds, the NPC will interact with nearby objects that have been set up to allow such automated interaction. This is wholly dependent on there being Cryptic designated ambient-interactable objects nearby, as opposed to UGC designated objects. Many of the objects have these designations enabled.
    If my assumption is correct, this is mostly an ambiance thing. Basically it allows NPCs to walk around and interact with various objects (such as a Starfleet officer walking up to a console and pushing buttons for a moment). However, since it only works with Cryptic-designated objects, and there's as yet no list of what these objects are, it's a bit hard to figure out what'll make it work. :p
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    It's about doing stuff.

    Some stuff can be more important than other stuff.

    If you want your NPC group to be hard working Dozers, you enable Jobs, and give the Job Weight a high number. And they'll go scurrying between nearby consoles happily tapping away.

    If you'd rather they be Fraggles, you disable Jobs, and set the Idle Weight really high. You may optionally give them an idle animation to Dance their cares away.

    Say you've got a weight of 15 for Idle and 5 for Jobs. That's a total of 20 with a 75%/25% ratio.

    The AI picks a random activity, that is three times more likely to be Idle than Jobs. The chosen activity plays for the set duration time, and then a different activity is chosen. Again, with the same 75%/25% ratio.

    Thanks. What is a good map to test this on? I need one with a heavy amount of Cryptic-made interactable objects that the npcs will have jobs to do.

    Also, is there a good npc group to use to test?
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Kirkfat wrote: »
    Thanks. What is a good map to test this on? I need one with a heavy amount of Cryptic-made interactable objects that the npcs will have jobs to do.

    Also, is there a good npc group to use to test?
    I would probably pick an interior map with a lot of objects, and use some Fed NPC groups, since they won't attack you.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    It's used in the new Foundry, which we can use to create our own missions.

    What is explained above is applied to NPC's and how the behave on the map. I think they just stand still by default which could be handy if you want to create guards.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Allerka wrote: »
    Alright, I'll try to break it down a little more, as I understand it (I could be off as well).


    Straightforward, this is what they'll say when they start fighting something.



    NPCs are programmed to randomly select from a list of actions they can perform at certain intervals. Let's say you've got Wander and Idle set on an NPC. They're standing at Idle, and the Duration you've set determines how long they're just going to stand around (I'm not sure what the unit of measurement is, but I'd guess seconds). Once that Duration runs out, the NPC goes back to the list of available actions and randomly chooses another one. So if they choose Wander this time, they'll move around.

    In terms of Weight, you're essentially setting the priority of that given action, and increasing the odds it'll be selected each time. So an NPC with a Wander Weight of 20 and an Idle Weight of 1 means they're almost always going to choose to Wander, and once in a while they'll stand around. If the Weight values for all actions are the same, then it's an even chance any of them will be picked.



    Also straightforward. The Idle animation can be almost anything you want, so that gives you a good variety of actions and traits you can display (and make it extremely handy for Demo Recordings :D).



    The NPC, if they choose the Chat action from the list of possible actions, will say something you designate. If you have them set to basically only Chat, then they'll say the phrase pretty much constantly. If you want an NPC to just stand around and occasionally say something, then set the Idle Weight for a higher value than Chat (obviously, the higher you set it, the less frequently they'll say the phrase).



    Essentially, every time the Wander option gets chosen, the NPC creates a random path for itself to walk along. Again, Weight affects how often this happens. When they reach each path node, they'll pause for a moment (how long they wait can be changed with Wander Idle). If they've reached the end of the path they've created, they'll go back to the list of actions. Otherwise, they'll go to the next node (so the more nodes, the longer and farther they'll wander around). Wander Distance, you can pretty much think of like an electric collar. The spawn point is the grey circle the NPCs are arranged around when you first create their groups, so the Wander Distance is a radius around that which determines how far away from that point they can wander.



    If my assumption is correct, this is mostly an ambiance thing. Basically it allows NPCs to walk around and interact with various objects (such as a Starfleet officer walking up to a console and pushing buttons for a moment). However, since it only works with Cryptic-designated objects, and there's as yet no list of what these objects are, it's a bit hard to figure out what'll make it work. :p

    Thanks Allerka. This is really helpful. My only problem is that none of it seems to work. Have you tested this with groups of npcs? Is there a specific group? Do you have to publish the mission before seeing the results, or can you play around with it in map previews?
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Kirkfat wrote: »
    Thanks Allerka. This is really helpful. My only problem is that none of it seems to work. Have you tested this with groups of npcs? Is there a specific group? Do you have to publish the mission before seeing the results, or can you play around with it in map previews?
    Most of it's been working for me in map testing (I haven't published anything yet). Wandering appears to be sporadic at best, but the map might also be a factor (it's heavily strewn with debris and isn't very maneuverable). But Idle and Chat have worked fine for me (I've got an NPC at one point who's basically hiding in a corner with one of those afraid emotes and occasionally says something). This is all on Fed and Borg NPCs. The only thing I haven't really tested yet is Jobs (as the map is pure combat, there's not much room for that anyway :P).
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    It's used in the new Foundry, which we can use to create our own missions.

    What is explained above is applied to NPC's and how the behave on the map. I think they just stand still by default which could be handy if you want to create guards.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Kirkfat wrote: »
    Thanks. What is a good map to test this on? I need one with a heavy amount of Cryptic-made interactable objects that the npcs will have jobs to do.

    Also, is there a good npc group to use to test?

    You could always pick a ratio between Idle and Chat. I've currently got a bunch of reskinned TOS Klingons alternating between Bear Dancing and Shouting 'Dooby dooby doo!' while Laughing Evilly.

    Haven't quite done the sums on the weights, but it seems to alternate.

    The Wander thing may be suboptimal in Preview, as nodes aren't calculated until it's Published.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Works for me and yes you can hit play before publish.

    Well right now it crashes on me, I thought everyone might be getting that problem when trying to play, please let me know if your not because it is a bug that will need reported.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Kirkfat wrote: »
    Can some explain this in plain English? What is this used for?

    When a Non Player Character (NPC) is set up by you on a map, there are factors which control the behavior of the NPC.

    These factors control time, range, and task of the target.

    For example, you want to place a enemy NPC unit on a map. Then you want to determine if the NPC will be stationary or will it move. The NPC uses a mathematical algorithm to move around or wander. When you use the sliders or write a number in the block for the NPC, that factor will control the NPC's behavior.

    If you decide you want the NPC to guard a spot or patrol a section of a map, then you need to set it up to wander. Then you set a range factor to determine how far from that spot you want the NPC to move. You use a path to determine the behavior or action of the NPC. The NPC will determine its own behavior when you set its path. A high number will determine that the NPC will follow a longer path. If you move on a longer path, then it will shorten the amount of time the NPC will have between leaving the spot you picked it to guard and moving on its path. If you want the NPC to come back sooner to its spot, pick a low number.

    The job essentially tells the NPC to guard its spot. The number you give it determines how responsive the NPC will be if a player wanders into the spot.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    It's about doing stuff.

    Some stuff can be more important than other stuff.

    If you want your NPC group to be hard working Dozers, you enable Jobs, and give the Job Weight a high number. And they'll go scurrying between nearby consoles happily tapping away.

    If you'd rather they be Fraggles, you disable Jobs, and set the Idle Weight really high. You may optionally give them an idle animation to Dance their cares away.

    Say you've got a weight of 15 for Idle and 5 for Jobs. That's a total of 20 with a 75%/25% ratio.

    The AI picks a random activity, that is three times more likely to be Idle than Jobs. The chosen activity plays for the set duration time, and then a different activity is chosen. Again, with the same 75%/25% ratio.

    A nice Fraggle rock reference here. Although no one born after 1988 will probably understand it.

    Dance your cares away
    Worry's for another day
    Let the music play
    Down at Fraggle Rock
    Work your cares away
    Dancing's for another day
    Let the Fraggles play

    [From: http://www.elyrics.net/read/m/muppets-lyrics/fraggle-rock-theme-lyrics.html ]

    We're Gobo Mokey Wembley Boober Red
    Dance your cares away
    Worry's for another day
    Let the music play
    Down at Fraggle Rock

    :)
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Thanks guys. I think I understand this. I'll make a video tutorial on it using a Klingon guard or something.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Kirkfat wrote: »
    Thanks guys. I think I understand this. I'll make a video tutorial on it using a Klingon guard or something.

    I am currently working on my own fleets wiki site which we are making into our official LCARS system.

    http://sf41lcars.wikidot.com/library-access-and-retrieval-system-v-1-0

    Thank you :)
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    A nice Fraggle rock reference here. Although no one born after 1988 will probably understand it.

    Fraggle Rock is a metaphor for life.

    When you have to become a Dozer, the Fraggles will hate you.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Has it been determined that this is not working properly in preview mode?

    I have all of the wander settings set to max. On my space map, my ships crawl around like they've been fed downers. On my ground map, everyone just stays where they are.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    This is really useful info. Can it be applied to solo NPCs (i.e. custom "Costumes") or is it just the groups that can be brought to life in this way?

    A lot of my ideas will be silly with groups of NPCs everywhere so I'm wanting to keep to individuals doing their own thing.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    So some further research has discerned that Jobs interacts with most consoles. If you look at items in the Details window, and you can see little red mannequins in the picture, that means it can be interacted with as a Job. Not all items are labeled in this fashion, though.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    I'll add this to the main post too, but "Wander" is limited in functionality until your project's first publish. After that, the navigation information will be generally up-to-date, with each publish updating it. Previewing (aka "Play Map" button) BEFORE the first publish will result in Wander doing nothing.

    I hope this helps clear up some of the confusion.

    I'd also like to add some means of knowing which objects come with Jobs, since not all do, but it's probably not systemic or anything.

    - AStarSearcher
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    I should have checked this earlier, this is definitely helpful.

    Are there plans to allow us setting waypoints manually? Or are there more behaviors coming?
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Wander, with some reasonable values, strikes me as one of those things that should default to on for a group of enemies.

    Having them stand still creates a rather lifeless and unnatural environment (for non-borg, anyway). Having to set them each time is a bit annoying.

    Also, it'd be nice if there was a visual indicator on the map of the area the wander range covers.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    hi StarSearcher,

    i actually build and published some kind of test map,
    just to learn the features...

    my problem is:
    i wanted to set up animated non-attacking npcs,
    so ive chosen a neutral squad and gave them an idle animation.
    chat, wander and jobs are turned off.
    so duration and weight shouldnt be important (as i understood it)

    if i preview the map within the foundry it works,
    but after publishing they just stand there and do nothing...

    anything i forgot or is there something not working properly?
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    Allerka wrote: »
    Awesome, that all makes sense, though none of it solves my particular issue (making friendly and hostile NPCs fight each other). :p


    I'm having the opposite problem. I wanted to make a mission where the Terrans and the Remans were forming an alliance and they just beat the TRIBBLE out of each other. Was wondering if there was a way to make them play nice.
  • Archived PostArchived Post Member Posts: 2,264,498 Arc User
    edited December 2010
    itsmiami wrote: »
    Allerka wrote: »
    Awesome, that all makes sense, though none of it solves my particular issue (making friendly and hostile NPCs fight each other). :p


    I'm having the opposite problem. I wanted to make a mission where the Terrans and the Remans were forming an alliance and they just beat the TRIBBLE out of each other. Was wondering if there was a way to make them play nice.

    Use a friendly group and change the individual costumes to Remans. They'll play nice then.
This discussion has been closed.