How is a Cluster's Offset position calculated?

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Karrade
Posts: 3
Joined: Tue, 6. Oct 20, 09:17
x4

How is a Cluster's Offset position calculated?

Post by Karrade »

In the Galaxy.xml file how do we determine what the offset position is in relation to the in-game map.

For reference, for the split sectors they use galaxy.xml values like this:

Code: Select all

      <offset>
        <position x="-30000000" y="0" z="86600000" />
      </offset>
      
Then for the boron clusters they use galaxy.xml values like this:

Code: Select all

	<offset>
	   <position x="-1.2e+08" y="0" z="5.196e+07" />
	</offset>

	<offset>
           <position x="-1.35e+08" y="0" z="4.33e+07" />
        </offset>
        
And Ingame map values like this:

-12, 5
-13, 3 etc

I've read people say just fiddle with it, but then i've also read that if its off-center odd errors occur.

As a secondary question, if I wanted something above the Boron for example, what equation would I be using to get exact long numbers like that?

Thanks
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: How is a Cluster's Offset position calculated?

Post by DeadAirRT »

For map modding just ignore the in game coordinates.

1x = 30000000
1y = 17320000

A full increment is only in cardinal direction. A diagonal is 0.5x or 0.5y.

You can try to convert how it works to in game coordinates but it's just an unnecessary step.
Karrade
Posts: 3
Joined: Tue, 6. Oct 20, 09:17
x4

Re: How is a Cluster's Offset position calculated?

Post by Karrade »

Thank you that makes things easier.
Unasodifton
Posts: 5
Joined: Fri, 31. Mar 23, 18:20

Re: How is a Cluster's Offset position calculated?

Post by Unasodifton »

On this topic, does anybody know how offset positions relate to clusters and sectors?

From what I can see, all cluster offsets are relative to the position of Grand Exchange I (sector 001 of Grand Exchange), which is at 0,0,0. I suspect that sectors are offset against the centre of the cluster they're attached to, so you'd add the coordinate positions together to get the real position, but I'm not sure - they might be offset in the same way clusters themselves are.

For example, the Grand Exchange sectors are easy to do this with because GE I is at the centre of the map. But for example with Black Hole Sun IV, which is the cluster (and therefore offset against Grand Exchange I at 0,0,0), is Black Hole Sun V's coordinates offset against the centre of its cluster (Black Hole Sun IV) or against Grand Exchange I like other clusters are? Just that this changes how the map looks a fair amount, in terms of where things actually are.

I'd also really like to know what the boundaries of components are - standardgalaxy, standardcluster, standardsector, standardzone, standardregion - and their shapes (like box, sphere, etc). I've seen people say they're infinite, but I think that's not really true - it seems like the game simply generates a new region in a particular component as you travel through it past the boundaries, so they can be expanded by travelling but I expect they do have defined boundaries regardless. Unfortunately these aren't documented as far as I can see?

There's some annotation in regions.xml that recommends a sector wide region (centred on the sector) be given a radius of 1 million meters, in order to make sure that it doesn't overlap with other sectors in the same cluster, and audio regions are half this radius, but maybe sectors themselves are larger than that given region (2 million meter diameter)? Further, for a cluster-wide region its recommended to omit boundaries to make the size effectively infinite, but I think 'effectively' is doing a lot of work here - I assume its simply that the boundaries of a cluster are very large such that it'd be difficult to practically get to the edge, possibly in the 10s of millions of meters diameter.


Regarding the question of this thread, and further to DeadAirRT's comment;

You can divide clusters into rows and columns in terms of their positions. Grand Exchange I (the Grand Exchange Cluster) is at the centre of the map, 0,0,0. None of the cluster vary on the y axis, so coordinates are 0,0 (x,z) effectively. x- is left of centre, x is right. z- is south, z is north.

In columns, clusters are placed in increments of 15million meters (I assume meters), so one column left of GE is x-15,000,000. Two left would be x-30,000,000 and so on. The furthest left cluster is Oort Cloud (Cluster 116), at x- 210,000,000. The furthest right cluster is Tharka's Ravine IV (Cluster 413) at x 180,000,000. Taking Grand Exchange I (Cluster 01) as the centre column, there are 12 columns right and 14 columns left, for a total of 27 columns including column 0 at increments of 15 million meters.

There is one exception to this, presumably unintentional, which is Turquoise Sea (Cluster 50) which is 16 meters further to the right (x 105,000,016) than all the others in its column.

Rows are more complicated because the increments vary though not by much - I give them here simply because precision is good in mapping. From the centre row (GE), there are 14 rows to the south (z-). The first two rows are at increments of 8,660,000, then they alternate between 10,000 and 8,650,000 until the penultimate row 13 at 20,000 and the final row at 8,640,000. From the centre going north (z), there are 18 rows. The first 4 rows north are at increments of 8,660,000 and then the 4 after that alternate between 10,000 and 8,650,000 increments. The 9th row north is 8,660,000 again, then the next two are 10,000 and 8,650,000. The final 7 rows north are at increments of 8,660,000.

