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

Make smaller subs accelerate faster #14844

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mygamingaccount
Copy link

@mygamingaccount mygamingaccount commented Oct 16, 2024

Every submarine in Barotrauma accelerates at the same rate because drag is calculated directly off the submarine's mass.
This is quite counter intuitive: I would definitely expect a tiny drone to achieve top speed much earlier than a container ship. It also makes shuttles drive like aßß, to which the suggested solution is to increase thrust, but that has an unwanted effect of raising the top speed.

To overcome these limitations, this PR changes how hydrodynamic drag is calculated. It simply uses mass^⅔ and scales the forces to remain 100% compatible.

Disclamer: I know that Update() is not the best place to calculate these factors, but I'd rather you gave it a try how the changes make the game feel before I spent more time researching a better place for it.

(spoiler)

horizontalDragCoefficient and verticalDragCoefficient? They do absolutely nothing and are always 0.1

@Regalis11
Copy link
Collaborator

Have you considered calculating the drag "properly" based on the reference area of the sub instead? It could be cool if the shape of the sub affected the drag and the top speed.

@mygamingaccount
Copy link
Author

I guess that would be cool, yes. Intuition tells me that a sub that is more streamlined will tend to accelerate longer, and one that is thick will reach the top speed faster - at the same displacement. Meaning instead of size being the only factor, you could see different acceleration performance based on form. Interesting

Another case that I see where this could make a difference, is that of a submarine that has a variable geometry by the use of docking ports.

This is the reason I left MassToAreaExponent as a constant that can be changed: a lower value will exaggerate the effect done by this PR. I thought about serializing it too. But if the same effect could happen due to design decisions, that just feels a lot more engaging to me.

My fear is that it would incentivize streamlining, which might lead to more boring submarines overall. Currently builders can experiment with various shapes freely without concern for performance. This is one of those things that makes Barotrauma great, the crazy custom submarines.

Calculate drag using mass^(2/3), thereby increasing drag for small
vessels, and reducing drag for larger ones.
With a matching increase or decrease in engine thrust to keep the
same top speed, this will result in more maneuverable shuttles, and
more sluggish capital ships.
A sub 10 times smaller used to need 10 times less thrust force to
achieve the same speed. The new drag formula needs about 4.6 times more
than that. This change in the thust-to-weight ratio means faster
acceleration for drones and shuttles.
Calculate this factor to prevent the top speed from changing in existing
submarine designs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants