Ship Shaking
-
Hi,
I just experienced the bug that my ship starts to shake when I get to far away from the center of the map.
Is this statementNo, I think the ship shaking is something that is inherent to the way Freelancer is built. My guess is that there is some floating point error in the updating of the ship’‘s location as it moves. Because of the newtonian physics of the FL engine, slowing down to a complete stop from either linear or angular motion will take literally infinite time, so the shaking continues for quite a while after the ship appears to be stopped. However, since the shaking does stop at some point, it also appears that there is some cutoff that will set the ship’‘s movement speed to zero once it falls below a certain point. If you could find that cutoff value, you could possibly try to increase it, which would cause the ship to stop shaking earlier when it isn’‘t supposed to be moving; however, this would not do anything for shaking while the ship is in motion. Offhand I don’‘t believe a real solution exists beyond keeping the size of the solar system low enough that you don’'t notice the shakes.
still up-to-date?
If so, there would be no way to build my mod as I wanted.
If I’d just size down all the ships and the values for engine, it’d be the same problem, as the now invisible shakes the ship experiences near the center of the map would then be noticeable due to the smaller proportions.I originally planned to do some really huge systems, I already got a planet with 260k diameter, being about 500k away from the sun - which looks really great
Thx for any help,
Paranoid -
I’ve worked on a mod with huge scales and scaling everything down actually helped. There was shaking, but it was manageable. We worked on a 1/20th scale from real size.
-
Isn’t there a Hex offset that you can change to sort that out?
-
Like this was some sort of feature…
Hex offsets only change what the developer made ON PURPOSE remember ::)
-
I think they were just lazy/didn’t have the time to fix it. I seriously see no advantage whatsoever, but I can see they haven’t fixed it because the systems they have didn’t get to a point where the shaking was really noticeable. It also goes in line with the large amount of stuff that’s half-done in the game.
-
You may find that it has to do with the integers Freelancer uses for the system. As you know it "plots"position coords.
There are two issues here and maybe this is what causes the shaking -
1. is the physical game default scale - which is 100kx100k
2. is the repositioning to check the players position with the navmap - which you scale to get the system largerThe engine is built on plotting to a standard size and therefore the “plotting” of the player ship will become more “inaccurate” the larger the system is. This is a common issue with largescale terrain in game engines which are not made for it.
My suggestion to fix this once and for all is to find the entry in the exe and increase the “standard” size (i.e. Li01 - doesnt have a navmapscale, its default), then see if the navmapscale in the universe.ini will work better.
The idea being that if the default size is only 100kx100k (New York, no nav map scale), And you set it to 100,000k or a similar multiple, the engine might cope with this better if its already the defult size.
either way, I do believe that the issue is the game trying to match your position in the actual game itself and the navmap, which are both updated at the same time. -
If this bug is related to the variable coordinates of the Ship, would it be possible to extent this variable with some more internal decimal places?
I just thought about scaling it all down, but if I keep the proportions and the shaking is really related to the ship’s postion, it would just continue to do so, as you would see everything larger, therefore also the more little inacurracies invisible at present scale.
If there’s a standard size for the systems in FL, like 100*100 K, it would be easier. I’ll try to investigate into both options.
-
**The error is actually due to matrix destabilization. The matrix for the camera is based off of the coordinates of the ship. Once the numbers get large the floating point errors start getting quite large. There is a fix but it would require an addition to the exe to fix it (w0dk4, a hook maybe?)
The quaternion matrix needs to be normalized right after its created and before it is transformed with the position vector. It is a single DX command but without the source I am unable to fix it.**
-
Well, I’m totally new to prgramming, but I will try to learn some in my holidays.
I’m just resizing, I post my results here after I tried. Btw, is there a way to rename the units for distance in Game?
13K would just sound such small/edit: Just tried it … would be in general possible, but it would take very much time to resize everything needed, besides the bugs that happen to appear resizing pieces from vanilla FL.
-
@Lancer:
**The error is actually due to matrix destabilization. The matrix for the camera is based off of the coordinates of the ship. Once the numbers get large the floating point errors start getting quite large. There is a fix but it would require an addition to the exe to fix it (w0dk4, a hook maybe?)
The quaternion matrix needs to be normalized right after its created and before it is transformed with the position vector. It is a single DX command but without the source I am unable to fix it.**
youll forever been an enourmous source of knowledge mate lol
-
@Lancer:
**The error is actually due to matrix destabilization. The matrix for the camera is based off of the coordinates of the ship. Once the numbers get large the floating point errors start getting quite large. There is a fix but it would require an addition to the exe to fix it (w0dk4, a hook maybe?)
The quaternion matrix needs to be normalized right after its created and before it is transformed with the position vector. It is a single DX command but without the source I am unable to fix it.**
As I understand it, the floating point errors increase simply because of the high float numbers, losing precision. How does your proposal help solve that?
I dont know a lot about 3D DirectX math stuff so please explain a little more -
**Well, I ran into this exact same problem writing my game engine. It took some time to track it down but it turned out that one of the quaternion routines in DX requires a normalized matrix. Unfortunately I don’t know where it is stored in FL, I ran across it a couple of years ago.
Basically the matrix needs to be normalized (converted to a 0.0 to 1.0 range) after this command D3DXQuaternionRotationYawPitchRoll and before this command D3DXMatrixAffineTransformation. The command that needs to be called is D3DXQuaternionNormalize and it needs to be the output from D3DXQuaternionRotationYawPitchRoll.
Sorry, I said position earlier, I was at work and didn’t have the code to look at, still part of the position transform is done by D3DXMatrixAffineTransformation. .
BTW, it’s actually the camera shaking, not the ship.
Edit - forgot to mention this, but the fix can also be applied in the view matrix calculation routine…**
-
Is it possible to write a programm that detects where the Freelancer.exe calls the D3DX routine (D3DXQuaternionRotationYawPitchRoll) for the camera?
If I understood you right, you would just have to add that normalization after this point.Thank you for making this point clear to me anyways
-
So, I have been doing some research on this and found quite a few things, sadly my conclusion is bad:
Not fixable.I was right earlier in this thread, floating points simply lose precision and at values of like 5000k, this precision error is already 0.5m. Thats why your cockpit jumps all over your screen that far out in a system.
@LS: FL doesnt really use D3DX functions as far as Im aware, they have their own math library which can be found in x86math.dll.
-
I’ll look thru my math code and see if I ever wrote a matrix normalization routine.
-
i smell a hook plugin ^^
-
I’m crossing my little fingers and toes that it does mean that