So there are 33 rows total, although given the small variations (10,000 or 20,000) between some they are basically on the same row (if you ignore the small variations there are 24 total rows at roughly 8,660,000 meter increments). The furthest clusters north (z) are Eleventh Hour (Cluster 417) and Matrix 598 (Cluster 415) at z 129,900,000. The furthest clusters south are Oort Cloud (Cluster 116), Gaian Prophecy (Cluster 114), and Lasting Vengeance (Cluster 35), at z- 69,280,0000.

So the total height of the map from cluster centre to cluster centre (presumably its slightly bigger depending on the size of the clusters themselves) is 199,180,000. The total width is 390,000,000.

I think its the case that you don't have to worry about if sectors overlap cluster positions (though I'm not sure, see above) because I assume they're on a kind of different map layer than clusters. In any case, sector positions don't follow the same row/column positions they can be all over the place, usually quite far from the initial sector of the cluster. Zones and regions seem to be offset against the centre of the cluster they're attached to.

So to determine where to put new clusters you can simply make a grid of with Grand Exchange I (Cluster 01) at the centre, with 27 total columns (12 to the right of GE and 14 to the left) at intervals of 15,000,000, and 24 total rows (8 to the south of GE and 15 to the north) at intervals of 8,660,000. Any positions not taken by a cluster already are safe to place in. You can determine the offset position by reference to GE at x 0 z 0. The universe maps in various places online are accurate to positions (excepting the small deviations described above), so if there's an empty hex in those you can put a cluster there at the described intervals offset from the centre. Again, I'm not sure about sectors of clusters in terms of safe placement in an 'empty' hex.

edit: regarding the boron sectors, it seems like they started using a 'to the power of' function to avoid having to type so many 0s. You can just use the distances described above, or the positions shown by DeadAirRT its the same end result in numbers.
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: How is a Cluster's Offset position calculated?

Post by DeadAirRT »

Unasodifton wrote: Wed, 26. Apr 23, 11:17
Much better explanation than i could have done and thank you for correcting my use of y.
Unasodifton
Posts: 5
Joined: Fri, 31. Mar 23, 18:20

Re: How is a Cluster's Offset position calculated?

Post by Unasodifton »

DeadAirRT wrote: Wed, 26. Apr 23, 18:13
Unasodifton wrote: Wed, 26. Apr 23, 11:17
Much better explanation than i could have done and thank you for correcting my use of y.
no worries, thanks for your many comments explaining various aspects of this game's workings they've been very helpful when I've seen them.

To clarify a few things if anyone would find it helpful, the bugs mentioned by the OP might have something to do with the smaller increments of 10,000 between clusters going north/south - over a long distance from centre this might add up to cause issues but I've not looked into how the holomap display works its a guess.

Also, zones are offset against the centre of the sector they're attached to in sectors.xml, not clusters like I wrote. Regions are attached to clusters in clusters.xml, and therefore presumably offset against the first sector of every cluster (even regions for other sectors in the cluster), and defined in region_definitions.xml in libraries not maps. The spline positions for regions should be relative to the offset given in clusters.xml which will be the centre of the shape in region_definitions.xml (I think).

Zones are used to place gates of all kinds, particular objects, and also for the AI in god.xml and possibly other files like mission director, I haven't checked them all. Regions are used to place resources, hazards, and atmospheric effects like fog. Each cluster in clusters.xml also has a connection to a space component, which I think is used to place environment assets like background stars and planets and so on.

I think that sectors subsequent to the first are not offset as the clusters to GE, because sectorhighways are tubes between sectors with the offset defined in clusters.xml being the middle of the tube placed between the two sectors of the cluster, and those positions wouldn't make sense if sectors other than the first were offset against Grand Exchange like clusters are. Jump Gates, or ClusterGates I think are teleporters, while sector highways are seemingly physical roads. So it should be possible to fly between sectors without using the highways, unless I'm missing something, just that it'd take a long while and you'd need to know the actual position of the other sector relative to the first, which isn't on the map. Like Neopolis' Fortune II to IV should be a straight flight south for 1 hour 45 minutes at 5000m/s.

So for modding clusters, simply add a cluster to an empty area of the map according to the positions increments given above relative to GE, and add a pathway for the Cluster/Cluster jump gate, and a zone for each exit point in the sector of the cluster. And also add regions for resources, and also assets for space environment. But for adding more sectors to a cluster, if there are already more than one sector, you need to find out its position so you can add the highway in the correct direction and not tangle them up.

Also, while clusters don't vary on y axis, some sectors do like 416 (Guiding Star VII), which is around 9.5 million meters higher up than Guiding Star V. I guess this is because it gives a different view of whatever space environment asset background is in the cluster?

Although sectors are offset against clusters and not GE, I'm not sure if it matters if they overlap with clusters - I haven't checked them all but they don't seem to so maybe it does matter. I'm not sure if this means to mod the map you need to find out where all the sectors are and also where all the sector highways are in order to avoid them crossing one another?
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: How is a Cluster's Offset position calculated?

Post by Realspace »

