The following sequence of operations will guide you through the specification
of *Agent-04*. This agent will use some of the behaviors shared by
the previous agents. This agent will also introduce a number of new
behaviors.
*Agent-04* will:
- Combine strafe-based approaching with attempts to pickup incentory
items. In other words, it will blend it's sttering behaviors.
- Categorize the separation between it and it's target. This translation
from quantitative into qualitative will then shape its responses to the target.
To specify *Agent-04* you'll need to perform the following operation
on the Agents-01-04.mdl template.
- Download then open the "Agents-01-04.mdl" file in Rational Rose and display Agent-04's Use Case Diagram in the model browser.
You'll notice that all the Use Cases necessary to specify Agent-04's
new behaviors have been provided. You'll also notice that the association
between *Agent-04* and the "Rotate to follow" Use Case is already present.
- Move the "4-runto-location" and "4-runto/enforcer" Use Cases up a little
and add the associations necessary to relate them to
*Agent-04*.
- Carefully re-create these associations between
the remaining new Use Cases and the older portions of the Use Case Diagram.
Notice how 4 things can occur after separation is classified. As
you add each association, think about the lines of behavior you're epxcifying.
- Use the "Format > Layout Diagram" menu choice
to "clean up" the Use Case Diagram.
- Expose and double-click on Agent-04's main control
structure. You'll notice that this State Chart has been given the
name "BLines". BLines is short or "Behavior Lines" but you're free
to call the control structure anything you like. All of the sensors,
deliberators, and effectors required by *Agent-04* are provided in the control
structure. You will have to work on some of the internal rules though...
- Right-click on "4-rotate/follow" and select it's
"S2" sub-diagram. You could have decided on a different sub-diagram
name. In thies example agent, sub-diagram names are made up of a letter
indicating if they are a Sensor, Deliberator, or Effector
and an arbitrary unique number.
- Because we've seen "rotate/follow" in all of our
previous agents, the sensor's internal rule is provided.
- 4-runto-enforcer is new. One of the
critical new predicates is inventory-item. By using this predicate
in a guard pattern, *Agent-04* is able to respond to objects in it's FOV.
*Agent-04* keeps an eye out for enforcers (pistols). Unreal Tournament
internally labels these as botpack.enforcer. Of course, there are many
other inventory items. Consult the GameBotsIO documentation for more
information.
- We're all familiar with the location predicate... The screenshot
shows how the agent determines the enforcer's location.
- 4-classify-separation uses a FOPC function to
convert quantitative separation into a qualitative assessment of separation.
The Lisp function classify-separation maps separation ranges into symbolic
categories. The provided definition of classify-separation maps 0-90
into "close", 91-160 into "closeish", 161-300 into "farish", and 301+ into
"far". These category names could be changed. The separation
classification is asserted as an explicit separation predicate relating the
agent and target.
- 4-strafe/target requires a little work too.
Notice how a disjunction is used in the 1st guard to make sure separation
between the agent and target is either closeish or farish. These 2
categories of separation are assumed to indicate the target is at a "Medium
Range".
- Enter a pattern that will allow *Agent-04* to determine the location of the Medium Ranged target. Notice how
Medium Ranged targets will be pursued via normal strafing...
- If agent/target separation is "far", then 4-predicte-location
will use a FOPC function to estimate a future target location so *Agent-04*
can "intercept" rather than follow the target.
- Make sure that the arguments you pass to the
FOPC function correspond to the 7 expected my the Lisp function (a4-predicted-location).
- Here you can see the final correct guards for 4-strafe/target.
- 4-shoot-at uses the previously unseen health and
currentammo predicates. Notice how the 2 constraint variables are used
to check if *Agent-04* has been shot and has ammunition for it's enforcer.
*Agent-04* doesn't care who shot it, if it's been hit and you wander
into it's FOV, it will shoot at you. Blind revenge or something...
- Once the sensor, deliberator, and effector rules have been provided,
you'll need to specify the control structure itself. To systematically
do this, begin by adding enough relays to propagate
activity to 1 level deeper than the deepest deliberator. Since the
4-predicitve-strafeto deliberator is 3 levels into the control structure,
the relays must take the behavior lines to 4 levels.
- Connect the relays to the sensors, deliberators, and each other with
transitions. Since we want *Agent-04* to strafe instead of rotating
whenever possible, add 2 subsumption links to the control
structure.
- If we want *Agent-04* to rotate in certain circumstances, we'll need
to make sure that rotating subsumes stopping. To specify this relationship
between rotating and stopping, add an additional "layer"
of relays and add another subsumption link to the control structure.
Could this link be repositioned?
- Because we want legitimate stopping to stop strafing AND running, we
need to add another layer of relays and one last subsumption
link. Be sure that your subsumption links are stereotypes as "neg".
In the screenshots I've colored the subsumption links so they are highly
visible.
- Since *Agent-04* employs subsumption links, we're going to have to
change some of our relays into threshold devices.
Any time a relay has any subsumption links as inputs, it needs to be
stereotypes as a td1. Stereotype the 3 necessary threshold devices...
- Assigning threshold devices a unique color can
make them easier to spot...
- The 4-classify-separation sensor was deliberately
NOT stereotyped. If you fail to provide all required stereotypes, code
generation will fail--the Lisp simply can't assume your attentions...
- Double click the sensor and assign it a sensor stereotyps...
- Also make sure the sub-diagram (also named "4-classify-separation")
is stereotyped as a rule.
- Use the "Format > Layout Diagram" menu choice
to "clean up" the control structure if you like...
You should now save the model file and convert it into executable Lisp.
Assuming no errors are generated, you should be able to load the agent's
lisp file, load the support functions in "Agent-04-func.lisp", and activate
*Agent-04* in the testbed.