Skip to content

Portals File Format

Matt Basta edited this page Jun 13, 2014 · 1 revision

The .portals file format is used to describe ways in and out of a region via some sort of structure detailed in a land feature. For instance, a portal might represent the front door of a building which is placed in a town. It might also represent the steps down from one level of a dungeon to the next.

Portals have the following properties:

  • X and Y: The unsigned coordinates of the portal on the terrain
  • W and H: The unsigned dimensions of the portal
  • Target: A string which is used to determine which region the portal leads to
  • DestX and DestY: The floating point coordinates that the player arrives at in the target region

Each line in the .portals file represents a single portal. This is the syntax for one line:

<relX> <relY> <W> <H> <Target> <DestX> <DestY>

W, H, Target, DestX, and DestY map cleanly onto the Portal object properties. RelX and RelY are relative coordinates: they are relative to the top left position of the land feature that the .portals file corresponds to. For instance, if the portal is at the relative coordinates 2, 2 and the tileset for the land feature is placed at 5, 5, the final X and Y coordinates for the Portal would be 7, 7.

Target

The Target property is not exactly a region identifier. Instead, it is a relative region identifier. The following values are supported:

  • ..: The target is the current region's parent.
  • .: The target is the current region. This is useful for teleporting the user around within the current region.
  • Everything else is considered a child of the current region. foo:1:2 in overworld,field:0:0 would lead to overworld,field:0:0,foo:1:2.

Potential future syntaxes:

  • Leading dot: If the target begins with a ., the destination is relative to the parent: foo:1:2 in overworld,field:0:0,dungeon:1:1 would lead to overworld,field:0:0,foo:1:2.
  • /: A single slash leads to the top-most region.
  • Leading slash: If the target begins with a /, the destination is relative to the top-most region: foo:1:2 in overworld,field:0:0,dungeon:1:1 would lead to overworld,foo:1:2.
Clone this wiki locally