Read by Council turning system: Moment of inertia V.2

    Joined
    Jul 2, 2013
    Messages
    47
    Reaction score
    86
    there's a few ship-turning system threads out there.
    The first one on that list above is still in "brainstorm this" mode. This thread is to address all issues with that suggestion and provide the technical details in a comprehensive way. The maths and such is at the bottom of the post, for those interested in it.

    The basics:
    -Base turning accelerating on modified moments of inertia (MOI) of your ship.
    -Adjust turning acceleration with rotational thruster like normal thrusters do for linear movement
    -More options to adjust turning with the config file.
    -still a maximum rotation speed limit (either set for all ships or based on max dimensions, to prevent ships from turning at dangerously fast rates, and their endpoints moving at much faster than server speed limit)

    So, what would this mean for gameplay?

    -Making a ship longer decreases your turning acceleration in directions perpendicular to that length. e.g. a thin stick is easy to spin around its lengthwise axis, but much harder to spin at right angles to that length axis
    -Replacing lighter blocks with heavier ones reduces your turning acceleration along all directions.
    -Adding rotational thrusters increases your turning acceleration. (can be made to function the same way as this.)

    higher turning acceleration means you get to where you're looking at faster.

    The system/maths behind it can be quite hard to understand, but the average player should only have to know the above three "rules". These should be intuitive, because they're reasonably realistic and very similar to the linear thrust mechanics.
    It starts with the inertia tensor like before, but this time we ignore and simplify a bunch of things, starting with the parts of the inertia tensor caused by asymmetry (which complicate things too much)
    inertia tensor.gif
    After that we still have 2 problems, the first being that using moments of inertia as-is would be a terrible idea because of scaling. In reality a 100m cube would be a 100.000 times slower to turn than a 10 m cube, if we were to apply this to starmade, everything but the smallest ships would become unusable. The solution? some basic mathematical operations on the real MOI.
    calculations1.gif
    We raise the MOI to a constant power and then multiply it by a different constant, both would be changeable in the config. (doubling c1 makes all ships twice as slow to turn, having c2 as 1 means you have actual realistic physics, having it between 1 and 0 means larger ships are less slow to turn, having it larger than 1 would make larger ships even slower to handle. Setting c2 as 0 means all ships turn at the same rate)
    This should make sure that you can adjust rotation to your liking on servers and in sp: should larger ships suffer their size or should all be created equally? All up to you.

    The way you apply this to the game is by limiting ships' turning acceleration (a or alpha) based on the available rotational thrust (M) and the ships moments of inertia (I) with this simple formula:
    calculations2.gif
    (this ignores one more thing: gyroscopic effects, which would only make things complicated once again.)

    With the current way you turn your ship, this would mean you start from 0 rotation speed and accelerate to the maximum rotation speed as fast as you can according to the above formula. You stay at max speed until you start to decelerate again to reach the desired rotation. This, instead of the way it currently seems to work where you gain max speed instantly and linearly slow down towards the point your mouse is at, which is by no means the fastest way to reach a rotation. It also means, currently, you can do some mouse trickery to turn faster than by just pointing at where you want to go.

    There are other control options out there, but that's for another time and another thread I guess.

    Now, the other important part, how do you actually calculate the moment of inertia? Let's start with the blocks themselves. MOI depends on the size and mass of an object. For starmade blocks we have two options, use the mass value of each block as its moment of inertia (considering nearly everything is a 1x1x1 cube, this would actually be a very neat approximation) or give each blocktype its own MOI value. The first is probably the simplest.

    As we now also have a center of mass of ships, the next step requires one less thing to implement. For the MOI of the whole ship we need to use the parallel axis theorem. The beauty of this is that you don't have to recalculate all of the blocks when you add/remove something. The only things you have to know are: The old MOI, the change in the center of mass location with the new block addition/subtraction, the old mass of the ship and the distance of the added block to the new center of mass. The steps to take are:

    -recalculate center of mass
    -calculate shift in center of mass location(which is perpendicular to the relevant axis, same goes for the shortest distance to the relevant COM axis.)
    -get the new MOI by calculating:
    new MOI=old MOI + old mass*(shift in COM location)^2+newblock MOI+blockmass*(shortest distance to relevant COM axis)^2

    this would have to be repeated for all 3 axes. I don't know how much of an impact this would be on performance. The calculations themselves aren't complicated, but there are quite a few of them and they aren't integer operations. If it's too much, one could approximate the MOI by treating 4x4x4 or 16x16x16 chunks of blocks as one block for instance.
    If you have any questions or if anything isn't clear yet, feel free to ask.
     
    • Like
    Reactions: Zaphord
    Joined
    Jun 10, 2015
    Messages
    333
    Reaction score
    98
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 4
    +1

    Since I usually put manuvering thrusters on my ships for show, this would actually improve my ships in general.

    Also, I love the idea of having actual dogfights with my fighters instead of circle strafing each other to death. This make it possible.
     
    Joined
    Jul 2, 2013
    Messages
    47
    Reaction score
    86
    that second part isn't actually the case with this yet, that would require your ship slways flying in the direction you're pointed at (if I understand you correctly), which I never mentioned.

    would be neat though.
     
    Joined
    Sep 13, 2014
    Messages
    44
    Reaction score
    29
    • Purchased!
    • Legacy Citizen 3
    Development of this game should be more focused on things like this, relatively small but game changing improvements.
    IMHO these reworks are waaaaay easier to implement than some pathfindings for new mobs and are at least 2x more useful. Since nobody bothers what lives on planets, because everyone just wants those shiny ores. Even if the alien would drop something like paint it would have to drop like 5000 of it to be worth to farm them.