[#542][4.20 B4] X4 does not save/load station module position correctly

This forum provides information on obtaining access to Public Beta versions of X4: Foundations allowing people running those versions to provide feedback on their experiences.

Moderator: DevNet Public Moderators

Post Reply
adeine
Posts: 1089
Joined: Thu, 31. Aug 17, 17:34
x4

[#542][4.20 B4] X4 does not save/load station module position correctly

Post by adeine » Tue, 7. Dec 21, 09:16

I've been running into a weird issue where sometimes stations will seemingly not build correctly. Everything appears to be fine, but then randomly I'll look at it later and the game has rearranged the modules. I finally figured out what's happening and have a good reproducible case. It seems the game isn't saving/loading module position in a consistent manner - stations will build (or spawn in a custom start) correctly and everything seems to work as intended but upon saving the game, quitting and reloading, the positioning of modules will be messed up.

Way to reproduce the issue:

1. Import this build plan: https://drive.google.com/file/d/12d6HHs ... sp=sharing

2. It should look like this when viewed from above.

3. Start a creative game start with the station spawned in (this is the same effect of building it). Fly to it and verify it looks as the build plan indicates, as well as the station planner. No problems here.

4. Save the game and quit to desktop.

5. Restart X4, load the saved game and look at the station again. It now looks like this, with some of the habitat modules losing their intended positioning.

The issue appears to be related to specific connection snap and rotation combinations.

adeine
Posts: 1089
Joined: Thu, 31. Aug 17, 17:34
x4

Re: [4.20 B4] X4 does not save/load station module position correctly

Post by adeine » Tue, 7. Dec 21, 18:55

Managed to find the relevant section in the savegame xml and did another test with the modules in question all sequential using the same connector to eliminate any snap issues as suspect hopefully.

This build plan

Code: Select all

<entry index="40" macro="hab_ter_l_01_macro" connection="connectionsnap004">
<predecessor index="39" connection="connectionsnap04"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="90"/>
</offset>
</entry>
<entry index="41" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="40" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="12" pitch="90"/>
</offset>
</entry>
<entry index="42" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="41" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="24" pitch="90"/>
</offset>
</entry>
<entry index="43" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="42" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="36" pitch="90"/>
</offset>
</entry>
<entry index="44" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="43" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="48" pitch="90"/>
</offset>
</entry>
<entry index="45" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="44" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="60" pitch="90"/>
</offset>
</entry>
<entry index="46" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="45" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="72" pitch="90"/>
</offset>
</entry>
<entry index="47" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="46" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="84" pitch="90"/>
</offset>
</entry>
<entry index="48" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="47" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="96" pitch="90"/>
</offset>
</entry>
<entry index="49" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="48" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="108" pitch="90"/>
</offset>
</entry>
<entry index="50" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="49" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="120" pitch="90"/>
</offset>
</entry>
<entry index="51" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="50" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="132" pitch="90"/>
</offset>
</entry>
<entry index="52" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="51" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="144" pitch="90"/>
</offset>
</entry>
<entry index="53" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="52" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="156" pitch="90"/>
</offset>
</entry>
<entry index="54" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="53" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="168" pitch="90"/>
</offset>
</entry>
<entry index="55" macro="hab_ter_l_01_macro" connection="connectionsnap003">
<predecessor index="39" connection="connectionsnap03"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation pitch="90"/>
</offset>
</entry>
<entry index="56" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="55" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="12" pitch="90"/>
</offset>
</entry>
<entry index="57" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="56" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="24" pitch="90"/>
</offset>
</entry>
<entry index="58" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="57" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="36" pitch="90"/>
</offset>
</entry>
<entry index="59" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="58" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="48" pitch="90"/>
</offset>
</entry>
<entry index="60" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="59" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="60" pitch="90"/>
</offset>
</entry>
<entry index="61" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="60" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="72" pitch="90"/>
</offset>
</entry>
<entry index="62" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="61" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="84" pitch="90"/>
</offset>
</entry>
<entry index="63" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="62" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="96" pitch="90"/>
</offset>
</entry>
<entry index="64" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="63" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="108" pitch="90"/>
</offset>
</entry>
<entry index="65" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="64" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="120" pitch="90"/>
</offset>
</entry>
<entry index="66" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="65" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="132" pitch="90"/>
</offset>
</entry>
<entry index="67" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="66" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="144" pitch="90"/>
</offset>
</entry>
<entry index="68" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="67" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="156" pitch="90"/>
</offset>
</entry>
<entry index="69" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="68" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation yaw="168" pitch="90"/>
</offset>
</entry>
turns into this after saving the game:

Code: Select all

<entry id="[0xe22]" index="40" macro="hab_ter_l_01_macro" connection="connectionsnap004">
<predecessor index="39" connection="connectionsnap04"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.707107" qw="0.707106"/>
</offset>
</entry>
<entry id="[0xe23]" index="41" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="40" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.703233" qy="0.0739128" qz="0.0739128" qw="0.703233"/>
</offset>
</entry>
<entry id="[0xe24]" index="42" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="41" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.691655" qy="0.147016" qz="0.147016" qw="0.691654"/>
</offset>
</entry>
<entry id="[0xe25]" index="43" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="42" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.6725" qy="0.218508" qz="0.218508" qw="0.672498"/>
</offset>
</entry>
<entry id="[0xe26]" index="44" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="43" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe27]" index="45" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="44" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="89.89532"/>
</offset>
</entry>
<entry id="[0xe28]" index="46" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="45" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe29]" index="47" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="46" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.525483" qy="0.473147" qz="0.473147" qw="0.525481"/>
</offset>
</entry>
<entry id="[0xe2a]" index="48" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="47" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.473147" qy="0.525483" qz="0.525483" qw="0.473147"/>
</offset>
</entry>
<entry id="[0xe2b]" index="49" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="48" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe2c]" index="50" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="49" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.353553" qy="0.612372" qz="0.612373" qw="0.353553"/>
</offset>
</entry>
<entry id="[0xe2d]" index="51" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="50" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe2e]" index="52" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="51" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.218508" qy="0.672499" qz="0.672499" qw="0.218508"/>
</offset>
</entry>
<entry id="[0xe2f]" index="53" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="52" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.147016" qy="0.691655" qz="0.691655" qw="0.147016"/>
</offset>
</entry>
<entry id="[0xe30]" index="54" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="53" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<quaternion qx="-0.0739128" qy="0.703233" qz="0.703233" qw="0.0739128"/>
</offset>
</entry>
<entry id="[0xe31]" index="55" macro="hab_ter_l_01_macro" connection="connectionsnap003">
<predecessor index="39" connection="connectionsnap03"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.707107" qw="0.707106"/>
</offset>
</entry>
<entry id="[0xe32]" index="56" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="55" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.703233" qy="0.0739128" qz="0.0739128" qw="0.703233"/>
</offset>
</entry>
<entry id="[0xe33]" index="57" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="56" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.691655" qy="0.147016" qz="0.147016" qw="0.691654"/>
</offset>
</entry>
<entry id="[0xe34]" index="58" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="57" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.6725" qy="0.218508" qz="0.218508" qw="0.672498"/>
</offset>
</entry>
<entry id="[0xe35]" index="59" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="58" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe36]" index="60" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="59" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation pitch="89.89532"/>
</offset>
</entry>
<entry id="[0xe37]" index="61" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="60" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe38]" index="62" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="61" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.525483" qy="0.473147" qz="0.473147" qw="0.525481"/>
</offset>
</entry>
<entry id="[0xe39]" index="63" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="62" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.473147" qy="0.525483" qz="0.525483" qw="0.473147"/>
</offset>
</entry>
<entry id="[0xe3a]" index="64" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="63" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe3b]" index="65" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="64" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.353553" qy="0.612372" qz="0.612373" qw="0.353553"/>
</offset>
</entry>
<entry id="[0xe3c]" index="66" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="65" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<rotation pitch="89.92598"/>
</offset>
</entry>
<entry id="[0xe3d]" index="67" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="66" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.218508" qy="0.672499" qz="0.672499" qw="0.218508"/>
</offset>
</entry>
<entry id="[0xe3e]" index="68" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="67" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.147016" qy="0.691655" qz="0.691655" qw="0.147016"/>
</offset>
</entry>
<entry id="[0xe3f]" index="69" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="68" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="1077.634"/>
<quaternion qx="-0.0739128" qy="0.703233" qz="0.703233" qw="0.0739128"/>
</offset>
</entry>
If you look at the xml, the affected modules seem to be the ones that aren't converted to quaternion format, and the yaw declaration is just flat out dropped:

