Coordinates system in splineposition

The place to discuss scripting and game modifications for X Rebirth.

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

Post Reply
User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Coordinates system in splineposition

Post by nidaren » Thu, 9. Apr 15, 23:32

Hello Everyone,

I was wondering if someone would be kind enough to shed some light on how these coordinates are being determined - if maybe there is a way in game to print i.e. in console command current location ?

I am trying to alter the attribute weight to slow down tube speed near my station in an empty-space zone, so the M class traffic can exit near it.

However, i have no idea how to find out what coordinates to use for the specified section of the tube I see in game, that passes closest to my station.

Any tips would be greatly appreciated!

Code: Select all

<splineposition x="5561.54248046875" y="0" z="10859.375" tx="0.183630749583244" ty="0" tz="0.982995271682739" weight="1" inlength="12890.7998046875" outlength="12890.7998046875" />

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Thu, 9. Apr 15, 23:40

to get the Sector coordinates you have to add the highway offset from the sectors.xml to the Splinepositions of the zohnehighways.xml ;) also be careful if there is a rotation there, because this makes this coordinate stuff weird - technically possible, but not used in vanilla, though ;)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 00:09

Thank you kindly! I will try to wrap my head around it a bit :):)

I was so much hoping for some kind of map where these would be more-less given when pointing your cursor on it or at least in game console pos print.

Maybe the last bit will get added at some point. Would make life so much easier:)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 10. Apr 15, 00:25

just write up a Script ;) here some MD Code which prints your Zone, Sector and Cluster coordinates every 5 seconds to the Info Monitor (NOT an example of good Coding Style, just slapped together in lees than a minute):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<mdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="UT_Semi-Secret_Project" xsi:noNamespaceSchemaLocation="http://utnas/~unitrader/XRebirthxsds/md.xsd">
  <cues>
    <cue name="PrintPos" checkinterval="5s" instantiate="true">
    <actions>
        <set_value name="$ShipOffset" exact="player.primaryship.position"/>
        <set_value name="$ZoneOffset" exact="player.zone.position"/>
        <set_value name="$SectorOffset" exact="player.sector.position"/>
        <show_notification caption="'Position'" details="[$ShipOffset,$ZoneOffset,$SectorOffset]" timeout="2s"/>
    </actions>
    </cue>
  </cues>
</mdscript>
and because i was just in the mood here an improved Version which should even add these coordinates correctls (including weird rotations)

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<mdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="UT_Semi-Secret_Project" xsi:noNamespaceSchemaLocation="http://utnas/~unitrader/XRebirthxsds/md.xsd">
  <cues>
    <cue name="PrintPos" checkinterval="5s" instantiate="true">
    <actions>
        <set_value name="$ZoneOffset" exact="player.primaryship.position"/>
        <transform_position name="$SectorOffset" refposition="player.zone.position" refrotation="player.zone.rotation"><position space="$ZoneOffset"/></transform_position>
        <transform_position name="$ClusterOffset" refposition="player.sector.position" refrotation="player.sector.rotation"><position space="$SectorOffset"/></transform_position>
        <show_notification caption="'Position'" details="[$ZoneOffset,$SectorOffset,$ClusterOffset]" timeout="2s"/>
    </actions>
    </cue>
  </cues>
</mdscript>
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 00:31

UniTrader wrote:just write up a Script ;) here some MD Code which prints your Zone, Sector and Cluster coordinates every 5 seconds to the Info Monitor (NOT an example of good Coding Style, just slapped together in lees than a minute)
Fantastic:) So much easier - if I understand it right -> sector offset coordinates are applicable when editing splineposition?

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 10. Apr 15, 00:34

jep, basically yes.. just add the Offset of the Tube to it ;)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 00:41

UniTrader wrote:jep, basically yes.. just add the Offset of the Tube to it ;)
Thank you very much for your time and sorry to trouble you :)

I love recently added possibility of building stations in empty space, which then gets transformed into New Zone. Now with that information I can fine tune the tube so M traffic can safely leave.

It was super annoying especially in Molten Archon (loop one way tube), where they would skip the station and simply leave at the end of the tube, slowboating to the station position from there.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 10. Apr 15, 01:22

nidaren wrote:
UniTrader wrote:jep, basically yes.. just add the Offset of the Tube to it ;)
Thank you very much for your time and sorry to trouble you :)

