View Single Post
Lt. Commander
Join Date: Dec 2007
Posts: 120
# 9
12-05-2010, 05:38 AM
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 ).

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