Thank you for the examples. I think the example of non-arcing weapons correctly shows the issue, but the arcing weapons and the waypoints weapons do not. I've attached an example for an arcing weapon (side view).
For alt display of arcing weapons, the zig-zag trajectory "issue" is negligible, because the arc itself makes the length much longer than if it was just a straight line.
So the alt display is completely off anyway.
For waypoint weapons, it's even more visible, there you can shoot five times around the whole map and target yourself at the end... distance=zero, length="as long as you want".
The alt display is currently practically useless here if the weapon has range power reduction.
Anyway, what I'm trying to argue here is that, a projectile that follows a trajectory, the total distance that it travelled should come from the "precise trajectory" and not from the "approximate trajectory", even though the projectile was drawn following the approximate trajectory.
It's really not simple.
At the point of impact, we don't have the "length of the precise trajectory" anymore.
And recalculating it from just the start point and the impact point is not straightforward... for example for arcing trajectories there is an unlimited number of parabolas between point A and B with different heights.
Also, there is RNG involved, we don't try all parabolas (obviously), just a few based on RNG... btw. that's why we can't predict trajectory length before we actually shoot.
And for alt display, there's yet more problems.
Even with having "precise trajectory" and even just considering straight line trajectories... the display just considers zero deviation... and no obstacles.
But the ideal trajectory (zero deviation) and the actual trajectory (with deviation) can easily be different.
Even two hits of the same tile/unit can have quite different results depending on whether you hit a unit at [0,0,0] or [15,15,23]... that's ~1.95 tiles difference! And for a 2x2 unit, the difference can be up to ~4.01 tiles.
And let's not even start with non-square tiles, we don't even have equal "distances" between all neighboring voxels... moving 16 voxels horizontally translates to moving 1 full tile, moving 16 voxels vertically translates to moving only ~0.666 tiles.
Bottomline:
1. in my opinion, the damage calculation is decent enough, serves the intended purpose and doesn't have bugs (i.e. works exactly as designed)
2. we could make a different one, but there's a LOT of things to consider... IMO not worth it
3. the alt display calculation is just a crude approximation given many limitations, some of which *cannot* even be worked around... it is objectively imprecise, but it's the best I can do