Documentation for WGLib

WGLib is a python module that can be used to create, load, manipulate, and save WarGear maps. An overview of the classes in WGLib is given first, and then links to more detailed documentation.

WGMap

The primary class in this module is the WGMap. WGMap provides basic capabilities to all WarGear maps. WGMap has many methods:

  • Add borders, continents, and territories
  • Calculate board statistics like total continent, total territory & overall bonuses
  • Verify that all territories on the board are reachable
  • Check if two territories share a border
  • Find the # of borders that territories have
  • Find the neigboring territories of a target territory
  • Hordify a map (very flexible)
  • Load a map from an exported XML file
  • Save a map to an XML file for import
  • Calculate & print lots of statistics about a map
  • Find all ‘sole continent territories’ and set them to neutral
  • Set rules like the # of allowed attacks or # of allowed fortifies

Along with lots of helper functions to make accessing and manipulating the XML easier

SquareGridWGMap

SquareGridWGMap extends WGMap for dealing with maps on a square grid. An sample of what this class can do:

  • Add all the territories for a row x column map
  • Extension of WGMap methods accessed by row and column
  • Identify groups of territories that are not connected and find a place to add a border to connect them

MazeWGMap & KnightWGMap

These class are extensions of the SquareGridWGMap that are used to create specific boards. They are not documented as well because I assume they will not be as useful to other map makers, as their methods are fairly specialized. They may provide useful examples of how to accomplish more advanced manipulations of WarGear maps. They also both implement a createPNG() method which can be examined to see how PNGs for a map can be created.

Detailed Documentation

Most methods are documented here, but the documentation is incomplete. If you want to see every method that is available, please see the WGLib.py source.

Indices and tables

Table Of Contents

Next topic

Documentation for WGMap