Sectors won't vary in height because that would introduce all sort of problems, first of all is that regions would be not visible on the map, which is flat. Because regions are linked to the cluster (which also can't be moved on the y, hardcoded :evil: ), if you move a sector in relation to a cluster then it goes over or under the regions. While there is a certain tolerance, it is no more than a few thousands kms, last time I tried. Beyond that you won't see the blue or red painting on the map.
In guiding stars as in Uranus, they use different height to make the superhighway cross the ring belt. I personally used another way which is to make planets and regions roll or pitch together, so the superhighway remains straight from sector to sector, on the same level, while the space with its roids etc. is rolled/pitched, the effect is the same (well, it is nicer to see). It only takes hours to set the things, doing it by hand. But is doable.

About galaxy metrics, there is this tutorial that is still valid: https://github.com/enenra/x4modding/wik ... e-Creation ;-)
Unasodifton
Posts: 5
Joined: Fri, 31. Mar 23, 18:20

Re: How is a Cluster's Offset position calculated?

Post by Unasodifton »

Realspace wrote: Fri, 28. Apr 23, 00:13 Sectors won't vary in height because that would introduce all sort of problems, first of all is that regions would be not visible on the map, which is flat. Because regions are linked to the cluster (which also can't be moved on the y, hardcoded :evil: ), if you move a sector in relation to a cluster then it goes over or under the regions. While there is a certain tolerance, it is no more than a few thousands kms, last time I tried. Beyond that you won't see the blue or red painting on the map.
In guiding stars as in Uranus, they use different height to make the superhighway cross the ring belt. I personally used another way which is to make planets and regions roll or pitch together, so the superhighway remains straight from sector to sector, on the same level, while the space with its roids etc. is rolled/pitched, the effect is the same (well, it is nicer to see). It only takes hours to set the things, doing it by hand. But is doable.
Thanks for this, and for the link!

Can the specific issue with regions (you allude to other problems of course) be dealt with by changing the linear height of regions in region_definitions.xml? Or maybe their shape too if they're spheres and not cylinders?

I wonder if you may be able to confirm what I understand to be the case, given your extensive experience with modding the map;

Each cluster is its own map, that is to say that subsequent sectors (002,003) and of course the first sector (001) are not interactive with sectors of another cluster. However, they should be interactive (i.e. you could fly between them without using highways) with one another. So a cluster is an island connected by a teleporter (cluster gates), while sectors of a cluster are not?

The confusion I'm having is coming from the two comments in region_definitions.xml, one of which recommends setting no boundaries for a cluster-wide region (this makes sense - many sectors are 10s of millions of meters apart), which seemingly would only make sense if a cluster were an island as described above, its own map in other words. Otherwise a boundary-less (even "effectively infinite") region would presumably affect other clusters too, given they're often closer to one another than the sectors of a cluster.

The other comment is the one causing a small amount of confusion - it recommends for a sector-wide region, setting a radius of 1million meters - on a 2d plane the width/height would be 2million meters. It says this is to make it large enough for practical purposes, but also to avoid impacting other sectors in a cluster. But the absolute closest sectors in any cluster is Grand Exchange 001 -> Grand Exchange 002 (most are further apart than this, some even much further) from centre to centre is 22,367,172.5 meters. So I guess this is a very conservative sector-wide region diameter? A sector wide region could safely have a radius of 10x that in any given cluster, I think.

So in conclusion, it doesn't matter at all if sectors are given even exactly the same coordinates as other clusters, or even other sectors of other clusters, because they're not really on the same map? None of the sectors on the map overlap, but some are very close when plotted on the same map - for example 32_002 and 402_001 are only 1.5million meters apart if plotted on the same map. But again, the fact that none of them actually overlap makes me wonder if it would cause some issue if you were to put them at exactly the same coordinates of another sector in another cluster? And further, there's nothing stopping you (except possible display issues) from adding as many sectors to a cluster as you want? But you would need to be careful that the highway connections don't cross one another, given that they're often at a similar height on the y axis?

Also, from Avarice example, it seems that you can offset the initial sector (001) of a cluster too? I assume this is done because of Avarice's particular mechanics?

Lastly, there's a parameter in parameters.xml under <universe> called <sectorcontent maxdistance="10000000" /> do you happen to know what this is doing - whether its related to the display or to the map?

Sorry to bombard you with questions, feel free to tell me to find out for myself - I just prefer to plan properly first if possible as it makes mistakes less painful later on.
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: How is a Cluster's Offset position calculated?

Post by Realspace »

Clusters are the containers, nothing can be bigger than that, no region etc. But they are empty containers. Well, they contain the regions, that can't be displayed without a sector. And contain the sectors. A sector can be as big as a whole cluster or can take a portion of it. There can be 1 to max 4 sectors in each cluster. Sector has all the stuff, zones for stations, gates, superhighways etc. You don't connect two clusters with gates, you connect always two sectors, no matter if they are inside the same cluster or not. If they are inside the same cluster, you can connect them also with superhighways (and any gate oc). If they belong to different clusters, you have to use gates/accelerators. Highways (not superhighways) can only connect two zones inside the same sector.

Return to “X4: Foundations - Scripts and Modding”