After reading this suggestion from @Planr and thinking about it my conclusion was: "Better than the current system, but still not good enough. Why not going pro and use the inertia tensor (Trägheitstensor)?"
The Advantages:
- It's real world physics and will thus result in a realistic feeling when maneuvering ships.
- No artificial limitations, which would add to the game's complicatedness (even the simple system we have now isn't very intuitive).
- One system for both ships and turrets.
- It only punishes minimally for decorative ship parts, which increase a ship's box dimensions, but have low mass (e.g. antennas) - unlike other systems (like the current one) which work on box dims. Edit: It isn't clear how exactly this was changed in the update from 18.12.15.
- Ships with hollow spaces inside (hangars, interior) turn faster than completely stuffed ships of the same size.
- Due to limiting angular acceleration rather than angular velocity (= turn rate) big ships and turrets still can't react fast enough to agile fighters' evasive maneuvers, while on the other hand it doesn't take ages to aim at a target in a completely different direction.
- Isn't a half-assed solution, "uses inertia tensors" looks cool in the game discription, and this post, which took me hours, wasn't in vain.
The Technical Part:
The inertia tensor is a 3x3 matrix, which means 9 numbers (actually 6 due to symmetry) are added to the ship data, that's not much. Working with the inertia tensor is vector/matrix stuff which can probably be outsourced to the GPU, so the main problem is the calculation of the tensor, which is a lot of work in case of titans with millions of blocks. But the calculation can be done little by little during construction or when the ship is damaged. Due to the voxel geometry the simple version of the inertia tensor can be used, which is a sum of each block's influence (block = discrete mass point). This means adding or removing blocks doesn't require a recalculation of the whole ship, only the influence of the added/removed blocks must be added/subtracted. The worst case is a situation where a big ship is hit by a powerful missile and loses many blocks at once. However, the correction of the inertia tensor can be delayed a bit to avoid frame rate drops since the debris still hampers ship rotation a bit before it flys away.
The center of mass is calculated alongside the inertia tensor and is used as pivot in case of ships. Docked ships and turrets are treated as mass points at the position of their centers of mass when calculating the inertia tensor for the ship they are docked to. If the center of mass isn't at the position of the origin (= ship core) or in case of turrets, which usually don't rotate about their center of mass, the moment of inertia can still be calculated using the parallel axis theorem (Steinerscher Satz).
We still need a speed limit, though, to prevent situations where ships rotate at insane rates, but it shouldn't be a limiting factor most of the time due to advantage 1. This limit needn't depend on a ship's physical properties; a titan can realistically reach high turn rates, too, but it takes a while (and the same time to stop again) and is thus useless.
To prevent oversteering the angular acceleration should depend on the distance of the cursor from the center of the screen and on the angular velocity. For example, when a ship is already turning quickly and the cursor comes closer to the center, the angular acceleration should be negative to stop the rotation in time. This part is probably a bit tricky, but I'm sure schema can handle it.
The Advantages:
- It's real world physics and will thus result in a realistic feeling when maneuvering ships.
- No artificial limitations, which would add to the game's complicatedness (even the simple system we have now isn't very intuitive).
- One system for both ships and turrets.
- It only punishes minimally for decorative ship parts, which increase a ship's box dimensions, but have low mass (e.g. antennas) - unlike other systems (like the current one) which work on box dims. Edit: It isn't clear how exactly this was changed in the update from 18.12.15.
- Ships with hollow spaces inside (hangars, interior) turn faster than completely stuffed ships of the same size.
- Due to limiting angular acceleration rather than angular velocity (= turn rate) big ships and turrets still can't react fast enough to agile fighters' evasive maneuvers, while on the other hand it doesn't take ages to aim at a target in a completely different direction.
- Isn't a half-assed solution, "uses inertia tensors" looks cool in the game discription, and this post, which took me hours, wasn't in vain.
The Technical Part:
The inertia tensor is a 3x3 matrix, which means 9 numbers (actually 6 due to symmetry) are added to the ship data, that's not much. Working with the inertia tensor is vector/matrix stuff which can probably be outsourced to the GPU, so the main problem is the calculation of the tensor, which is a lot of work in case of titans with millions of blocks. But the calculation can be done little by little during construction or when the ship is damaged. Due to the voxel geometry the simple version of the inertia tensor can be used, which is a sum of each block's influence (block = discrete mass point). This means adding or removing blocks doesn't require a recalculation of the whole ship, only the influence of the added/removed blocks must be added/subtracted. The worst case is a situation where a big ship is hit by a powerful missile and loses many blocks at once. However, the correction of the inertia tensor can be delayed a bit to avoid frame rate drops since the debris still hampers ship rotation a bit before it flys away.
The center of mass is calculated alongside the inertia tensor and is used as pivot in case of ships. Docked ships and turrets are treated as mass points at the position of their centers of mass when calculating the inertia tensor for the ship they are docked to. If the center of mass isn't at the position of the origin (= ship core) or in case of turrets, which usually don't rotate about their center of mass, the moment of inertia can still be calculated using the parallel axis theorem (Steinerscher Satz).
We still need a speed limit, though, to prevent situations where ships rotate at insane rates, but it shouldn't be a limiting factor most of the time due to advantage 1. This limit needn't depend on a ship's physical properties; a titan can realistically reach high turn rates, too, but it takes a while (and the same time to stop again) and is thus useless.
To prevent oversteering the angular acceleration should depend on the distance of the cursor from the center of the screen and on the angular velocity. For example, when a ship is already turning quickly and the cursor comes closer to the center, the angular acceleration should be negative to stop the rotation in time. This part is probably a bit tricky, but I'm sure schema can handle it.
Last edited: