Re: [MOD 0.17] VehicleSnap

The problem is that Factorio is a tile based game and everything is not practically moving exactly as math would make you expect to, based on rounding and whatnot.

Exactly!
The problem of rounding errors existed always, but it is not observable in the game for angles which are multiple of 45°: delta_x and delta_y are slightly incorrect, but their rounding errors are equal, so the real orientation in the game remains exactly 45°.
For any angle which is not a multiple of 45° (for example, half-diagonal rail in Factorio 2.0 or equiangular bisection 360°/16 in Factorio 1.1) the actual angle in the game does not match the mathematically correct angle due to independent rounding errors on axes x and y.

Using those results on it did not result in going along straight lines along the rails over longer periods of time, that is why i had to adjust it manually so that it was as close to straight as possible.

Yes, the correction is needed. But some fixed angle (found by trial-and-error) will not solve the problem, whatever this angle is.
A dynamic correction is needed here, just like how a real driver on a real car is correcting the car orientation all the time while driving.
The car went to the left - force the wheel a bit to the right.
The car went to the right - force the wheel a bit to the left.
The algorithm is very intuitive, it is not very hard to implement it.
Statistics: Posted by Egor — Tue Apr 14, 2026 12:04 pm