Wartbed:Manual/Targets and Orders

From Dark Omen Wiki

< Wartbed:Manual(Difference between revisions)
Jump to: navigation, search
(Created page with '* <tt>Actors</tt> have an <tt>order::Queue</tt> member object, which is a stack of <tt>Order</tt>s. * <tt>Actors</tt> have an <tt>OBJECTIVES</tt> member map, which is a set of <t...')
(Example Orders)
 
(3 intermediate revisions not shown)
Line 1: Line 1:
 +
{{stub}}
 +
 +
<div style="margin:1em; border: 1px solid gray; background:lightgray;"><div style="background:gray;">'''This article discusses'''</div>
 +
<div style="padding:1em; ">
 +
* '''<tt>Target</tt>''': A class that stores a reference to a Model or a position.
 +
* '''<tt>Order</tt>''': A class that represents an instruction that can be sent to a Model.
 +
* '''<tt>order::Queue</tt>''': A class that implements a stack-like store of Orders for an Actor
 +
</div></div>
 +
 +
==Target==
 +
<tt>Target</tt> is a class that points to an <tt>Model</tt> or stores a position, and also keeps an optional offset. It is used to represent the goal of any <tt>Order</tt> that refers to a location or entity.
 +
 +
==Overview of Actors and Orders==
* <tt>Actors</tt> have an <tt>order::Queue</tt> member object, which is a stack of <tt>Order</tt>s.
* <tt>Actors</tt> have an <tt>order::Queue</tt> member object, which is a stack of <tt>Order</tt>s.
* <tt>Actors</tt> have an <tt>OBJECTIVES</tt> member map, which is a set of <tt>Target</tt>s.
* <tt>Actors</tt> have an <tt>OBJECTIVES</tt> member map, which is a set of <tt>Target</tt>s.
-
* <tt>Orders</tt> reassign the current <tt>objectives</tt> of an actor.
+
* <tt>Orders</tt> can
 +
** reassign the current <tt>objectives</tt> 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:
 +
<div style="margin:1em; padding:1em; background:rgb(175,200,175);"><source lang="cpp">
 +
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;
 +
        ...
 +
    };
 +
}
 +
</source></div>
 +
This allows <tt>Order</tt>s directed against specific targets to combine several behaviour goals, that is objectives, and selectively <tt>apply</tt> these to the <tt>Actor</tt> (or <tt>Orderable</tt>) 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 <tt>TargetOrder</tt> type, a subtype of <tt>Order</tt>.
-
==Example <tt>Order</tt>s==
+
==Orders (examples)==
 +
'''<tt>TargetOrder</tt>s''': Can be designated to target Models or positions, as well as an offset to the target.
 +
* <tt>MoveTo</tt>
 +
* <tt>Protect</tt>
 +
* <tt>Escort</tt>
 +
* <tt>Attack</tt>
 +
* ...
-
* MoveTo( Position or mvc::Model )
+
'''<tt>DispositionOrder</tt>s''': Takes a value
-
* Protect( Position or mvc::Model )
+
* <tt>SetFormationCohesiveness</tt>
-
* Escort( mvc::Model )
+
* <tt>SetAvoidFriendsDisposition</tt>
-
* Attack( Position or mvc::Model )
+
* ...
[[category:Manual]]
[[category:Manual]]

Current revision as of 22:16, 28 January 2010


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