Wartbed:Design/Map format

From Dark Omen Wiki

Jump to: navigation, search


Types of maps

Principally there are four classes of maps used in tactical war games:

  1. No terrain, perhaps models (f.i. space games)
  2. Terrain from height map, no Y-crossings (Myth)
  3. Terrain from height map and models, no Y-crossings (WH:DO*)
  4. Terrain from height map and models, Y-crossings (ST:TA)
  5. Terrain from model(s) only, possible Y-crossings
* Dark Omen's visible map is a pure model, which however only has a decorative purpose. Internally height maps are used for all game calculations.

WARTBED will support height maps and models for terrain, but to accommodate all types of maps will not use this for game calculations. Instead a node matrix (a set of mutually linked nodes) will represent the arena internally. This serves both height map and pathfinding purposes. Each node will have attributes that affects events and movements in that node.

Internal WARTED Data Structures

A map, or arena or theatre of war, consists of a battleground, which simply is a set of geometry and visuals, and an abstract collection of interconnected spatial nodes that describes where it is possible to go and how to get there. The map management classes are responsible for rendering ONLY, and performs no game logic, which is all strictly kept on the server side.

namespace theatre
{
    //struct Renderable {}; defined somewhere else
    struct MapEntity {};
    struct Terrain : MapEntity {};
    struct Prop : MapEntity {};
    struct Transparency : MapEntity {};
    struct Animation : MapEntity {};
    struct Effect : MapEntity {};


    typedef pathfinding::NodeMatrix Topology;


    struct Battleground
    {
        vector<MapEntity>  all_entities;    // Main storage
        vector<Terrain>    terrain;         // subset; 1st render group
        vector<Prop>       props;           // subset; 2nd render group 
        vector<Animation>  animations;      // subset; 3rd render group
        vector<Effect>     effects;         // subset; 4th render group
        vector<Transp>     transparencies;  // subset; 5th render group

        //skybox, sun, moons, clouds, decorations?        
    };
}


class TheatreOfWar
{
    theatre::Topology       topology;
    theatre::Battleground   battleground;

    void renderTroops( ListOfTroops troops ); // or something to this effect
};

The TheatreOfWar class in used by the server-side Battle class and the client-side Game classes.

Movement, Pathfinding and Demands on Unit Data

Transcluded from Wartbed:Unit data/Movement capabilities

WARTBED Units movements are defined in a set of abilities, declared per-unit in their script file definitions:

Suggested WARTBED movement capabilities
Positive Negative Description
can cross land can't cross land Normal land movement
landwalker not landwalker Unhampered by difficult terrain
can cross woods can't cross woods Can walk through forests
woodwalker not woodwalker Unhampered by forests
can_cross_water can't cross water Can cross shallow water
can swim can't swim Can cross deep water
can levitate can't levitate Can cross all terrain (but not chasms)
can fly can't fly Can move to any valid area
All units default to the negative on all abilities (i.e. can't move at all). Movement capabilities must explicitly be turned on. Units inherit the capabilities of their superclass (a wood elf inherits the same movement capabilities as the base elf it specialises), and if it shouldn't have an ability, it must be turned off explicitly (set to the negative).


This design has the effect that different weights can influence the pathfinding calculations, f.i. the weight of difficult terrain will be greatly reduced for an unit with the landwalker movement capability. This is an elegant way of allowing crossing Y-paths and enable distinct differences in movement without requiring specialised pathfinding solutions.

Personal tools
communication