I'm trying to modelise the physics of the game, so I am checking my results trying to confirm with what the game is giving. So I write unit tests to be sure I got the correct results using the numbers I am reading from std::in
But if for now movement without collision, merging two chips, or accelerate them is fine (I got the exact same numbers with a 6 decimals precision...) I have issues with bouncing. I get really close results, but they are not exactly equals. I first thought there was a rounding issue in my code (that's so easy to multiply by an int when you wanted doubles ), but even doing the computation manually confirm what my code outputs...
Let's take an example:
Here is an oil droplet: (id, player, radius, x, y, vx, vy):(71,-1,11.254541,674.958088,243.466867,204.594188,5.062425)
The next turn the system tells me it became:
You'll note that its radius is the same, there was no collision with another object.
It should bounce when its x is reaching 800-11.254541 = 788.745459
Its position if there was no wall would have been 674.958088+204.594188=879.552276 so it bounced on the wall the difference between the bouncing x and its position without no wall is 879.552276-788.745459=90.806817
So our oil droplet should be at x=788.745459-90.806817=697.938642!
That's different from 698.314828!
I tried multiple time the computation, but I am always getting the same different result...
Any idea anyone?