-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I just tried out version 1.0.7. It ate thru a constant stream of 16 full stacks of charged amethyst for 2 sec just to turn my ship 180 degrees.
That's WITH torque distribution:
function DroneBaseClassHexxySkies:applyTorqueIotaPattern(iotaPattern,net_angular_acceleration)
local normalized_ang_acc = net_angular_acceleration:normalize()
local distribution = net_angular_acceleration:length()*4
local distributed_torque = matrix.mul(self.ship_constants.LOCAL_INERTIA_TENSOR,matrix({
normalized_ang_acc.x,
normalized_ang_acc.y,
normalized_ang_acc.z}))
distributed_torque = vector.new(distributed_torque[1][1],distributed_torque[2][1],distributed_torque[3][1])
distributed_torque = distributed_torque*0.25
--print(textutils.serialise(distributed_torque:length()/self.ship_mass))
for i=0,distribution do
table.insert(iotaPattern,IOTAS.duplicateTopStack)
table.insert(iotaPattern,IOTAS.pushNextPatternToStack)
table.insert(iotaPattern,distributed_torque)
table.insert(iotaPattern,IOTAS.ship_apply_torque)
end
return iotaPattern
endIf we are paying for angular acceleration, I think the "force" vector for the OpTorqueApply should be multiplied to the ship's INV_INERTIA_TENSOR before getting it's length and multiplying it to the media dust constant:
https://github.com/walksanatora/hexsky/blob/dcac59e9f0723f8a2dd0dd6e47e91aff72d2931d/common/src/main/java/net/walksanator/hexxyskies/casting/patterns/ForceAppliers.kt#L57
angular_acceleration = INV_INERTIA_TENSOR * torque
dust = estimated_angular_acceleration:length() * media_cost
The ship's mass becomes too small of a number to get the angular acceleration cost when it comes to asymmetric ships. It makes it more expensive to turn a boat-shaped ship than a perfect cube.
It forces the player to build symmetric ships and I think that goes against the whole point of a magic flight system. Given the ship is running on literal magic and not obeying any laws of aerodynamics it should be able to fly regardless of its shape, right?
I understand that you might think it might be memory intensive to do a matrix multiplication each time (tbh, I think it might not even be that bad in Java, so try it out maybe). Adjusting the dust cost value might help. OR instead of multiplying it with the whole matrix, you can multiply the torque value with the "diagonal" of the INV_INERTIA_TENSOR:
torque= (tx,ty,tz)
diagonal_x = INV_INERTIA_TENSOR[0][0]
diagonal_y = INV_INERTIA_TENSOR[1][1]
diagonal_z = INV_INERTIA_TENSOR[2][2]
estimated_angular_acceleration = (torque.x*diagonal_x,torque.y*diagonal_y,torque.z*diagonal_z)
dust = estimated_angular_acceleration:length() * media_cost
It's not as accurate as using the whole matrix but it does account for asymmetry on ships