Jump to content
Stray Fawn Community

Perfectly balanced drones twisting under thrust


Lurkily

Recommended Posts

I've found that even a drone with only a thruster in each cardinal direction, and a fuel tank on each corner - how can that be unbalanced, right? - twists under thrust.  You have to fly around a bit to see the effect on a very light craft, but on heavier drones it becomes clearer.

  • Like 1
Link to comment
Share on other sites

No, I mean under ONLY upward or ONLY leftward thrust.  Perfect balance, thrust in only one direction, still I get a twist.  When I said you have to fly around a bit, I meant only that the effect is slighter on crafts with low mass.

Link to comment
Share on other sites

Might I see the craft in question, so as to guess whether it has anything to do with air resistance or gravity? It is a little difficult to judge without knowing.

And if you could send me the .drn file, it would be even better. Of course, if it features some patented inventions, you can very well decide to keep it to yourself. I simply will not be able to help.

Link to comment
Share on other sites

Here it is; literally just thrusters in the cardinal directions and fuel at the corners.  I also added directional sensors to provide a signal that twist is happening. Air resistance doesn't seem to affect this.  Downthrust is balanced, but any other direction seems to cause this.

It wouldn't bother me, except that I worked very hard to balance some drones, and couldn't figure out why they would twist under thrust going up but not going down.

New Drone.drn

Link to comment
Share on other sites

The only thing I can think of is the regular planet space not being a square grid, but a round one. With the planet (which could be hollow for all I care) in the middle, space around it, and a craft orbiting in the area delimited by the rays sprouting from the planet:

Planet.png.ff776b846b72f0d6429fba2b033e3279.png

Imagine that the game takes an arc between these rays as basic distance unit: the one closer to the planet is smaller, and going higher means the arcs become larger, as shown on this magnificent schema.

In terms of coding, it means that a relatively precise number being used for the small arcs near the planet will also count the larger arcs above. If you have a double with the usual ~15 decimals for left-right movement around the lower parts of space, you will still have your ~15 decimals in the higher spheres, which might result in a lack of precision the higher you go. If a given altitude had arcs the size of e.g. one logic block, and another has arcs three times the width, you will require at least three times the precision to avoid rounding numbers and botching the calculations.

Another problem might be the fact that movement happens every thirtieth of a second, and any calculation with rounded numbers adds to the global imprecision of the craft's position. In a bent grid such as the one I am imagining exists in game, it means that e.g. going up will require to constantly adjust the length of an arc (start at 3/5th of an arc, go up a little; you now are at 3.0001/5th of an arc), which might bring its share of rounding as said above, plus calculate movement based off rounded information 30 times a second. The imprecision might add up quickly.

As for going down, I imagine that you gain in precision as you fly since the arcs grow smaller, thus the craft has less possible places to occupy. Perhaps. Maybe.

 

This is honestly all fantasising. Still, I cannot see a simple way to make a round space and calculate coordinates on a square grid, and rounding numbers that should not be is... pretty renowned for having caused most notably the 501st flight of the Ariane 5 space launcher to blow up in the air (code repeatedly stuffed a 64 bits number into a 16 bits space, no problem).

Let us ring the developer alarm to perhaps obtain some useful information, so as to divert them from their boring work as designers of a fantastic game.

riiiiing

  • Like 2
Link to comment
Share on other sites

もしもし?

I tried the drone you provided, @Lurkily. If I got that correct, with "twist" you mean that it slightly rotates the whole drone, not it "shakes uncontrollably"? :) 

I think there are two reasons for that. Either the position of the parts are not 100% symmetrical, but not because it's programmed wrong, but because of floating-point inaccuracies. This way, the position of a part might not be [0.000000,0.000000] but [-0.000001,0.000002]. This is easily testable (but I don't think this is the case)

Another idea might be (maybe more likely) that the physics engine simply is not accurate enough. (if I remember correctly, everything in there is made with integer-calculations for speed reasons). So the small inaccuracies accumulate over time and cause these small rotations of the rigidbodies.

[Edit]

Micha just told me: The way we have placed the colliders and the pivot points of the rigidbodies there might be some inaccuracies (some things are placed by hand). We might have to check that again. So far we did not see it as a problem, because as soon as you hit something or you have some slightly moving parts, the effect on the movement/rotation is bigger than the pivot inaccuracies :) 

Do you have a drone which is impossible because of this or is it a theoretical discussion?

  • Like 1
Link to comment
Share on other sites

No, no shaking - just a twist showing that the balance or thrust is off-center somehow.  It twists.

Nothing is made impossible.  It's just a visible discrepancy, when you specifically build for symmetry.  I wouldn't be all broken up if this didn't get corrected. though you might see it come up again.

  • Like 2
Link to comment
Share on other sites

7 hours ago, Lurkily said:

No, no shaking - just a twist showing that the balance or thrust is off-center somehow.  It twists.

Nothing is made impossible.  It's just a visible discrepancy, when you specifically build for symmetry.  I wouldn't be all broken up if this didn't get corrected. though you might see it come up again.

Yup, same here... but Im just OCD. :p Definitely much more noticable with bigger ships too, even if theyre perfectly symmetrical.

  • Like 1
Link to comment
Share on other sites

More slightly unbalanced parts, more twist. 

There is definitely a culprit in either the core, fuel tanks, or thrusters, as it is revealed when using only those. 

EDIT: Thrusters are my bet.

  • Like 2
Link to comment
Share on other sites

6 hours ago, Lurkily said:

More slightly unbalanced parts, more twist. 

There is definitely a culprit in either the core, fuel tanks, or thrusters, as it is revealed when using only those. 

EDIT: Thrusters are my bet.

Hmm~ you could make a tiny wireless drone using a factory to see if it is indeed the core or not yea? Maybe try just making a little ship which only uses thrusters and a single fuel tank? That could at least find out if it IS the core or not?

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

I fixed one thing today, which might also be related to this:

if you build a simple drone like this and attach the thruster directly to the drone core, it will fly straight.
But if you attach the thruster to the button part, it will skew down, even if gravity is not enabled.

Unbenannt.png.019713dc1ab73b7889ad44784dc46592.png

The issue was that the joints between the parts were not configured accurately.
It now flies straight both times :)

Link to comment
Share on other sites

I don't have a lot of time to game lately ( :( ) but I'll try to test it soon.  If anybody wants to beat me to it, the drone I had trouble with is linked above; it's exceedingly simple, but it's also proven to have this issue, which makes it a good test case.

  • Like 1
Link to comment
Share on other sites

I did some testing, but I think I might have screwed it up. Going to retest.

*Update*

It's still a problem on the preview build. I'll test the current live version next. 

*Second update*

It's still curving. When I first loaded up and tested the thruster-fuel-core setup in the live version, a thruster attached to the button wasn't producing a curve. Then I tested a bunch of other parts. All of them still curved, including other logic blocks. I went back and tested the button again, and now it's curving again too. 😆 

I restarted the game to see if I could reproduce the button flying straight. Now, nothing that isn't attached directly to the drone core is yielding straight thrust. 

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...