Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

For X4 (will largely also work for XR)

Preparation

Download the X-tools XR/X4 catalogue extraction tool from either steam (it’s available in ‘tools’) or the egosoft website

Have a text editor on hand, my personal favourites are notepad++ and vscode

Get familiar with the file structure of the base game, particularly everything within libraries and maps.

With all the necessary files it is now prudent to setup a file structure which should be as follows

your_highway_mod

libraries

maps

extensions

content.xml

  highwayconfigurations.xml

  xu_ep2_universe

  <mod/dlc_file_name>


  material_library.xml

    zonehighways.xml

    maps



    sectors.xml

      Sectors.xml


Note: extensions is only required if modifying the sectors of a DLC or mod, be sure to follow the way sectors.xml is named in the original. For example for cradle of humanity its actually named dlc_terran_sectors.xml

The inclusion of the libraries directory and its contents is optional and only relevant if the appearance of the highway is to be changed.

Getting Started

To get started open up zonehighways.xml with your editor and add the following:

<?xml version="1.0" encoding="utf-8"?>
<diff>
  <add sel="/macros">
    <!--We'll put highway macros here-->
  </add>
</diff>

For those unfamiliar with the usage of <diff/> and <add/> it is well worth looking at the X4 xml guides but in this guide most operations should be fairly self explanatory.

We now want to add a highway macro, to do that we need the following information:

  • Highway name, I recommend keeping it consistent with the vanilla naming scheme
    • Highwayxx_Clusteryyy_Sectorzzz_macro
  • Entry and exit points
  • Intermediate points with optional (but recommended) tangents
  • Configuration is optional and is for aesthetic purposes
  • All other nodes can remain empty

This information is to be added to the following template to the double quotes, e.g. <position x="" y="" z="" /> may be <position x="7000" y="-500" z="36.57" />

<macro name="Highway01_Cluster_113_Sector001_macro" class="highway">
    <component ref="standardzonehighway" />
    <connections>
      <connection ref="entrypoint">
        <offset>
          <position x="" y="" z="" />
        </offset>
      </connection>
      <connection ref="exitpoint">
        <offset>
          <position x="" y="" z="" />
        </offset>
      </connection>
    </connections>
    <properties>
      <boundaries>
        <boundary class="splinetube">
          <splineposition x="" y="" z="" tx="" ty="" tz="" weight="" inlength="0" outlength="" />
		  <splineposition x="" y="" z="" tx="" ty="" tz="" weight="" inlength="" outlength="" />
		  <splineposition x="" y="" z="" tx="" ty="" tz="" weight="" inlength="" outlength="" />
		  <splineposition x="" y="" z="" tx="" ty="" tz="" weight="" inlength="" outlength="0" />
          <size r="200" />
        </boundary>
      </boundaries>
      <controls>
        <linear>
          <time />
        </linear>
        <angular>
          <roll />
        </angular>
      </controls>
      <configuration ref="configuration_name" ring="0" />
    </properties>
  </macro>

Splines and Coordinates

The central section of zonehighways.xml denotes the shape of the highway and is contained within the boundary node, the boundary class is explicitly defined as a splinetube because a number of other elements like resource regions use the boundary node. Within the boundary node there are splineposition nodes which store the following information on each explicitly defined point on the spline curve:

splineposition noderole
x="" y="" z=""Denotes the co-ordinates of the point measured in metres from the origin (the centre of the sector unless changed in sectors.xml). In X4 the XZ plane is the "horizontal" plane that most objects are located on within sectors.
tx="" ty="" tz=""The tangent to the spline at the point (x,y,z) expressed as the vector (tx,ty,tz) measured in metres. I recommend making the vector a unit vector to make working with in and outlengths much easier.
weight=""Affects the speed of the highway at the point (x,y,z)
inlength="" & outlength=""Inlength scales the side of the tangent vector that is "before" the point itself, this makes the curve closer to the tangent. Outlength does the same to the side that is "after" the point. In and outlength also has the affect of setting the speed gradent, longer in and outlengths make for smoother changes in speed. The initial inlength and final outlength must both be 0 to prevent issues.

Diagrammatic representation of the splineposition node and its attributes

Navigation

  • No labels