I love recently added possibility of building stations in empty space, which then gets transformed into New Zone. Now with that information I can fine tune the tube so M traffic can safely leave.

It was super annoying especially in Molten Archon (loop one way tube), where they would skip the station and simply leave at the end of the tube, slowboating to the station position from there.
i wanted to experiment with that myself, but didnt got to it yet, but since you are anyway on it could you please tell me if these extreme cases do work (for pathing and rendering) - basically they are all exits at high speeds:
1. 3 Splinepositions at the same Positions with weights 1,0,1 (if that works it is enough ;) the other ones are compromises ^^)
2. 3 Splinepositions with 1m space between them and weights 1,0,1
3. 4 Splinepositions at the same position with weights 1,0,0,1
4. 4 splinepositions with 1m distance and weights 1,0,0,1

i want to add Zone Exits at regular intervals to my tubes, but ones which wont disturb the travel in the tubes by unnecesarily slowing it down - and also thinking about making hi-speed-exits only for more fluid gameplay
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 01:47

Will gladly check it out, once I know how to get these exact locations of the tube. Still a bit cryptic to me, to be honest :)

In my example:

Sector POS printout:

Code: Select all

position.[99562.500000m, 0.000000m, -9546.875000m]
The Tube offset is: from sectors.xml

Code: Select all

<connection name="Highway06sector20_connection" ref="zonehighways">
        <offset>
          <position x="72000" y="-42.96875" z="-4515.625" />
        </offset>
Splinepositions: from zonehighways.xml

Code: Select all

<splineposition x="44210.9375" y="0" z="-24289.0625"
My question is: How do I transform <splineposition x="44210.9375" y="0" z="-24289.0625" into a zone coordinate so I can check its exact location in game by simply flying to it? If I knew that, I would be able to determine the points of weight changes very exact.

Would you mind explaining step by step?

Got completely lost:)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 10. Apr 15, 02:16

in this case you have to add the Connection Offset with the Splineposition to get the Sector coordinate:

Code: Select all

X            Y            Z	
72000        -42,96875   -4515,625        Connection Position
44210,9375   0           -24289,0625     + Splineposition
116210,9375  -42,96875   -28804,6875     = Sector Position
when handling these i usually use a small Excel/Calc table which prints the sum of 2 rows into the 3rd row ;) (or even more, depending on what i need)

and as you can see this is far off your position ^^

in your case the splineps should be in this range:

Code: Select all

X         Y          Z	
99562,5   0		    -9546,875      Your Position
72000     -42,96875  -4515625       - Connection Position
27562,5   42,96875   -5031,25       = near spline position
note also that there may not even be a splinepos near you since it is very rare that one is defined outside of Zones (i remember only one case)


EDIT: corrected valuse - a , got missing... :oops:
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 02:24

Very interesting, however as I move - zone position changes (the coordinates) but not the sector pos which remains the same no matter where in sector or zone I am.

Is there a way to directly transform splinepos into exact zone coordinate and not the sector one?

so bacically <splineposition x="44210.9375" y="0" z="-24289.0625" would become an X Y Z of the coordinates within a zone that spline point is located.

That would enable us to simply fly to the spot we like in game and be sure that the new splinepos is set up there.

In the above case I simply went near the entry gate and compared its coordinates with the ones defined in file - to check the corectness of the method.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 10. Apr 15, 02:45

nidaren wrote:Very interesting, however as I move - zone position changes (the coordinates) but not the sector pos which remains the same no matter where in sector or zone I am.
maybe i mixed up some values - as stated i wrote this up quickly ^^'' also the first Version just prints out the Offsets on each map level themselfes, it doesnt do any calculations to get the exact position in the Sector or cluster - the second should though ;)

nidaren wrote:Is there a way to directly transform splinepos into exact zone coordinate and not the sector one?
it is, but you have to know which Zone it is in.. it should then work out like this:
Splinepos + Spline Offset = Position in Sector
Position in Sector - Zone Offset = Position relative to Zone (not necesarily in the Zone if you picked the wrong one)
also there is no Splinepos which is exactly at sector pos, they are all only nearby. i think the fastest way is to add a new Splineposition between random weight="1" positions at a far-off coordinate until you have the desired Piece of the Tube (you will see it immediately when you have the right one because it wont pass the desired position anymore ^^) and then just use these Coordinates this way:
Playership position(in Zone) + Zone Position(in Sector) - Spline Offset (in Sector) = new desired Splinepos (use instead of the far-off one)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 02:50

Still - thank you very much for shedding some light onto the issue - I must say that by doing it one at the time is pure madness :)

However, if we could get your second script to print exact sector coordinates, that would make things much easier, sadly the second one does that only in case of zone, sector and cluster are just offsets themselves.

Wish Egosoft added this calucation within the game engine, then it would work that way:

1. Player flies the ship to the desired location.
2. Gets the exact calculated location.
3. Inputs it to define highway point.

Still time consuming but nowhere close to the current complexity :)

Or just for the sake of weight attribute:

1. Player creates new station in Empty Space
2. Empty Space becomes Zone
3. Nearest highway section - if closeby - gets auto patched the attribute.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 10. Apr 15, 03:02

ok, this SHOULD work.. just read some examples for transform_position and noticed my mistake:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<mdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="UT_Semi_Secret_Project" xsi:noNamespaceSchemaLocation="http://utnas/~unitrader/XRebirthxsds/md.xsd">
  <cues>
    <cue name="PrintPos" checkinterval="0.97s" instantiate="true">
    <actions>
        <set_value name="$ZoneOffset" exact="player.primaryship.position"/>
        <transform_position name="$SectorOffset" refposition="player.zone.position" refrotation="player.zone.rotation"><position value="$ZoneOffset"/></transform_position>
        <transform_position name="$ClusterOffset" refposition="player.sector.position" refrotation="player.sector.rotation"><position value="$SectorOffset"/></transform_position>
        <show_notification caption="'Position'" details="[$ZoneOffset,$SectorOffset,$ClusterOffset]" timeout="1s"/>
    </actions>
    </cue>
  </cues>
</mdscript>
i have passed the position as space instead of value :oops: above Version should work, also increased the update count for more fluent usage ;)

note that this does not include the Highway offset you still have to substract - i cannt guess which tube you possibly want the position for and printing out any is also no good idea.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 03:09

Of course, thanks again! Still super cool and useful.

For now - I used the method you proposed in your last post - simply by picking far off location near the end and going backwards via spline points until I got to location I wanted - worked like a charm :)

Given the complexity the tube editing presents now, doing it one by one with all calcs included is super hardcore.

I hope that maybe gals and guys from Egosoft, will consider adding a console command that would output the exact value needed by <splineposition definition - basing on simply where your ship is. That way by moving ship from loc to loc and outputing pos to logfile we would have ready tube splinepositions.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 10. Apr 15, 03:20

or simply add comments in the macro files which Zone each position is supposed to be ;) when i was mapping thats how i did everything - from the Station parts to the cluster positions (and also meaningful names instead of numbering everything ^^)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Fri, 10. Apr 15, 03:35

Very nice solution as well, would be super useful.

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Sat, 11. Apr 15, 03:31

UniTrader wrote:
i wanted to experiment with that myself, but didnt got to it yet, but since you are anyway on it could you please tell me if these extreme cases do work (for pathing and rendering) - basically they are all exits at high speeds:
1. 3 Splinepositions at the same Positions with weights 1,0,1 (if that works it is enough ;) the other ones are compromises ^^)
2. 3 Splinepositions with 1m space between them and weights 1,0,1
3. 4 Splinepositions at the same position with weights 1,0,0,1
4. 4 splinepositions with 1m distance and weights 1,0,0,1

i want to add Zone Exits at regular intervals to my tubes, but ones which wont disturb the travel in the tubes by unnecesarily slowing it down - and also thinking about making hi-speed-exits only for more fluid gameplay
Tested this extensively - tube is 17 km from my station, M class traffic slows down considerably in the sections with parameter weight 0, but ignores it and continues further until highway exit, being 170km from station. After that slowboats until the destination :)

I think I will build short highway from there:)

Checked the ai move scripts and it may have a bearing:

Code: Select all

        <find_zone name="$pathzone" priorityzone="true" tempzone="false" space="$destination">
          <match class="class.highway" negate="true"/>
        </find_zone>
It igores tempzone all stations build in empty space create a zone of that category - might be why.

Post Reply

Return to “X Rebirth - Scripts and Modding”