Wartbed:Manual/Targets and Orders

From Dark Omen Wiki

Jump to: navigation, search


This article discusses
  • Target: A class that stores a reference to a Model or a position.
  • Order: A class that represents an instruction that can be sent to a Model.
  • order::Queue: A class that implements a stack-like store of Orders for an Actor

Target

Target is a class that points to an Model or stores a position, and also keeps an optional offset. It is used to represent the goal of any Order that refers to a location or entity.

Overview of Actors and Orders

  • Actors have an order::Queue member object, which is a stack of Orders.
  • Actors have an OBJECTIVES member map, which is a set of Targets.
  • Orders can
    • reassign the current objectives of an Actor
    • modify some behavioural dispositions of an Actor

The OBJECTIVES map is a binding of an enum key and a Target value, as below:

namespace wb 
{
    namespace order
    {
        enum TARGET_INTENTION
        {
            INTENT_approach_target,
            INTENT_defend_target,
            INTENT_attack_target,
        };
    }
 
    typedef std::map<TARGET_INTENTION, TARGET_PTR> OBJECTIVES;
 
    struct TargetOrder : Order
    {
        OBJECTIVES objectives;
        ...
        virtual void apply( Actor &rTarget ) const;
        ...
    };
}

This allows Orders directed against specific targets to combine several behaviour goals, that is objectives, and selectively apply these to the Actor (or Orderable) it has been issued to. For instance, an order could provide a target to attack, while at the same time not override any existing target to defend, thus providing an additional objective for the unit to achieve simultaneously. Notice that all orders altering the objectives of the recipient Actor are of TargetOrder type, a subtype of Order.

Orders (examples)

TargetOrders: Can be designated to target Models or positions, as well as an offset to the target.

  • MoveTo
  • Protect
  • Escort
  • Attack
  • ...

DispositionOrders: Takes a value

  • SetFormationCohesiveness
  • SetAvoidFriendsDisposition
  • ...
Personal tools
communication