Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(fl-configs): Adopt Haste grade formulas for Cruise distance in graph calculations #30

Open
dd84ai opened this issue Jul 16, 2024 · 0 comments
Labels
fl-configs lang-golang Requires dealing with golang intensively wontfix This will not be worked on

Comments

@dd84ai
Copy link
Member

dd84ai commented Jul 16, 2024

Add as an optional thing, switch between Cruise Time distance = Distance/ship speed to Haste grade formulas in graph calculations.
Switching by default for darkstat to them

Relevant discussion

🤔 why to make non linear acceleration accounted. Linear is more than enough?
Haste — Yesterday at 2:30 PM
Because linear is quite far off reality
Especially if down the line transports gain mass and such

Darkwind The Dark Duck — Yesterday at 2:31 PM
do u have formula for real speed equation?
somewhere at starport perhaps
Haste — Yesterday at 2:31 PM
That while loop

drag = physics.Drag * currentCruiseSpeed;
netForce = physics.Torque - drag;

currentCruiseSpeed += (netForce / physics.Mass) * stepSize;
currentCruiseDistance += currentCruiseSpeed * stepSize;

Haste — Yesterday at 2:18 PM
Why not just precalculate the acceleration times and distances?
It's VERY quick and it becomes lookups that are also very fast

if (distanceCast <= transportHighestCruiseDistance)
{
    return transportCruiseTime[distanceCast];
}
else
{
    return transportCruiseTime[transportHighestCruiseDistance] + (transportCruiseSpeedMult * (distance - transportHighestCruiseDistance * 10));
}

(I do transports and freighters separately hence why it's a bit goofy)

while (currentCruiseSpeed < maxCruiseSpeed)
{
    elapsedTime += stepSize;

    if (elapsedTime < physics.CruiseChargeTime)
    {
        drag = physics.Drag * currentCruiseSpeed;
        netForce = physics.Torque - drag;

        currentCruiseSpeed += (netForce / physics.Mass) * stepSize;
        currentCruiseDistance += currentCruiseSpeed * stepSize;
    }
    else if (elapsedTime < physics.CruiseChargeTime+2) // "CRUISE_STEADY_TIME" compensation.
    {
        drag = physics.Drag * currentCruiseSpeed;
        netForce = ((physics.CruiseTorque + physics.Torque) / 2.0) - drag;

        currentCruiseSpeed += (netForce / physics.Mass) * stepSize;
        currentCruiseDistance += currentCruiseSpeed * stepSize;
    }
    else
    {
        drag = physics.Drag * currentCruiseSpeed;
        netForce = physics.CruiseTorque - drag;

        currentCruiseSpeed += (netForce / physics.Mass) * stepSize;
        currentCruiseDistance += currentCruiseSpeed * stepSize;
    }

    if (!pastThrustingDistance)
    {
        drag = physics.Drag * currentThrustSpeed;
        netForce = physics.ThrusterTorque - drag;

        currentThrustSpeed += (netForce / physics.Mass) * stepSize;
        currentThrustDistance += currentThrustSpeed * stepSize;

        if (currentThrustDistance > currentCruiseDistance)
        {
            bestDistance = currentThrustDistance;
        }
        else
        {
            bestDistance = currentCruiseDistance;
            pastThrustingDistance = true;
        }
    }
    else
    {
        bestDistance = currentCruiseDistance;
    }
@dd84ai dd84ai added fl-configs lang-golang Requires dealing with golang intensively labels Jul 16, 2024
@dd84ai dd84ai mentioned this issue Jul 16, 2024
39 tasks
@dd84ai dd84ai changed the title Adopt Haste grade formulas for Cruise distance in graph calculations Feat(fl-configs): Adopt Haste grade formulas for Cruise distance in graph calculations Jul 16, 2024
@dd84ai dd84ai moved this to Todo in @dd84ai's Dark Tools Jul 17, 2024
@dd84ai dd84ai removed the status in @dd84ai's Dark Tools Jul 17, 2024
@dd84ai dd84ai added the wontfix This will not be worked on label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fl-configs lang-golang Requires dealing with golang intensively wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant