Due to the last post, I wrote a unit test for the function and class in question, which made the errors painfully obvious, as can be seen here. I really should have gone this approach when we first noticed apparent bugs with the extrapolation, but I never thought it would be such a major design flaw.
Anyway, I figured the old code was not really usable, so I took and inspired myself from the picture I had devised for my initial presentation for how one could solve extrapolation and wrote new code, which seems to work as it should. Test results for the new code can be seen here.
The solution I use now uses a base vector for the extrapolation, which is set every time a new state is inserted into the Estimator object. Using this base and an estimated velocity (based on previous values), new estimations can be made. The trick when setting the estimated velocity is to take into consideration both the differences between the two latest inputs (the distance which would have been used for e.g. interpolation) but also the difference between our current/last estimation and the new input (which kind of symbolizes our error offset). It’s not a perfect solution, but it works, which the previous solution did NOT.
Next up is client-simulation in some form…
And because pictures are nice, a small update of the new level and ship that Andreas has made! Had to re-write the ObjLoader (last touched in 2013-07) for some reason because it failed to read the ship, but eh, yeah! :)