How to define Sectors

From PSwiki
Jump to navigation Jump to search

Sectors are defined in the SectorsTable

In Unreal Engine we use this table also to define two additional important properties:

  • sect_coords
  • priority

sect_coords field can contain:

  • a set of coordinates like this: 127000,-381000,254000,-254000 representing the top-left and bottom-right corners of the square defining the sector
  • OR the word "usespline"

When there are just coordinates the sector will be defined as a square within the given coordinates and will occupy the FULL vertical space (Z axis)

When there is a "usespline" keyword, then the engine will look into the Persistent Level (Yliakum) searching for a spline object which contains a tag equal to sector.name and use the polygon defined by that spline as the boundaries of the sector.

In the picture below you see the sector spline defined around the arena level. The UE object to use for splines is in /Maps.

When using a spline, the engine will also look at the Z (vertical) position of the spline and use that to determine the upper limit of the sector. This means you can actually have multiple sectors defined one on top of the other. A good example is hydlaa and the sewers below it. Those are two separate sectors, each defined with a spline, at different heights.

The second field priority is extremely important, and needs to be managed properly.

Sectors are checked against the current player position in order of priority, from the lowest number (higher priority) to the highest number (lower priority).

You can define a sector inside another sector, we call this a subsector.

It's best to have all large levels without subsectors checked first, as those are square. All these will have priority 1. All sectors with subsectors, will have priority 10, and their subsectors priority 5 and 3. All unused sectors go to priority 1000 so will be checked last, and hopefully never hit.