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

changed mass scaling (0.5x) and added config. #357

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ object EurekaConfig {
@JsonSchema(description = "The maximum amount extra each floater will multiply the buoyant force by, irrespective of mass")
var maxFloaterBuoyantFactor = 1.0

@JsonSchema(description = "how much the mass decreases the speed.")
var speedMassScale = 5.0

// The velocity any ship at least can move at.
@JsonSchema(description = "The speed a ship with no engines can move at")
var baseSpeed = 3.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
// Player controlled forward and backward thrust
private fun getPlayerForwardVel(control: ControlData, physShip: PhysShipImpl): Vector3d {

val mass10 = physShip.inertia.shipMass * 10
val scaledMass = physShip.inertia.shipMass * EurekaConfig.SERVER.speedMassScale
val vel: Vector3dc = physShip.poseVel.vel

// region Player controlled forward and backward thrust
Expand All @@ -311,7 +311,7 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {

// This is the speed that the ship is always allowed to go out, without engines
val baseForwardVel = Vector3d(forwardVector).mul(EurekaConfig.SERVER.baseSpeed)
val forwardForce = Vector3d(baseForwardVel).sub(velOrthogonalToPlayerUp).mul(mass10)
val forwardForce = Vector3d(baseForwardVel).sub(velOrthogonalToPlayerUp).mul(scaledMass)

if (extraForceLinear != 0.0) {
// engine boost
Expand All @@ -320,7 +320,7 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {

// This is the maximum speed we want to go in any scenario (when not sprinting)
val idealForwardVel = Vector3d(forwardVector).mul(EurekaConfig.SERVER.maxCasualSpeed)
val idealForwardForce = Vector3d(idealForwardVel).sub(velOrthogonalToPlayerUp).mul(mass10)
val idealForwardForce = Vector3d(idealForwardVel).sub(velOrthogonalToPlayerUp).mul(scaledMass)

val extraForceNeeded = Vector3d(idealForwardForce).sub(forwardForce)
forwardForce.fma(min(extraForceLinear / extraForceNeeded.length(), 1.0), extraForceNeeded)
Expand Down
Loading