#44, #59 (yaw 48)
#45, #60 (yaw 60)
#46, #61 (yaw 72)
#49, #64 (yaw 108)
#51, #66 (yaw 132)

XenoXenoson
Posts: 44
Joined: Wed, 9. Feb 22, 22:47
x4

[6.0 Beta 2] Station Modules changing rotation

Post by XenoXenoson » Thu, 2. Feb 23, 06:55

At some point during the build of one of my stations in Avarice IV, the Terran Scrap Recyclers that were under construction appear to have snapped to a different rotation than they were originally placed in. Each of the three identical segments were created by selecting 'Copy Sequence' from the first completed segment, and appear fine when the changes are confirmed. It seems that at some point, these modules became detached, and rotated to the same angle as the first.

The station in question is Avarice IV Scrap Processing Factory I (EJZ-922).

As you can see from the screenshots and save below, the Argon M Container Storage modules and the Solar Panels are still attached in the correct place, and are sequenced correctly as though the Terran Scrap Recycler were oriented correctly. Rotating and moving the Terran Scrap Recyclers likewise moves the rest of the sequence, even though they are no longer connected. Removing and copying the sequence again appears to have fixed the issue, and unfortunately I don't have a save between when the plan was made and the rotation occurred. I hope this at least sheds some light on a potential bug.

Intended Sequence
Untitled.jpg
Broken Sequence
Untitled2.jpg
Station as originally planned
Untitled3.jpg
Save with Broken Sequences

https://1drv.ms/u/s!Ao-Dmai33_tmges--bq ... Q?e=3kJzhD

adeine
Posts: 1089
Joined: Thu, 31. Aug 17, 17:34
x4

Re: [#542][4.20 B4] X4 does not save/load station module position correctly

Post by adeine » Fri, 3. Feb 23, 03:32

If you want to test whether this is the same bug, try and replicate your build plan and save it in the station editor.

Then, if you build your station and it looks correct save the game, quit, and reload your save. If it's now messed up you are likely looking at the same issue, and sharing your build plan could be helpful. I recommend using the station design mode and a custom start to try and isolate the bug in an easy to replicate scenario (so you don't have to wait for things to build - the custom start will spawn affected builds correctly, they will then be screwed up by saving the game).

User avatar
ubuntufreakdragon
Posts: 5189
Joined: Thu, 23. Jun 11, 14:57
x4

Re: [#542][4.20 B4] X4 does not save/load station module position correctly

Post by ubuntufreakdragon » Fri, 3. Feb 23, 14:13

It is a mathematical issue whenever pitch gets close to +-90° yaw and roll become one angle effectively, little rotations of the module e.g. by floating point uncertainty result in a completely changed representation of the new rotation.
quaternions (qx=... qy=....) don't suffer from the issue, but only if they are used exclusively, which isn't the case for X4. There is only one solution drop support for euler angles entirely.
btw. X4 has a left handed coordinate system while most quaternions are defined for a right handed system this could lead to other rotation issues.
I reported the issue too some time ago.
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

User avatar
ubuntufreakdragon
Posts: 5189
Joined: Thu, 23. Jun 11, 14:57
x4

Re: [#542][4.20 B4] X4 does not save/load station module position correctly

Post by ubuntufreakdragon » Fri, 3. Feb 23, 14:25

Btw @adeine you can workaround the issue for your plan dou to the symmetry of the terran hab modules. replace

Code: Select all

<entry index="40" macro="hab_ter_l_01_macro" connection="connectionsnap004">
<predecessor index="39" connection="connectionsnap04"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="90"/>
</offset>
</entry>
<entry index="41" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="40" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="12" pitch="90"/>
</offset>
</entry>
with

Code: Select all

<entry index="40" macro="hab_ter_l_01_macro" connection="connectionsnap004">
<predecessor index="39" connection="connectionsnap04"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="90" roll="90"/>
</offset>
</entry>
<entry index="41" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="40" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="102" roll="90"/>
</offset>
</entry>
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

adeine
Posts: 1089
Joined: Thu, 31. Aug 17, 17:34
x4

Re: [#542][4.20 B4] X4 does not save/load station module position correctly

Post by adeine » Fri, 3. Feb 23, 18:16

ubuntufreakdragon wrote:
Fri, 3. Feb 23, 14:13
It is a mathematical issue whenever pitch gets close to +-90° yaw and roll become one angle effectively, little rotations of the module e.g. by floating point uncertainty result in a completely changed representation of the new rotation.
quaternions (qx=... qy=....) don't suffer from the issue, but only if they are used exclusively, which isn't the case for X4. There is only one solution drop support for euler angles entirely.
btw. X4 has a left handed coordinate system while most quaternions are defined for a right handed system this could lead to other rotation issues.
I reported the issue too some time ago.

Btw @adeine you can workaround the issue for your plan dou to the symmetry of the terran hab modules. replace

Code: Select all

<entry index="40" macro="hab_ter_l_01_macro" connection="connectionsnap004">
<predecessor index="39" connection="connectionsnap04"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation pitch="90"/>
</offset>
</entry>
<entry index="41" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="40" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="12" pitch="90"/>
</offset>
</entry>
with

Code: Select all

<entry index="40" macro="hab_ter_l_01_macro" connection="connectionsnap004">
<predecessor index="39" connection="connectionsnap04"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="90" roll="90"/>
</offset>
</entry>
<entry index="41" macro="hab_ter_l_01_macro" connection="connectionsnap001">
<predecessor index="40" connection="connectionsnap002"/>
<offset>
<position x="-396.137" y="-1325.224" z="-922.366"/>
<rotation yaw="102" roll="90"/>
</offset>
</entry>
I'm not sure that's right/what's happening here. If pitch being 90º leading to rounding errors is the issue, you'd expect the position for all habitation modules to be off - instead all of them (except the indicated #s) convert to quaternion format just fine with minimal margin of error. The affected modules aren't converted at all, and don't have a wrong yaw value - their yaw value is dropped from the save game entirely.

The two modules in your replacement example for instance work just fine the way they are. But if you set yaw to say 48, 60, 72, 108 or 132 they will not have a yaw value at all after saving the game.

User avatar
ubuntufreakdragon
Posts: 5189
Joined: Thu, 23. Jun 11, 14:57
x4

Re: [#542][4.20 B4] X4 does not save/load station module position correctly

Post by ubuntufreakdragon » Fri, 24. Feb 23, 07:14

Well I'm pretty sure.
I ran into this kind of stupid 3d-geometry issues quite often, you wouldn't imagine how much chaos they can cause.
Did you try to replace the pitch by roll to workaround your issue?
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

Post Reply

Return to “X4: Foundations - Public Beta Feedback”