LavishNav:Regions

From Lavish Software Wiki
Jump to navigation Jump to search

Introduction

What is a region?

A region is an individual area or point in 3-dimensional space. LavishNav defines 6 efficient region types: point, radius, rect, sphere, box, universe.

All types of regions can have any number of sub-regions (children) without restriction, regardless of whether they are inside the defined area of the parent region (which they should be). Certain characreristics of parent regions are inherited by child regions (such as avoidance flags). Regional hierarchy is a containment tree, which is used to make all algorithms other than basic pathfinding more efficient.

Regions with no parents are actually children of an inaccessible "root" region.

Region Behaviors

All types of regions have several defined behaviors that can be used both internally by the navigation system as well as via script to generate further useful information. These behaviors are undefined for the base region type, so the sections below will describe what the behaviors are or how they are used, not how the base region type will behave.

Containment

Containment is a condition that a given point resides within the bounds of a region. This behavior might be accessed, for example, to narrow a search for the nearest region to a given location (such as a player's location), or find the region that most strongly contains a given location.

Nearest Point

This behavior will get the nearest point within the bounds of the region to a given location.

Center Point

This behavior will get the logical center point of the region.

Region Characteristics

Note on terms used
Attributes and Properties collectively describe characteristics of the region. The difference is that attributes are defined inside the region tag in XML, and properties would be sub-tags contained by the region tag.

Attributes

  • Name
All regions must have a name. The name must not be the same as any of its siblings, but may be the same as another region elsewhere (including this region's parent and children)
  • Unique
Regions may be identified as Unique to prevent any other region from being created with the same name. Note that it is possible to create regions with the same name before a Unique region is defined with that name, however they may become difficult to access.
  • CoordinateSystem
This attribute can be used to signify that this region represents a new coordinate system. All child regions will reside in this coordinate system.

Notes on Region Names

A Fully-Qualified Name (FQN) is made up of a region's name and each of its parents' names (from this region to its outermost parent), separated by the . character. For example, if an region named "Bank" resides in a top-level region named "SomeCity", the region's FQN is "Bank.SomeCity". See Region Name Search

Properties

  • Data
Any number of custom data may be defined with a given Name as an attribute, and its value contained by the Data tag. Example: Some Value
  • Group
Any number of named region groups may be specified with a given Name as an attribute, and should contain no value. Example: <Group Name="Some Group"/>
  • Children
Any number of child regions can be defined within a Children container

See individual region types. Other characteristics are be available through the lnavregion object type

See Also