Wartbed:Game Engine Structures
From Dark Omen Wiki
(→The situation, and fair AI play) |
|||
Line 84: | Line 84: | ||
class Player; | class Player; | ||
- | struct Regiment | + | To be defined later. A <code>Player</code> can be human or AI. |
+ | |||
+ | struct Regiment //perhaps bad name | ||
{ | { | ||
UnitType type; | UnitType type; | ||
Line 108: | Line 110: | ||
This set-up allows (in theory) cool things like unknown battle situations, dynamic creation, discovery and switching of allegiances of players, and that others' units not in LoS does not have to disappear immediately but can rather fade or something. | This set-up allows (in theory) cool things like unknown battle situations, dynamic creation, discovery and switching of allegiances of players, and that others' units not in LoS does not have to disappear immediately but can rather fade or something. | ||
- | The second benefit of this is that all players always only have access to the contents of the Situation structure, including the AI. This means that there will be an enforced fairness between all players. | + | The second benefit of this is that all players always only have access to the contents of the Situation structure, including the AI. This means that there will be an enforced fairness between all players. |
==Structures related to issuing of orders== | ==Structures related to issuing of orders== |
Revision as of 13:46, 27 July 2008
Data structures etc belonging to WARTBED's "logic" (as opposed to the presentation).
Generic structures
Generic structures and definitions directly under the wartbed namespace.
enum FLOCKING_BEHAVIOUR { FLOCK_none = 0, FLOCK_mill = 1, FLOCK_formate = 2, };
This enum will determine which algorithm that controls the immediate movement behaviour of an unit.
enum UNIT_STATE { STATE_normal = 0, STATE_routing = 1, STATE_fleeing = 2, STATE_inactive = 3, STATE_destroyed = 4, STATE_gone = 4, };
Both "destroyed" and "gone" (left battle field) are the same for in-battle purposes.
enum TARGET_MODE { TARGET_position, TARGET_unit, };
Control enum for all targeting, which is relevant for orders.
struct Position; struct Unit; class Target { TARGET_MODE target_type; union { mutable Position *pPos; Unit const *pUnit; } public: Target( Position const &rPos ) : target_type(TARGET_position) { pPos = new Position( rPos ); } Target( Unit const &rUnit ) : target_type(TARGET_unit) { pUnit = &rUnit; } ~Target() { if (TARGET_position == target_type) delete pPos; } Vector3 operator* () const { return (TARGET_position == target_type) ? **pPos : pUnit->getPosition(); } };
Might seem as a complex class for its purpose, but it will be very convenient for a uniform interface when issuing orders.
class Unit { FLOCKING_BEHAVIOUR flocking_mode; UNIT_STATE state; Target target; };
Very preliminary stub.
The situation, and fair AI play
class Player;
To be defined later. A Player
can be human or AI.
struct Regiment //perhaps bad name { UnitType type; unsigned num_units; Position position; bool in_sight; double last_observed_ago; }; struct Partisan { Player const *pPlayer; std::vector<Regiment> observation; }; struct Situation { Partisan friends; Partisan enemies; partisan neutrals; //? };
This set-up allows (in theory) cool things like unknown battle situations, dynamic creation, discovery and switching of allegiances of players, and that others' units not in LoS does not have to disappear immediately but can rather fade or something.
The second benefit of this is that all players always only have access to the contents of the Situation structure, including the AI. This means that there will be an enforced fairness between all players.
Structures related to issuing of orders
All regiment control options ("orders" issuable to regiments) are under the orders namespace, which is a direct sub-namespace to wartbed
. Contains control structures and values for all orders that can be issued to units.
enum MOVE_ORDER { MOVE_no_order = 0, MOVE_to = 1, MOVE_approach = 2, MOVE_avoid = 3, MOVE_keep_distance = 4, MOVE_face = 5, MOVE_continuous = 0xF0000000, };
enum HOLD_ORDER { HOLD_no = 0, HOLD_grounds = 1, HOLD_pursue = 2, };
enum ATTACK_ORDER { ATTACK_no_order = 0, ATTACK_await_charge = 1, ATTACK_at_will = 2, ATTACK_charge = 3, ATTACK_fire_missile = 4, ATTACK_continuous = 0xF0000000, };
enum FIRE_ORDER { FIRE_no_order = 0, FIRE_hold = 1, FIRE_at_will = 2, FIRE_normal = 3, FIRE_force = 4, };