Wartbed:Manual/Theatre of War

From Dark Omen Wiki

Jump to: navigation, search


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).

Contents

The Theatre and SceneElement classes

The world (or universe, scene, or many other synonymous words) of a WARTBED session is a collection of objects gathered under a histrionic nomenclature and contained in an instance of the Theatre class. The theatre metaphor was chosen because of its good fit and relevant separation of responsibilities for representing a WARTBED simulation universe. The word "Theatre" is preferred over "Scene", since the latter tends to be strongly associated with rendering of 3D objects, while the WARTBED Theatre is also used in pure simulations without graphical representation. A "theatre" is therefore considered a much wider concept and of broader usage than a "scene".

The Theatre class represents the world at large, and is composed of a hierarchically ordered collection of SceneElement instances. All scene elements contained are SCENE_ELEMENT smart pointers nodes in a hierarchy, starting at Theatre::root. Note that unit movement and pathfinding does not primarily use the Theatre contents, but instead calls on a node-space representation of the map.

Scene elements

SceneElement is an abstract base class derived from the Prop class, which in turn extends mvc::Model. Thus, all elements of a theatre are also models and as such can be used transparently with all other models inside the MVC architecture. Scene elements are not Actors, though, and can't be issued Orders.

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 { ... };
}

Accessing and changing elements after initial creation

A theatre takes exclusive responsibility for the scene elements it contains and keeps track internally of what data it contains. To this scene elements are categorised on two dimensions: by their scene element data type and prop type. The data type corresponds to the data in general the object is containing or representing, f.i. 3D geometry, lights or audio. The prop type on the other hand reflects the scene object's actual (specific) use in the scene, f.i. terrain, water, weather or sound effects. Therefore, after having been added to a theatre, the data or prop types of a scene element can only be altered through setter methods of the theatre object containing the element.

Example usage:
THEATRE pTheatre = DarkOmenSceneLoader().createScene( "c:/games/Dark Omen/gamedata/1pbat/B1_01" );
theatre::ELEMENTS audio_element = pTheatre->getByType( theatre::SET_audio );

Implementation notes

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.

Principally, clients will load level data through a factory specialised for OGRE 3D, which will generate scene elements prepared for rendering by OGRE (but also for audio etc), while a server application will generate its theatre through the same data parser populated by a factory specialised for generating data for an abstract simulation.

Weather

Placeholder

Personal tools
communication