Wartbed:Manual/Theatre of War

From Dark Omen Wiki

(Difference between revisions)
Jump to: navigation, search
(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>Stage</tt>''': A class in Theatre containing all <tt>Terrain Prop</tt>s related to terrain and physical objects and their effects.  
+
* '''<tt>theatre::SceneElement</tt>''': The base class for all contents in a scene (all Props in a Theatre).
-
* '''<tt>Lighting</tt>''': A class in Theatre containing all non-effect lights affecting the Stage
+
* '''<tt>theatre::Light</tt>''': A class representing a non-effect light affecting the stage
-
* '''<tt>Backdrop</tt>''': A class in Theatre defining the backdrop (sky, clouds, etc) to the Stage.
+
* '''<tt>theatre::Indicator</tt>''': A class used as an ersatz or indicator of something not visible
-
* '''<tt>Weather</tt>''': A class in Theatre defining the weather conditions of the Scene
+
</div></div>
</div></div>
-
==Theatre, Scene, Lighting and Backdrop==
+
==Theatre and SceneElements==
-
The Theatre class represents the world by containing all <tt>Prop</tt>s constituting it. It is used to generate Views that will represent it visually and auditory. Unit movement and pathfinding does not primarily use the Theatre contents, but instead calls on a node-space representation of the map.  
+
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.  
-
Stub:
+
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">
-
class Stage;
+
typedef shared_ptr<SceneElement *> SCENE_ELEMENT;
-
class Lighting;
+
-
class Backdrop;
+
-
class Weather;
+
-
class Terrain;
+
class Theatre
class Theatre
{
{
-
     Stage    stage;
+
     SCENE_ELEMENT root;
-
    Lighting  lighting;
+
-
    Backdrop  backdrop;
+
-
    Weather  weather;
+
     ...
     ...
};
};
-
class Terrain : public Prop
+
namespace theatre
{
{
-
     ...
+
     class SceneElement : public Prop
-
};
+
    {
 +
        ...
 +
    };
-
class Stage
+
    class ElementGroup : SceneElement
-
{
+
    {
-
     typedef std::map<STRING, TERRAIN_PTR> TERRAIN;
+
        ...
-
     TERRAIN terrain;
+
     };
-
     ...
+
 
-
};
+
     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


This article discusses
  • 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

Personal tools
communication