Wartbed:Manual/Theatre of War
From Dark Omen Wiki
(Created page with '{{stub}} <div style="margin:1em; border: 1px solid gray; background:lightgray;"><div style="background:gray;">'''This article discusses'''</div> <div style="padding:1em; "> * ''...') |
(Updated to reflect actual implementation) |
||
Line 4: | Line 4: | ||
<div style="padding:1em; "> | <div style="padding:1em; "> | ||
* '''<tt>Theatre</tt>''': The class encapsulating the entire set of constituent elements from which the game "map" or "level" is built and construed. | * '''<tt>Theatre</tt>''': The class encapsulating the entire set of constituent elements from which the game "map" or "level" is built and construed. | ||
- | * '''<tt> | + | * '''<tt>theatre::SceneElement</tt>''': The base class for all contents in a scene (all Props in a Theatre). |
- | * '''<tt> | + | * '''<tt>theatre::Light</tt>''': A class representing a non-effect light affecting the stage |
- | * '''<tt> | + | * '''<tt>theatre::Indicator</tt>''': A class used as an ersatz or indicator of something not visible |
- | + | ||
</div></div> | </div></div> | ||
- | ==Theatre | + | ==Theatre and SceneElements== |
- | The Theatre class represents the world by containing all <tt>Prop</tt>s constituting it | + | The Theatre class represents the world by containing all <tt>SceneElement Prop</tt>s constituting it. Unit movement and pathfinding does not primarily use the Theatre contents, but instead calls on a node-space representation of the map. |
This part of WARTBED intentionally uses the theatre metaphor because of its good fit and relevant separation of responsibilities. | This part of WARTBED intentionally uses the theatre metaphor because of its good fit and relevant separation of responsibilities. | ||
- | + | Generic overview: | |
<div style="margin:1em; padding:1em; background:rgb(175,200,175);"><source lang="cpp"> | <div style="margin:1em; padding:1em; background:rgb(175,200,175);"><source lang="cpp"> | ||
- | + | typedef shared_ptr<SceneElement *> SCENE_ELEMENT; | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
class Theatre | class Theatre | ||
{ | { | ||
- | + | SCENE_ELEMENT root; | |
- | + | ||
- | + | ||
- | + | ||
... | ... | ||
}; | }; | ||
- | + | namespace theatre | |
{ | { | ||
- | ... | + | class SceneElement : public Prop |
- | }; | + | { |
+ | ... | ||
+ | }; | ||
- | class | + | class ElementGroup : SceneElement |
- | { | + | { |
- | + | ... | |
- | + | }; | |
- | ... | + | |
- | }; | + | class Light : SceneElement |
+ | { | ||
+ | ... | ||
+ | }; | ||
+ | |||
+ | class Indicator : SceneElement | ||
+ | { | ||
+ | ... | ||
+ | }; | ||
+ | } | ||
</source></div> | </source></div> | ||
+ | The Theatre contains specialisations of SceneElement stored in SCENE_ELEMENT smart pointers. All elements are nodes in a hierarchy, starting at <tt>Theatre::root</tt>. | ||
+ | |||
+ | All scene elements are Props, and all are created through an abstract factory. Thus, the Theatre class and subscribing code need not care about the underlying implementation of the scene components, which means that the same architecture can be used both for server and client modules. | ||
==Weather== | ==Weather== |
Revision as of 16:58, 27 February 2010
- Theatre: The class encapsulating the entire set of constituent elements from which the game "map" or "level" is built and construed.
- theatre::SceneElement: The base class for all contents in a scene (all Props in a Theatre).
- theatre::Light: A class representing a non-effect light affecting the stage
- theatre::Indicator: A class used as an ersatz or indicator of something not visible
Theatre and SceneElements
The Theatre class represents the world by containing all SceneElement Props constituting it. Unit movement and pathfinding does not primarily use the Theatre contents, but instead calls on a node-space representation of the map. This part of WARTBED intentionally uses the theatre metaphor because of its good fit and relevant separation of responsibilities.
Generic overview:
typedef shared_ptr<SceneElement *> SCENE_ELEMENT; class Theatre { SCENE_ELEMENT root; ... }; namespace theatre { class SceneElement : public Prop { ... }; class ElementGroup : SceneElement { ... }; class Light : SceneElement { ... }; class Indicator : SceneElement { ... }; }
The Theatre contains specialisations of SceneElement stored in SCENE_ELEMENT smart pointers. All elements are nodes in a hierarchy, starting at Theatre::root.
All scene elements are Props, and all are created through an abstract factory. Thus, the Theatre class and subscribing code need not care about the underlying implementation of the scene components, which means that the same architecture can be used both for server and client modules.
Weather
Placeholder